Ajout des fichiers de test goss et du playbook d'installation GLPI
This commit is contained in:
		
							
								
								
									
										5
									
								
								AP4/onfarbo41/onfinfra/ansible/glpi.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								AP4/onfarbo41/onfinfra/ansible/glpi.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
				
			|||||||
 | 
					---
 | 
				
			||||||
 | 
					- hosts: localhost
 | 
				
			||||||
 | 
					  connection: local
 | 
				
			||||||
 | 
					  roles:
 | 
				
			||||||
 | 
					    - glpi
 | 
				
			||||||
							
								
								
									
										10
									
								
								AP4/onfarbo41/onfinfra/ansible/roles/glpi/defaults/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								AP4/onfarbo41/onfinfra/ansible/roles/glpi/defaults/main.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,10 @@
 | 
				
			|||||||
 | 
					depl_url: "http://depl/store"
 | 
				
			||||||
 | 
					glpi_tgz: "glpi-9.5.7.tgz"
 | 
				
			||||||
 | 
					fusion: "fusioninventory-9.5+3.0.tar.bz2"
 | 
				
			||||||
 | 
					fusion64: "fusioninventory-agent_windows-x64_2.6.exe"
 | 
				
			||||||
 | 
					glpi_dir: "/var/www/html/glpi"
 | 
				
			||||||
 | 
					glpi_dbhost: "127.0.0.1"
 | 
				
			||||||
 | 
					glpi_dbname: "glpi"
 | 
				
			||||||
 | 
					glpi_dbuser: "glpi"
 | 
				
			||||||
 | 
					glpi_dbpasswd: "glpi"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										12
									
								
								AP4/onfarbo41/onfinfra/ansible/roles/glpi/files/glpi.conf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								AP4/onfarbo41/onfinfra/ansible/roles/glpi/files/glpi.conf
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
				
			|||||||
 | 
					DocumentRoot /var/www/glpi
 | 
				
			||||||
 | 
					        <Directory /var/www/glpi>
 | 
				
			||||||
 | 
					                Options Indexes FollowSymLinks MultiViews
 | 
				
			||||||
 | 
					                AllowOverride All
 | 
				
			||||||
 | 
					                Order allow,deny
 | 
				
			||||||
 | 
					                allow from all
 | 
				
			||||||
 | 
					                AuthType Basic
 | 
				
			||||||
 | 
					        </Directory>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" combined
 | 
				
			||||||
 | 
					        CustomLog ${APACHE_LOG_DIR}/glpi_access.log combined
 | 
				
			||||||
 | 
					        ErrorLog  ${APACHE_LOG_DIR}/glpi_error.log
 | 
				
			||||||
							
								
								
									
										3
									
								
								AP4/onfarbo41/onfinfra/ansible/roles/glpi/files/my.cnf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								AP4/onfarbo41/onfinfra/ansible/roles/glpi/files/my.cnf
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,3 @@
 | 
				
			|||||||
 | 
					[client]
 | 
				
			||||||
 | 
					user=root
 | 
				
			||||||
 | 
					password=root
 | 
				
			||||||
							
								
								
									
										18
									
								
								AP4/onfarbo41/onfinfra/ansible/roles/glpi/handlers/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								AP4/onfarbo41/onfinfra/ansible/roles/glpi/handlers/main.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
				
			|||||||
 | 
					---
 | 
				
			||||||
 | 
					- name: restart php-fpm
 | 
				
			||||||
 | 
					  service:
 | 
				
			||||||
 | 
					    name: php-fpm
 | 
				
			||||||
 | 
					    state: restarted
 | 
				
			||||||
 | 
					    enabled: yes
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- name: restart nginx
 | 
				
			||||||
 | 
					  service:
 | 
				
			||||||
 | 
					    name: nginx
 | 
				
			||||||
 | 
					    state : restarted
 | 
				
			||||||
 | 
					    enabled: yes  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- name: restart mariadb-server
 | 
				
			||||||
 | 
					  service: 
 | 
				
			||||||
 | 
					    name: mariadb-server
 | 
				
			||||||
 | 
					    state: restarted
 | 
				
			||||||
 | 
					    enabled: yes
 | 
				
			||||||
							
								
								
									
										134
									
								
								AP4/onfarbo41/onfinfra/ansible/roles/glpi/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										134
									
								
								AP4/onfarbo41/onfinfra/ansible/roles/glpi/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,134 @@
 | 
				
			|||||||
 | 
					---
 | 
				
			||||||
 | 
					  - name: Installation des paquets
 | 
				
			||||||
 | 
					    apt:
 | 
				
			||||||
 | 
					      state: latest
 | 
				
			||||||
 | 
					      name:
 | 
				
			||||||
 | 
					      - nginx
 | 
				
			||||||
 | 
					      - php-fpm
 | 
				
			||||||
 | 
					      - php-mbstring
 | 
				
			||||||
 | 
					      - php-mysql
 | 
				
			||||||
 | 
					      - php-gd
 | 
				
			||||||
 | 
					      - php-curl
 | 
				
			||||||
 | 
					      - php-xml
 | 
				
			||||||
 | 
					      - php-apcu
 | 
				
			||||||
 | 
					      - php-ldap
 | 
				
			||||||
 | 
					      - php-imap
 | 
				
			||||||
 | 
					      - php-xmlrpc
 | 
				
			||||||
 | 
					      - php-cas
 | 
				
			||||||
 | 
					      - python3-mysqldb
 | 
				
			||||||
 | 
					      - mariadb-server
 | 
				
			||||||
 | 
					      - python3-pymysql
 | 
				
			||||||
 | 
					      - php-intl
 | 
				
			||||||
 | 
					      - php-bz2
 | 
				
			||||||
 | 
					      - php-zip
 | 
				
			||||||
 | 
					      - postfix
 | 
				
			||||||
 | 
					      - mailutils
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  - name: Changement listen dans le fichier conf de php
 | 
				
			||||||
 | 
					    replace:
 | 
				
			||||||
 | 
					      dest: /etc/php/7.4/fpm/pool.d/www.conf
 | 
				
			||||||
 | 
					      regexp: 'listen = /run/php/php7.4-fpm.sock'
 | 
				
			||||||
 | 
					      replace: 'listen = 127.0.0.1:9000'
 | 
				
			||||||
 | 
					      backup: yes
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  - name: Effacement block nginx default
 | 
				
			||||||
 | 
					    file:
 | 
				
			||||||
 | 
					      path: /etc/nginx/sites-enabled/default 
 | 
				
			||||||
 | 
					      state: absent
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  - name: Creation fichier block nginx
 | 
				
			||||||
 | 
					    template: 
 | 
				
			||||||
 | 
					      src: block.j2 
 | 
				
			||||||
 | 
					      dest: /etc/nginx/sites-enabled/glpi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  - name: Remplacement dans le fichier de conf php du timeout
 | 
				
			||||||
 | 
					    replace:
 | 
				
			||||||
 | 
					      dest: /etc/php/7.4/fpm/php.ini
 | 
				
			||||||
 | 
					      regexp: 'max_execution_time = 30'
 | 
				
			||||||
 | 
					      replace: 'max_execution_time = 600'
 | 
				
			||||||
 | 
					      backup: yes
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    notify:
 | 
				
			||||||
 | 
					      - restart nginx
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  - name: Creation de la base de donnee mysql
 | 
				
			||||||
 | 
					    mysql_db:
 | 
				
			||||||
 | 
					      name: "{{ glpi_dbname }}"
 | 
				
			||||||
 | 
					      check_implicit_admin: yes
 | 
				
			||||||
 | 
					      state: present
 | 
				
			||||||
 | 
					      login_unix_socket: /var/run/mysqld/mysqld.sock
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  - name: Creation de l'utilisateur mysql avec tous les privileges
 | 
				
			||||||
 | 
					    mysql_user:
 | 
				
			||||||
 | 
					      user: "{{ glpi_dbuser }}"
 | 
				
			||||||
 | 
					      password: "{{ glpi_dbpasswd }}"
 | 
				
			||||||
 | 
					      priv: "*.*:ALL,GRANT"
 | 
				
			||||||
 | 
					      login_unix_socket: /var/run/mysqld/mysqld.sock
 | 
				
			||||||
 | 
					      state: present
 | 
				
			||||||
 | 
					 #   with_items:
 | 
				
			||||||
 | 
					  #    - 127.0.0.1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  - name: Creation du repertoire {{ glpi_dir }}
 | 
				
			||||||
 | 
					    file: 
 | 
				
			||||||
 | 
					      path: "{{ glpi_dir }}"
 | 
				
			||||||
 | 
					      state: directory
 | 
				
			||||||
 | 
					      owner: www-data
 | 
				
			||||||
 | 
					      group: www-data
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  - name: Installation de GLPI
 | 
				
			||||||
 | 
					    unarchive:
 | 
				
			||||||
 | 
					      src: "{{ depl_url }}/{{ glpi_tgz }}"
 | 
				
			||||||
 | 
					      dest: /var/www/html
 | 
				
			||||||
 | 
					      remote_src: yes
 | 
				
			||||||
 | 
					      owner: www-data
 | 
				
			||||||
 | 
					      group: www-data
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  - name: Changement des attributs {{ glpi_dir }}
 | 
				
			||||||
 | 
					    file: 
 | 
				
			||||||
 | 
					      path: "{{ glpi_dir }}" 
 | 
				
			||||||
 | 
					      owner: www-data 
 | 
				
			||||||
 | 
					      group: www-data 
 | 
				
			||||||
 | 
					      mode: 0755 
 | 
				
			||||||
 | 
					      recurse: yes
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  - name: Changement des attributs {{ glpi_dir }}/plugins
 | 
				
			||||||
 | 
					    file:
 | 
				
			||||||
 | 
					      path: "{{ glpi_dir }}/plugins"
 | 
				
			||||||
 | 
					      mode: 0777
 | 
				
			||||||
 | 
					      owner: www-data
 | 
				
			||||||
 | 
					      group: www-data
 | 
				
			||||||
 | 
					      recurse: yes
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  - name: Installation de Fusioninventory pour Linux
 | 
				
			||||||
 | 
					    unarchive:
 | 
				
			||||||
 | 
					      src: "{{ depl_url }}/{{ fusion }}"
 | 
				
			||||||
 | 
					      dest: "/var/www/html/glpi/plugins"
 | 
				
			||||||
 | 
					      remote_src: yes
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  - name: Creation de ficlient
 | 
				
			||||||
 | 
					    file:
 | 
				
			||||||
 | 
					      path: /var/www/html/ficlients
 | 
				
			||||||
 | 
					      state: directory
 | 
				
			||||||
 | 
					      owner: www-data
 | 
				
			||||||
 | 
					      group: www-data
 | 
				
			||||||
 | 
					      mode: 0775
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  - name: Attribution des droits nginx.index
 | 
				
			||||||
 | 
					    file:
 | 
				
			||||||
 | 
					      path: /var/www/html/index.nginx-debian.html
 | 
				
			||||||
 | 
					      owner: www-data
 | 
				
			||||||
 | 
					      group: www-data
 | 
				
			||||||
 | 
					      mode: 0775
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  - name: Installation de FusionInventory windows x64
 | 
				
			||||||
 | 
					    get_url:
 | 
				
			||||||
 | 
					      url: "{{ depl_url }}/{{ fusion64 }}"
 | 
				
			||||||
 | 
					      dest: "/var/www/html/ficlients"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  - name: Attribution des permissions sur repertoire /plugins/fusioninventory
 | 
				
			||||||
 | 
					    file:
 | 
				
			||||||
 | 
					      path: /var/www/html/glpi/plugins/fusioninventory
 | 
				
			||||||
 | 
					      owner: www-data
 | 
				
			||||||
 | 
					      group: www-data
 | 
				
			||||||
 | 
					      recurse: yes
 | 
				
			||||||
 | 
					      state: directory
 | 
				
			||||||
							
								
								
									
										23
									
								
								AP4/onfarbo41/onfinfra/ansible/roles/glpi/templates/block.j2
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								AP4/onfarbo41/onfinfra/ansible/roles/glpi/templates/block.j2
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,23 @@
 | 
				
			|||||||
 | 
					server {
 | 
				
			||||||
 | 
					        listen   80 default_server;
 | 
				
			||||||
 | 
					        root {{ glpi_dir }};
 | 
				
			||||||
 | 
					        index index.php;
 | 
				
			||||||
 | 
					        server_name localhost;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        location / {try_files $uri $uri/ index.php;}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        #prise en charge PHP
 | 
				
			||||||
 | 
					        location ~ \.php$ {
 | 
				
			||||||
 | 
					                fastcgi_pass 127.0.0.1:9000;
 | 
				
			||||||
 | 
					                fastcgi_index index.php;
 | 
				
			||||||
 | 
					                include /etc/nginx/fastcgi_params;
 | 
				
			||||||
 | 
					                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
 | 
				
			||||||
 | 
					                include fastcgi_params;
 | 
				
			||||||
 | 
					                fastcgi_param SERVER_NAME $host;
 | 
				
			||||||
 | 
					  	 }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						location /ficlients {
 | 
				
			||||||
 | 
							root /var/www/html;
 | 
				
			||||||
 | 
							autoindex on;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										39
									
								
								AP4/onfarbo41/onfinfra/goss/goss.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								AP4/onfarbo41/onfinfra/goss/goss.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,39 @@
 | 
				
			|||||||
 | 
					port:
 | 
				
			||||||
 | 
					  tcp:80:
 | 
				
			||||||
 | 
					    listening: true
 | 
				
			||||||
 | 
					    ip:
 | 
				
			||||||
 | 
					    - 0.0.0.0
 | 
				
			||||||
 | 
					  tcp:3306:
 | 
				
			||||||
 | 
					    listening: true
 | 
				
			||||||
 | 
					    ip:
 | 
				
			||||||
 | 
					    - 127.0.0.1
 | 
				
			||||||
 | 
					service:
 | 
				
			||||||
 | 
					  mysql:
 | 
				
			||||||
 | 
					    enabled: true
 | 
				
			||||||
 | 
					    running: true
 | 
				
			||||||
 | 
					user:
 | 
				
			||||||
 | 
					  mysql:
 | 
				
			||||||
 | 
					    exists: true
 | 
				
			||||||
 | 
					    uid: 106
 | 
				
			||||||
 | 
					    gid: 112
 | 
				
			||||||
 | 
					    groups:
 | 
				
			||||||
 | 
					    - mysql
 | 
				
			||||||
 | 
					    home: /nonexistent
 | 
				
			||||||
 | 
					    shell: /bin/false
 | 
				
			||||||
 | 
					group:
 | 
				
			||||||
 | 
					  mysql:
 | 
				
			||||||
 | 
					    exists: true
 | 
				
			||||||
 | 
					    gid: 112
 | 
				
			||||||
 | 
					interface:
 | 
				
			||||||
 | 
					  enp0s3:
 | 
				
			||||||
 | 
					    exists: true
 | 
				
			||||||
 | 
					    addrs:
 | 
				
			||||||
 | 
					    - 192.168.2.12/24
 | 
				
			||||||
 | 
					    - fe80::a00:27ff:fea2:45fd/64
 | 
				
			||||||
 | 
					    mtu: 1500
 | 
				
			||||||
 | 
					  enp0s8:
 | 
				
			||||||
 | 
					    exists: true
 | 
				
			||||||
 | 
					    addrs:
 | 
				
			||||||
 | 
					    - 192.168.0.39/24
 | 
				
			||||||
 | 
					    - fe80::a00:27ff:fe66:36e3/64
 | 
				
			||||||
 | 
					    mtu: 1500
 | 
				
			||||||
		Reference in New Issue
	
	Block a user