Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9337ffacdd | |||
| d400423372 | |||
| 897358f759 | |||
| 7578459304 | |||
| 7aa06b59e3 | |||
| 0bd99b90b8 | |||
| 0f04d501a9 | |||
| 9e90b1b26f | |||
| d37227592b | |||
| 472dd4feb1 | |||
| 562d1f3596 | |||
| 4accbfc708 | |||
| a01b1eb764 |
191
partie2/README.md
Normal file
191
partie2/README.md
Normal file
@@ -0,0 +1,191 @@
|
|||||||
|
# 📘 Automatisation & Déploiement — Serveurs ap31 (Prod / Test / Moniteur)
|
||||||
|
|
||||||
|
Ce projet regroupe plusieurs missions réalisées dans le cadre du BTS SIO SISR.
|
||||||
|
L’objectif général est **d’automatiser l’installation, la configuration et la supervision** des serveurs ap31 grâce à *Ansible*, *Docker*, *Payara*, *MariaDB*, *WireGuard*, *GLPI*, et *Caddy*.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# 📑 Sommaire
|
||||||
|
|
||||||
|
1. [Contexte du projet](#-contexte-du-projet)
|
||||||
|
2. [Environnement technique](#-environnement-technique)
|
||||||
|
3. [Mission I6 — Automatisation Ansible (Docker / Payara / MariaDB)](#-mission-i6--automatisation-ansible)
|
||||||
|
4. [Mission I7 — Mise en place d’un VPN WireGuard](#-mission-i7--mise-en-place-dun-vpn-wireguard)
|
||||||
|
5. [Mission I9 — Serveur GLPI + Proxy Inverse Caddy + HTTPS](#-mission-i9--serveur-glpi--proxy-inverse-caddy--https)
|
||||||
|
6. [Ports ouverts & Firewall](#-ports-ouverts--firewall)
|
||||||
|
7. [Définitions & technologies utilisées](#-définitions--technologies-utilisées)
|
||||||
|
8. [Liens vers les playbooks & fichiers](#-liens-vers-les-playbooks--fichiers)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# 📂 Contexte du projet
|
||||||
|
|
||||||
|
Les serveurs concernés :
|
||||||
|
|
||||||
|
| Serveur | Rôle |
|
||||||
|
|----------------|--------------------------------|
|
||||||
|
| **ap31-prod** | Serveur de production |
|
||||||
|
| **ap31-test** | Serveur de test |
|
||||||
|
| **ap31-mon** | Serveur de supervision / logs |
|
||||||
|
| **ap31-pt** | Serveur hébergeant GLPI + Caddy |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# 🛠️ Environnement technique
|
||||||
|
|
||||||
|
| Outil / Technologie | Usage |
|
||||||
|
|---------------------|--------|
|
||||||
|
| **Ansible** | Automatisation de l’installation et configuration |
|
||||||
|
| **Docker / Docker Compose** | Conteneurisation (Payara, GLPI, MariaDB) |
|
||||||
|
| **Payara Server** | Serveur d'applications Java (remplaçant moderne de Tomcat) |
|
||||||
|
| **MariaDB / MySQL** | Base de données pour Payara et GLPI |
|
||||||
|
| **WireGuard** | VPN entre les serveurs prod / test / mon |
|
||||||
|
| **Caddy** | Proxy inverse + HTTPS auto-signé |
|
||||||
|
| **GLPI 11** | Gestion du parc informatique |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# 🧩 Mission I6 — Automatisation Ansible
|
||||||
|
|
||||||
|
## 📌 Structure des playbooks
|
||||||
|
|
||||||
|
### **1. Installation Docker + Payara**
|
||||||
|
Playbook : `payara.yml`
|
||||||
|
➡️ installe Docker via `get-docker.sh`, configure Payara, lance les conteneurs.
|
||||||
|
|
||||||
|
### **2. VPN Wireguard**
|
||||||
|
Playbook : `wg.yml`
|
||||||
|
➡️ installe Wireguard et génère les configs via un script et distribue sur ap31-test et ap31-prod.
|
||||||
|
|
||||||
|
### **3. GLPI**
|
||||||
|
Playbook : `install-glpi.yml`
|
||||||
|
➡️ installe GLPI et la base de données prévue avec.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# 🔐 Mission I7 — Mise en place d’un VPN WireGuard
|
||||||
|
|
||||||
|
## 🎯 Objectifs
|
||||||
|
|
||||||
|
- Relier **ap31-prod**, **ap31-test**, **ap31-mon** via un VPN chiffré
|
||||||
|
|
||||||
|
|
||||||
|
## 📌 Playbook utilisé : `wg.yml`
|
||||||
|
|
||||||
|
Ce playbook :
|
||||||
|
|
||||||
|
- Installe WireGuard sur 2 machines
|
||||||
|
- Génère les fichiers de configuration (`wg0-*.conf`) sur ap31-mon
|
||||||
|
- Déploie la configuration adaptée sur chaque serveur
|
||||||
|
- Active le service WireGuard
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# 🖥️ Mission I9 — Déploiement GLPI + Proxy inverse Caddy
|
||||||
|
|
||||||
|
## 🎯 Objectifs
|
||||||
|
|
||||||
|
- Héberger **GLPI 11** via Docker (GLPI + MariaDB)
|
||||||
|
- Tester la remontée d’inventaire depuis **glpi-agent** sous Linux
|
||||||
|
- Écrire un playbook Ansible d’installation
|
||||||
|
- Mettre en place un **proxy inverse Caddy** avec **HTTPS interne**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📌 Fichiers docker compose
|
||||||
|
|
||||||
|
Disponible ici :
|
||||||
|
|
||||||
|
🔗 **docker-compose.yml (GLPI)**
|
||||||
|
https://gitea.lyc-lecastel.fr/uap31-2026-r/SDIS29/src/branch/main/partie2/ansible/files/docker-compose.yml
|
||||||
|
|
||||||
|
🔗 **compose.yml (Payara)**
|
||||||
|
https://gitea.lyc-lecastel.fr/uap31-2026-r/SDIS29/src/branch/main/partie2/ansible/files/compose.yml
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📌 Caddyfile (reverse proxy + HTTPS interne)
|
||||||
|
|
||||||
|
```conf
|
||||||
|
ap31-pt.sio.lan {
|
||||||
|
tls internal # certificat auto-signé par Caddy
|
||||||
|
reverse_proxy localhost:4000 # Proxy vers GLPI
|
||||||
|
}
|
||||||
|
|
||||||
|
ap31-pt {
|
||||||
|
tls internal
|
||||||
|
reverse_proxy localhost:4000
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📌 Test de remontée d’inventaire (glpi-agent)
|
||||||
|
|
||||||
|
```sh
|
||||||
|
vagrant@glpi-agent:~$ sudo glpi-agent --no-ssl-check --server https://ap31-pt.sio.lan
|
||||||
|
[info] target server0: server https://ap31-pt.sio.lan
|
||||||
|
[info] sending contact request to server0
|
||||||
|
[info] [http client] SSL Client info: Cert-Issuer: '/CN=Caddy Local Authority - ECC Intermediate'
|
||||||
|
[info] running task Inventory
|
||||||
|
[info] New inventory from glpi-agent-2025-12-05-09-30-21 for server0
|
||||||
|
[info] [http client] SSL Client warning: Peer certificate not verified
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🔥 Ports ouverts & Firewall
|
||||||
|
|
||||||
|
```sh
|
||||||
|
debian@ap31-pt:~$ sudo ufw status verbose
|
||||||
|
Status: active
|
||||||
|
Logging: on (low)
|
||||||
|
Default: deny (incoming), allow (outgoing), deny (routed)
|
||||||
|
New profiles: skip
|
||||||
|
|
||||||
|
To Action From
|
||||||
|
-- ------ ----
|
||||||
|
80/tcp ALLOW IN Anywhere
|
||||||
|
443/tcp ALLOW IN Anywhere
|
||||||
|
8080/tcp ALLOW IN Anywhere
|
||||||
|
22/tcp ALLOW IN Anywhere
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📚 Définitions & technologies utilisées
|
||||||
|
Payara:
|
||||||
|
|
||||||
|
Serveur d’applications Java moderne, dérivé de GlassFish.
|
||||||
|
Permet d’héberger des applications web Java EE / Jakarta EE.
|
||||||
|
|
||||||
|
GLPI:
|
||||||
|
|
||||||
|
Outil de gestion de parc informatique :
|
||||||
|
|
||||||
|
- inventaire des machines
|
||||||
|
|
||||||
|
- gestion des tickets
|
||||||
|
|
||||||
|
- périphériques
|
||||||
|
|
||||||
|
- contrats, licences, garanties
|
||||||
|
|
||||||
|
WireGuard:
|
||||||
|
|
||||||
|
VPN moderne, très rapide, extrêmement simple à configurer.
|
||||||
|
|
||||||
|
Caddy
|
||||||
|
|
||||||
|
Serveur web + reverse proxy capable d’émettre automatiquement des certificats HTTPS.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
| Fichier |Lien |
|
||||||
|
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||||
|
| **payara.yml** | [https://gitea.lyc-lecastel.fr/uap31-2026-r/SDIS29/src/branch/main/partie2/ansible/payara.yml](https://gitea.lyc-lecastel.fr/uap31-2026-r/SDIS29/src/branch/main/partie2/ansible/payara.yml) |
|
||||||
|
| **install-glpi.yml** | [https://gitea.lyc-lecastel.fr/uap31-2026-r/SDIS29/src/branch/main/partie2/ansible/install-glpi.yml](https://gitea.lyc-lecastel.fr/uap31-2026-r/SDIS29/src/branch/main/partie2/ansible/install-glpi.yml) |
|
||||||
|
| **docker-compose.yml** | [https://gitea.lyc-lecastel.fr/uap31-2026-r/SDIS29/src/branch/main/partie2/ansible/files/docker-compose.yml](https://gitea.lyc-lecastel.fr/uap31-2026-r/SDIS29/src/branch/main/partie2/ansible/files/docker-compose.yml) |
|
||||||
|
| **compose.yml** | [https://gitea.lyc-lecastel.fr/uap31-2026-r/SDIS29/src/branch/main/partie2/ansible/files/compose.yml](https://gitea.lyc-lecastel.fr/uap31-2026-r/SDIS29/src/branch/main/partie2/ansible/files/compose.yml) |
|
||||||
|
| **wg.yml** | [https://gitea.lyc-lecastel.fr/uap31-2026-r/SDIS29/src/branch/main/partie2/ansible/files/wg.yml](https://gitea.lyc-lecastel.fr/uap31-2026-r/SDIS29/src/branch/main/partie2/ansible/files/wg.yml) |
|
||||||
|
|
||||||
5
partie2/ansible/.env
Normal file
5
partie2/ansible/.env
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
GLPI_DB_HOST=db
|
||||||
|
GLPI_DB_PORT=3306
|
||||||
|
GLPI_DB_NAME=glpi
|
||||||
|
GLPI_DB_USER=glpi
|
||||||
|
GLPI_DB_PASSWORD=9Z8&i9zWUeOi
|
||||||
BIN
partie2/ansible/files/SDIS29MedhiEmile-1.0-SNAPSHOT.war
Normal file
BIN
partie2/ansible/files/SDIS29MedhiEmile-1.0-SNAPSHOT.war
Normal file
Binary file not shown.
26
partie2/ansible/files/compose.yml
Normal file
26
partie2/ansible/files/compose.yml
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
services:
|
||||||
|
payara:
|
||||||
|
image: payara/server-full:6.2025.9-jdk17
|
||||||
|
container_name: payara
|
||||||
|
ports:
|
||||||
|
- "8080:8080"
|
||||||
|
- "4848:4848"
|
||||||
|
env_file:
|
||||||
|
- "variables.env"
|
||||||
|
volumes:
|
||||||
|
- ./mariadb-java-client-3.5.6.jar:/opt/payara/glassfish/domains/domain1/lib/mariadb-java-client-3.5.6.jar:ro
|
||||||
|
- ./SDIS29MedhiEmile-1.0-SNAPSHOT.war:/opt/payara/glassfish/domains/domain1/autodeploy/SDIS29MedhiEmile-1.0-SNAPSHOT.war
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
db:
|
||||||
|
image: mariadb:latest
|
||||||
|
container_name: db
|
||||||
|
ports:
|
||||||
|
- "3306:3306"
|
||||||
|
env_file:
|
||||||
|
- "variables.env"
|
||||||
|
volumes:
|
||||||
|
- ./data/db_data:/var/lib/mysql
|
||||||
|
- ./init:/docker-entrypoint-initdb.d
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
33
partie2/ansible/files/docker-compose.yml
Normal file
33
partie2/ansible/files/docker-compose.yml
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
services:
|
||||||
|
glpi:
|
||||||
|
image: "glpi/glpi:latest"
|
||||||
|
restart: "unless-stopped"
|
||||||
|
volumes:
|
||||||
|
- "./storage/glpi:/var/glpi:rw"
|
||||||
|
depends_on:
|
||||||
|
db:
|
||||||
|
condition: service_healthy
|
||||||
|
env_file: .env
|
||||||
|
environment:
|
||||||
|
TZ: Europe/Paris
|
||||||
|
ports:
|
||||||
|
- "4000:80"
|
||||||
|
|
||||||
|
db:
|
||||||
|
image: mariadb:latest
|
||||||
|
restart: "unless-stopped"
|
||||||
|
volumes:
|
||||||
|
- ./storage/mariadb:/var/lib/mysql
|
||||||
|
environment:
|
||||||
|
MYSQL_RANDOM_ROOT_PASSWORD: "yes"
|
||||||
|
MYSQL_DATABASE: ${GLPI_DB_NAME}
|
||||||
|
MYSQL_USER: ${GLPI_DB_USER}
|
||||||
|
MYSQL_PASSWORD: ${GLPI_DB_PASSWORD}
|
||||||
|
healthcheck:
|
||||||
|
test: [ "CMD", "healthcheck.sh", "--su-mysql", "--connect", "--innodb_initialized" ]
|
||||||
|
start_period: 5s
|
||||||
|
interval: 5s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 10
|
||||||
|
expose:
|
||||||
|
- "3306"
|
||||||
2
partie2/ansible/files/http-proxy.conf
Normal file
2
partie2/ansible/files/http-proxy.conf
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[Service]
|
||||||
|
Environment="HTTP_PROXY=http://10.121.38.1:8080/" "HTTPS_PROXY=http://10.121.38.1:8080/" "NO_PROXY=localhost,127.0.0.0/8"
|
||||||
BIN
partie2/ansible/files/mariadb-java-client-3.5.6.jar
Normal file
BIN
partie2/ansible/files/mariadb-java-client-3.5.6.jar
Normal file
Binary file not shown.
BIN
partie2/ansible/files/sdis29.sql.gz
Normal file
BIN
partie2/ansible/files/sdis29.sql.gz
Normal file
Binary file not shown.
7
partie2/ansible/files/variables.env
Normal file
7
partie2/ansible/files/variables.env
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
MYSQL_DATABASE=sdis29
|
||||||
|
MYSQL_HOST=db
|
||||||
|
MYSQL_PORT=3306
|
||||||
|
MYSQL_USER=adminBDsdis
|
||||||
|
MYSQL_PASSWORD=u@4xKH@X
|
||||||
|
MYSQL_ROOT_PASSWORD=2Fc#$9Fn
|
||||||
|
|
||||||
4
partie2/ansible/hosts
Normal file
4
partie2/ansible/hosts
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
[ap31-srv]
|
||||||
|
ap31-pt
|
||||||
|
#ap31-test #ansible_host=172.16.0.101
|
||||||
|
#ap31-prod ansible_host=172.16.0.100
|
||||||
29
partie2/ansible/install-glpi.yml
Normal file
29
partie2/ansible/install-glpi.yml
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
---
|
||||||
|
- name: Installation de GLPI avec Docker
|
||||||
|
hosts: ap31-pt
|
||||||
|
become: yes
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: Création du dossier glpi
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /root/glpi
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
|
||||||
|
- name: Importation du fichier docker-compose.yml
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: ./files/docker-compose.yml
|
||||||
|
dest: /root/glpi/docker-compose.yml
|
||||||
|
mode: '0644'
|
||||||
|
|
||||||
|
- name: Importation du fichier .env
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: .env
|
||||||
|
dest: /root/glpi/.env
|
||||||
|
mode: '0600'
|
||||||
|
|
||||||
|
- name: Pull et lancement du conteneur GLPI
|
||||||
|
ansible.builtin.shell:
|
||||||
|
cmd: docker compose pull && docker compose up -d
|
||||||
|
chdir: /root/glpi
|
||||||
|
|
||||||
91
partie2/ansible/mkwgconf-p2p.sh
Normal file
91
partie2/ansible/mkwgconf-p2p.sh
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
è-#!/bin/bash
|
||||||
|
set -u
|
||||||
|
set -e
|
||||||
|
|
||||||
|
AddressAwg=10.0.0.1/32 # Adresse VPN Wireguard extremite A
|
||||||
|
EndpointA=172.16.0.101 # Adresse extremite A
|
||||||
|
PortA=51820 # Port ecoute extremite A
|
||||||
|
AddressBwg=10.0.0.2/32 # Adresse VPN Wireguard extremite B
|
||||||
|
EndpointB=172.16.0.102 # Adresse extremite B
|
||||||
|
PortB=51820 # Port ecoute extremite B
|
||||||
|
AddressCwg=10.0.0.3/32 # Adresse VPN Wireguard extremite C
|
||||||
|
EndpointC=172.0.0.103 # Adresse extremite C
|
||||||
|
PortC=51820 # Port ecoute extremite C
|
||||||
|
|
||||||
|
umask 077 ;
|
||||||
|
wg genkey > endpoint-a.key
|
||||||
|
wg pubkey < endpoint-a.key > endpoint-a.pub
|
||||||
|
|
||||||
|
wg genkey > endpoint-b.key
|
||||||
|
wg pubkey < endpoint-b.key > endpoint-b.pub
|
||||||
|
|
||||||
|
wg genkey > endpoint-c.key
|
||||||
|
wg pubkey < endpoint-c.key > endpoint-c.pub
|
||||||
|
|
||||||
|
PKA=$(cat endpoint-a.key)
|
||||||
|
pKA=$(cat endpoint-a.pub)
|
||||||
|
PKB=$(cat endpoint-b.key)
|
||||||
|
pKB=$(cat endpoint-b.pub)
|
||||||
|
PKC=$(cat endpoint-c.key)
|
||||||
|
pKC=$(cat endpoint-c.pub)
|
||||||
|
|
||||||
|
cat <<FINI > wg0-a.conf
|
||||||
|
# local settings for Endpoint A
|
||||||
|
[Interface]
|
||||||
|
PrivateKey = $PKA
|
||||||
|
Address = $AddressAwg
|
||||||
|
ListenPort = $PortA
|
||||||
|
|
||||||
|
# remote settings for Endpoint B
|
||||||
|
[Peer]
|
||||||
|
PublicKey = $pKB
|
||||||
|
Endpoint = ${EndpointB}:$PortB
|
||||||
|
AllowedIPs = $AddressBwg
|
||||||
|
|
||||||
|
# remote settings for Endpoint C
|
||||||
|
[Peer]
|
||||||
|
PublicKey = $pKC
|
||||||
|
Endpoint = ${EndpointC}:$PortC
|
||||||
|
AllowedIPs = $AddressCwg
|
||||||
|
FINI
|
||||||
|
|
||||||
|
|
||||||
|
cat <<FINI > wg0-b.conf
|
||||||
|
# local settings for Endpoint B
|
||||||
|
[Interface]
|
||||||
|
PrivateKey = $PKB
|
||||||
|
Address = $AddressBwg
|
||||||
|
ListenPort = $PortB
|
||||||
|
|
||||||
|
# remote settings for Endpoint A
|
||||||
|
[Peer]
|
||||||
|
PublicKey = $pKA
|
||||||
|
Endpoint = ${EndpointA}:$PortA
|
||||||
|
AllowedIPs = $AddressAwg
|
||||||
|
|
||||||
|
# remote settings for Endpoint C
|
||||||
|
[Peer]
|
||||||
|
PublicKey = $pKC
|
||||||
|
Endpoint = ${EndpointC}:$PortC
|
||||||
|
AllowedIPs = $AddressCwg
|
||||||
|
FINI
|
||||||
|
|
||||||
|
cat <<FINI > wg0-c.conf
|
||||||
|
# local settings for Endpoint C
|
||||||
|
[Interface]
|
||||||
|
PrivateKey = $PKC
|
||||||
|
Address = $AddressBwg
|
||||||
|
ListenPort = $PortB
|
||||||
|
|
||||||
|
# remote settings for Endpoint A
|
||||||
|
[Peer]
|
||||||
|
PublicKey = $pKA
|
||||||
|
Endpoint = ${EndpointA}:$PortA
|
||||||
|
AllowedIPs = $AddressAwg
|
||||||
|
|
||||||
|
# remote settings for Endpoint B
|
||||||
|
[Peer]
|
||||||
|
PublicKey = $pKB
|
||||||
|
Endpoint = ${EndpointB}:$PortB
|
||||||
|
AllowedIPs = $AddressBwg
|
||||||
|
FINI
|
||||||
62
partie2/ansible/payara.yml
Normal file
62
partie2/ansible/payara.yml
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
---
|
||||||
|
- name: Installation de docker et payara dockerisé
|
||||||
|
hosts: ap31-pt
|
||||||
|
become: yes
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: Téléchargement docker
|
||||||
|
ansible.builtin.get_url:
|
||||||
|
url: http://depl.sio.lan/store/get-docker.sh
|
||||||
|
dest: /tmp
|
||||||
|
|
||||||
|
- name: Execution du script get-docker.sh
|
||||||
|
ansible.builtin.shell:
|
||||||
|
cmd: export https_proxy=http://10.121.38.1:8080 ; bash /tmp/get-docker.sh
|
||||||
|
|
||||||
|
- name: Création d'un dossier payara
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: ~/payara
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
|
||||||
|
- name: Importation du fichier compose.yml
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: ./files/compose.yml
|
||||||
|
dest: ~/payara/compose.yml
|
||||||
|
mode: '0755'
|
||||||
|
|
||||||
|
- name: Création du répertoire docker.service.d
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /etc/systemd/system/docker.service.d
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
|
||||||
|
|
||||||
|
- name: Importation du fichier http-proxy.conf pour docker
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: ./files/http-proxy.conf
|
||||||
|
dest: /etc/systemd/system/docker.service.d/http-proxy.conf
|
||||||
|
mode: '0755'
|
||||||
|
|
||||||
|
- name: Importation du fichier variables.env
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: ./files/variables.env
|
||||||
|
dest: /root/payara/
|
||||||
|
mode: '0755'
|
||||||
|
|
||||||
|
- name: Importation de la base de données compréssée
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: ./files/sdis29.sql.gz
|
||||||
|
dest: /root/payara/init/
|
||||||
|
mode: '0755'
|
||||||
|
|
||||||
|
- name: Importation du fichier war
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: ./files/SDIS29MedhiEmile-1.0-SNAPSHOT.war
|
||||||
|
dest: /root/payara
|
||||||
|
|
||||||
|
- name: Docker pull et docker compose up -d
|
||||||
|
ansible.builtin.shell:
|
||||||
|
cmd: usermod -aG docker debian ; systemctl daemon-reload ; systemctl restart docker ; cd ~/payara ; docker compose pull && docker compose up -d ; docker compose down -v ; rm -rf ./data/ ; docker compose up -d
|
||||||
|
|
||||||
|
|
||||||
60
partie2/ansible/wg.yml
Normal file
60
partie2/ansible/wg.yml
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
---
|
||||||
|
- name: WireGuard pour apx31-prod et apx31-test
|
||||||
|
hosts:
|
||||||
|
- ap31-test
|
||||||
|
- ap31-prod
|
||||||
|
become: true
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
|
||||||
|
- name: Installer WireGuard
|
||||||
|
apt:
|
||||||
|
name:
|
||||||
|
- wireguard
|
||||||
|
- wireguard-tools
|
||||||
|
state: present
|
||||||
|
update_cache: true
|
||||||
|
|
||||||
|
- name: Copier le script mkwgconf-p2p.sh dans /tmp
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: mkwgconf-p2p.sh
|
||||||
|
dest: /tmp/mkwgconf-p2p.sh
|
||||||
|
mode: '0755'
|
||||||
|
|
||||||
|
- name: Executer le script mkwgconf
|
||||||
|
ansible.builtin.shell:
|
||||||
|
cmd: cd /tmp && /tmp/mkwgconf-p2p.sh
|
||||||
|
when: inventory_hostname == "ap31-test"
|
||||||
|
|
||||||
|
- name: Recupere wg0-a.conf
|
||||||
|
ansible.builtin.fetch:
|
||||||
|
src: /tmp/wg0-a.conf
|
||||||
|
dest: /tmp/
|
||||||
|
# mode: '0600'
|
||||||
|
flat: yes
|
||||||
|
when: inventory_hostname == "ap31-test"
|
||||||
|
|
||||||
|
- name: Recupere wg0-b.conf
|
||||||
|
ansible.builtin.fetch:
|
||||||
|
src: /tmp/wg0-b.conf
|
||||||
|
dest: /tmp/
|
||||||
|
# mode: '0600'
|
||||||
|
flat: yes
|
||||||
|
when: inventory_hostname == "ap31-test"
|
||||||
|
|
||||||
|
- name: Renvoi wg0-a.conf
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: /tmp/wg0-a.conf
|
||||||
|
dest: /etc/wireguard/wg0.conf
|
||||||
|
# mode: '0600'
|
||||||
|
when: inventory_hostname == "ap31-test"
|
||||||
|
|
||||||
|
- name: Renvoi wg0-b.conf
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: /tmp/wg0-b.conf
|
||||||
|
dest: /etc/wireguard/wg0.conf
|
||||||
|
#mode: '0600'
|
||||||
|
when: inventory_hostname == "ap31-prod"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
0
partie2/test
Normal file
0
partie2/test
Normal file
Reference in New Issue
Block a user