Premier commit

This commit is contained in:
phil
2021-01-04 22:49:46 +01:00
parent da1100578d
commit 65b2a3eaf3
538 changed files with 52570 additions and 0 deletions

3
roles/itil/files/.my.cnf Normal file
View File

@@ -0,0 +1,3 @@
[client]
user=root
password=root

4
roles/itil/files/dbdump Normal file
View File

@@ -0,0 +1,4 @@
#!/bin/sh
chm="/var/www/html/glpi/files/_dumps"
# Dump base GLPI
mysqldump -uroot -proot glpi |gzip > $chm/$(date +%Y-%m-%d).sql.gz

View 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

View File

@@ -0,0 +1,9 @@
---
- name: restart php-fpm
service: name=php7.0-fpm state=restarted
- name: restart nginx
service: name=nginx state=restarted
- name: restart mariadb-server
service: name=mariadb-server state=restarted

120
roles/itil/tasks/main.yml Normal file
View File

@@ -0,0 +1,120 @@
---
- 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
- python-mysqldb
- mariadb-server
- name: Changement listen dans le fichier conf de php7.3
replace:
dest: /etc/php/7.3/fpm/pool.d/www.conf
regexp: 'listen = /run/php/php7.3-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.3/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 }} state=present
- name: Creation de l'utilisateur mysql avec tous les privileges
mysql_user:
name={{ glpi_dbuser }}
password={{ glpi_dbpasswd }}
priv=*.*:ALL
- name: Creation du repertoire {{ glpi_dir }}
file: path={{ glpi_dir }} state=directory owner=www-data group=www-data
- name: Installation de GLPI
unarchive:
src: http://depl/gsbstore/glpi-{{ glpi_version }}.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
recurse: yes
- name: Attribution des permissions
shell: chown -R www-data:www-data /var/www/html/glpi/
# - name: copy .my.cnf file with root password credentials
# copy: src=.my.cnf dest=/root/tools/ansible/.my.cnf owner=root mode=0600
- name: Installation de Fusioninventory pour Linux
unarchive:
src: http://depl/gsbstore/fusioninventory-{{ fd_version }}.tar.bz2
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: http://depl/gsbstore/fusioninventory-agent_windows-{{ fd_version64 }}.exe
dest: "/var/www/html/ficlients"
- name: Installation de FusionInventory windows x86
get_url:
url: http://depl/gsbstore/fusioninventory-agent_windows-{{ fd_version86 }}.exe
dest: "/var/www/html/ficlients"
- name: Copie du script dbdump
copy: src=dbdump dest=/root/
- name: chmod de dbdump
shell: chmod +x /root/dbdump
- debug:
msg: "Redemarrez le serveur GLPI"
- debug:
msg: "L'utilisateur mysql:ID:glpi et MDP:glpi"

View 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;
}
}