Install glpi avec docker

This commit is contained in:
root 2023-12-07 11:31:22 +01:00
commit aa24780334

79
mission8/glpi.yml Normal file
View File

@ -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"