commit aa24780334e3967345286b3aa87dbc12b3bb2c0a Author: root Date: Thu Dec 7 11:31:22 2023 +0100 Install glpi avec docker diff --git a/mission8/glpi.yml b/mission8/glpi.yml new file mode 100644 index 0000000..68e1cf8 --- /dev/null +++ b/mission8/glpi.yml @@ -0,0 +1,79 @@ +--- +- hosts: glpi + become: true + + tasks: + - name: Installation des paquets requis + apt: + name: + - wget + - curl + - git + - vim + state: present + + - name: Téléchargement du script d'installation docker + get_url: + url: "https://get.docker.com" + dest: "/home" + + - name: Donner les droits d'exécution au script docker + file: + path: "/home/get-docker.sh" + mode: "u+x" + state: touch + + - name: exécution du script docker + command: "bash get-docker.sh" + + - name: Creation d'un repertoire pour Docker/GLPI + file: + path: "/home/docker/glpi" + state: directory + + - name: Copie du fichier Docker Compose + copy: + content: | + version: "3.2" + services: + mariadb: + image: mariadb:10.7 + container_name: mariadb + hostname: mariadb + volumes: + - /home/docker/glpi/mysql:/var/lib/mysql + env_file: + - /home/docker/glpi/mariadb.env + restart: always + + glpi: + image: diouxx/glpi + container_name: glpi + hostname: glpi + ports: + - "80:80" + volumes: + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + - /var/www/html/glpi/:/var/www/html/glpi + environment: + - TIMEZONE=Europe/Paris + restart: always + dest: "/home/docker/glpi/docker-compose.yml" + + - name: Copie du fichier de l'environnement MariaDB (mariadb.env) + copy: + content: | + MARIADB_ROOT_PASSWORD=diouxx + MARIADB_DATABASE=glpidb + MARIADB_USER=glpi_user + MARIADB_PASSWORD=glpi + dest: "/home/docker/glpi/mariadb.env" + + - name: Démarrage Docker compose + command: "docker compose up -d" + args: + chdir: "/home/docker/glpi" + + - name: Affichage de l'adresse IP + command: "ip -br a"