Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
elearning:workbooks:debian:6:avance:l130:part3 [2020/02/13 15:11] – admin | elearning:workbooks:debian:6:avance:l130:part3 [2023/08/25 01:29] (Version actuelle) – admin | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
~~PDF: | ~~PDF: | ||
+ | |||
+ | Version - **2023.01** | ||
Dernière mise-à-jour : ~~LASTMOD~~ | Dernière mise-à-jour : ~~LASTMOD~~ | ||
- | ====== | + | ====== |
+ | |||
+ | =====Contenu du Module===== | ||
+ | |||
+ | * **LCF803 - Rôles, Gabarits, Variables et Facts** | ||
+ | * Contenu du Module | ||
+ | * LAB #1 - Dépendances de Rôles | ||
+ | * LAB #2 - Utilisation des Gabarits | ||
+ | * 2.1 - Variables | ||
+ | * 2.2 - Gabarits Conditionnels | ||
+ | * 2.3 - Boucles | ||
+ | * 2.4 - Macros | ||
+ | * 2.5 - Filtres | ||
+ | * 2.5.1 - Default | ||
+ | * 2.5.2 - Join | ||
+ | * 2.5.3 - Map | ||
+ | * 2.6 - Gabarits Parent - Enfants | ||
+ | * 2.6.1 - Le Gabarit Parent | ||
+ | * 2.6.2 - Le Gabarit Enfant | ||
+ | * LAB #3 - Gestion de la Hiérarchie des Variables | ||
+ | * LAB #4 - Utilisation des Facts d' | ||
+ | * LAB #5 - La Commande ansible-vault | ||
+ | * 5.1 - Crypter le Fichier | ||
+ | * 5.2 - Editer le Fichier | ||
+ | * 5.3 - Décrypter le Fichier | ||
+ | * 5.4 - Utilisation de Mots de Passe Aléatoires | ||
- | =====LAB #8 - Dépendances de Rôles===== | + | =====LAB #1 - Dépendances de Rôles===== |
Afin de comprendre le fonctionnement des dépendances entre les Rôles vous allez étudier l' | Afin de comprendre le fonctionnement des dépendances entre les Rôles vous allez étudier l' | ||
Ligne 12: | Ligne 39: | ||
< | < | ||
- | trainee@ansible:~$ mkdir / | + | [trainee@centos8 |
- | trainee@ansible:~$ cd / | + | [trainee@centos8 |
- | trainee@ansible: | + | [trainee@centos8 |
- | trainee@ansible: | + | [trainee@centos8 |
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
**Important** : Notez que dans ce Rôle nous n' | **Important** : Notez que dans ce Rôle nous n' | ||
</ | </ | ||
Ligne 25: | Ligne 52: | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
- | trainee@ansible: | + | [trainee@centos8 |
--- | --- | ||
- name: install jre | - name: install jre | ||
Ligne 40: | Ligne 67: | ||
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
**Important** : Notez que le paquet à installer n'est pas explicitement déclaré. Le paquet est référencé par le contenu de la variable **java_package**, | **Important** : Notez que le paquet à installer n'est pas explicitement déclaré. Le paquet est référencé par le contenu de la variable **java_package**, | ||
</ | </ | ||
Ligne 47: | Ligne 74: | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
- | trainee@ansible: | + | [trainee@centos8 |
--- | --- | ||
java_home: / | java_home: / | ||
Ligne 54: | Ligne 81: | ||
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
**Important** : Notez qu'ici sont déclarées deux variables : **java_home** et **java_package**. | **Important** : Notez qu'ici sont déclarées deux variables : **java_home** et **java_package**. | ||
</ | </ | ||
Ligne 61: | Ligne 88: | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
**Important** : Ce fichier ne serait pas normalement vide. Par contre dans ce LAB, nous nous concentrons sur Ansible et seule la présence du fichier est nécessaire pour le bon fonctionnement du LAB. | **Important** : Ce fichier ne serait pas normalement vide. Par contre dans ce LAB, nous nous concentrons sur Ansible et seule la présence du fichier est nécessaire pour le bon fonctionnement du LAB. | ||
</ | </ | ||
Ligne 71: | Ligne 98: | ||
< | < | ||
- | trainee@ansible:~$ mkdir / | + | [trainee@centos8 exemple01.java]$ mkdir / |
- | trainee@ansible:~$ cd / | + | [trainee@centos8 exemple01.java]$ cd / |
- | trainee@ansible: | + | [trainee@centos8 |
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
**Important** : Notez que dans ce Rôle nous n' | **Important** : Notez que dans ce Rôle nous n' | ||
</ | </ | ||
Ligne 83: | Ligne 110: | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
- | trainee@ansible: | + | [trainee@centos8 |
--- | --- | ||
- name: install tomcat | - name: install tomcat | ||
Ligne 93: | Ligne 120: | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
- | trainee@ansible: | + | [trainee@centos8 |
--- | --- | ||
dependencies: | dependencies: | ||
Ligne 100: | Ligne 127: | ||
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
**Important** : Ce fichier informe Ansible que le Rôle **tomcat** dépend du Rôle **exemple01.java**. | **Important** : Ce fichier informe Ansible que le Rôle **tomcat** dépend du Rôle **exemple01.java**. | ||
</ | </ | ||
Ligne 107: | Ligne 134: | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
- | trainee@ansible: | + | [trainee@centos8 |
--- | --- | ||
- hosts: all | - hosts: all | ||
Ligne 116: | Ligne 143: | ||
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
**Important** : Notez que dans le Play Book, nous appelons **uniquement** le Rôle **tomcat**. | **Important** : Notez que dans le Play Book, nous appelons **uniquement** le Rôle **tomcat**. | ||
</ | </ | ||
Ligne 130: | Ligne 157: | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
. | . | ||
├── exemple01.java | ├── exemple01.java | ||
- | │ ├── defaults | + | │ |
- | │ │ └── main.yaml | + | │ |
- | │ ├── tasks | + | │ |
- | │ │ └── main.yaml | + | │ |
- | │ └── templates | + | │ |
- | │ └── java.sh | + | │ |
├── geerlingguy.java | ├── geerlingguy.java | ||
- | │ ├── defaults | + | │ |
- | │ │ └── main.yml | + | │ |
- | │ ├── LICENSE | + | │ |
- | │ ├── meta | + | │ |
- | │ │ └── main.yml | + | │ |
- | │ ├── molecule | + | │ |
- | │ │ └── default | + | │ |
- | │ │ ├── | + | │ |
- | │ │ | + | │ |
- | │ │ | + | │ |
- | │ │ | + | │ |
- | │ │ | + | │ |
- | │ ├── README.md | + | │ |
- | │ ├── tasks | + | │ |
- | │ │ ├── main.yml | + | │ |
- | │ │ ├── setup-Debian.yml | + | │ |
- | │ │ ├── setup-FreeBSD.yml | + | │ |
- | │ │ └── setup-RedHat.yml | + | │ |
- | │ ├── templates | + | │ ├── Debian-10.yml |
- | │ │ └── java_home.sh.j2 | + | │ |
- | │ └── vars | + | │ ├── Debian-8.yml |
- | │ ├── Debian-8.yml | + | │ |
- | │ ├── Debian-9.yml | + | │ |
- | │ ├── Fedora.yml | + | │ |
- | │ ├── FreeBSD.yml | + | │ |
- | │ ├── RedHat-6.yml | + | │ |
- | │ ├── RedHat-7.yml | + | │ |
- | │ ├── Ubuntu-12.yml | + | │ |
- | │ ├── Ubuntu-14.yml | + | │ |
- | │ ├── Ubuntu-16.yml | + | │ ├── Ubuntu-18.yml |
- | │ └── Ubuntu-18.yml | + | │ |
├── inventory | ├── inventory | ||
├── playbook.yaml | ├── playbook.yaml | ||
└── tomcat | └── tomcat | ||
├── meta | ├── meta | ||
- | │ └── main.yaml | + | │ |
└── tasks | └── tasks | ||
└── main.yaml | └── main.yaml | ||
- | 16 directories, | + | 15 directories, |
</ | </ | ||
Ligne 185: | Ligne 212: | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
- | PLAY [all] ************************************************************************************************************************************************************** | + | PLAY [all] ******************************************************************************************************************************************************************************************************* |
- | TASK [Gathering Facts] ************************************************************************************************************************************************** | + | TASK [Gathering Facts] |
ok: [web01] | ok: [web01] | ||
- | TASK [exemple01.java : install jre] ************************************************************************************************************************************* | + | TASK [exemple01.java : install jre] ****************************************************************************************************************************************************************************** |
ok: [web01] | ok: [web01] | ||
- | TASK [exemple01.java : configure java home] ***************************************************************************************************************************** | + | TASK [exemple01.java : configure java home] ********************************************************************************************************************************************************************** |
changed: [web01] | changed: [web01] | ||
- | TASK [tomcat : install tomcat] ****************************************************************************************************************************************** | + | TASK [tomcat : install tomcat] |
changed: [web01] | changed: [web01] | ||
- | PLAY RECAP ************************************************************************************************************************************************************** | + | PLAY RECAP ******************************************************************************************************************************************************************************************************* |
- | web01 : ok=4 changed=2 | + | web01 : ok=4 changed=2 |
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
**Important** : Notez que le Rôle **exemple01.java** est traité **avant** le Rôle **tomcat**. | **Important** : Notez que le Rôle **exemple01.java** est traité **avant** le Rôle **tomcat**. | ||
</ | </ | ||
Ligne 212: | Ligne 239: | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
Debian GNU/Linux 9 | Debian GNU/Linux 9 | ||
Linux web01.i2tch.loc 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 | Linux web01.i2tch.loc 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 | ||
Ligne 222: | Ligne 249: | ||
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent | Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent | ||
permitted by applicable law. | permitted by applicable law. | ||
- | Last login: Wed Jan 30 00:03:51 2019 from 10.0.2.9 | + | Last login: Wed Mar 9 13:49:26 2022 from 10.0.2.45 |
- | trainee@web01: | + | |
- | openjdk version " | + | |
- | OpenJDK Runtime Environment (build 1.8.0_181-8u181-b13-2~deb9u1-b13) | + | |
- | OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode) | + | |
trainee@web01: | trainee@web01: | ||
● tomcat8.service - LSB: Start Tomcat. | ● tomcat8.service - LSB: Start Tomcat. | ||
| | ||
- | | + | |
Docs: man: | Docs: man: | ||
| | ||
- | | + | |
trainee@web01: | trainee@web01: | ||
déconnexion | déconnexion | ||
Connection to web01 closed. | Connection to web01 closed. | ||
+ | [trainee@centos8 roles]$ | ||
</ | </ | ||
Ligne 242: | Ligne 266: | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
- | trainee@ansible: | + | [trainee@centos8 |
--- | --- | ||
dependencies: | dependencies: | ||
- | - { role: exemple01.java, | + | - { role: exemple01.java, |
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
**Important** : Notez que cette fois-ci, la valeur de la variable **java_package** spécifiée dans le fichier **/ | **Important** : Notez que cette fois-ci, la valeur de la variable **java_package** spécifiée dans le fichier **/ | ||
</ | </ | ||
Ligne 256: | Ligne 280: | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
- | PLAY [all] ************************************************************************************************************************************************************** | + | PLAY [all] ******************************************************************************************************************************************************************************************************* |
- | TASK [Gathering Facts] ************************************************************************************************************************************************** | + | TASK [Gathering Facts] |
ok: [web02] | ok: [web02] | ||
- | TASK [exemple01.java : install jre] ************************************************************************************************************************************* | + | TASK [exemple01.java : install jre] ****************************************************************************************************************************************************************************** |
changed: [web02] | changed: [web02] | ||
- | TASK [exemple01.java : configure java home] ***************************************************************************************************************************** | + | TASK [exemple01.java : configure java home] ********************************************************************************************************************************************************************** |
changed: [web02] | changed: [web02] | ||
- | TASK [tomcat : install tomcat] ****************************************************************************************************************************************** | + | TASK [tomcat : install tomcat] |
changed: [web02] | changed: [web02] | ||
- | PLAY RECAP ************************************************************************************************************************************************************** | + | PLAY RECAP ******************************************************************************************************************************************************************************************************* |
- | web02 : ok=4 changed=3 | + | web02 : ok=4 changed=3 |
</ | </ | ||
- | =====LAB #9 - Utilisation des Gabarits===== | + | Vérifiez que la dépendance **tree** a été installée dans Web02 : |
- | ====Variables==== | + | < |
+ | [trainee@centos8 roles]$ ssh web02 | ||
+ | Debian GNU/Linux 9 | ||
+ | Linux web02.i2tch.loc 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 | ||
+ | |||
+ | The programs included with the Debian GNU/Linux system are free software; | ||
+ | the exact distribution terms for each program are described in the | ||
+ | individual files in / | ||
+ | |||
+ | Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent | ||
+ | permitted by applicable law. | ||
+ | Last login: Wed Mar 9 13:53:57 2022 from 10.0.2.45 | ||
+ | trainee@web02: | ||
+ | / | ||
+ | trainee@web02: | ||
+ | déconnexion | ||
+ | Connection to web02 closed. | ||
+ | [trainee@centos8 roles]$ ssh web03 | ||
+ | Debian GNU/Linux 9 | ||
+ | Linux web03.i2tch.loc 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 | ||
+ | |||
+ | The programs included with the Debian GNU/Linux system are free software; | ||
+ | the exact distribution terms for each program are described in the | ||
+ | individual files in / | ||
+ | |||
+ | Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent | ||
+ | permitted by applicable law. | ||
+ | Last login: Wed Mar 9 12:12:51 2022 from 10.0.2.45 | ||
+ | trainee@web03: | ||
+ | trainee@web03: | ||
+ | déconnexion | ||
+ | Connection to web03 closed. | ||
+ | [trainee@centos8 roles]$ | ||
+ | </ | ||
+ | |||
+ | =====LAB #2 - Utilisation des Gabarits===== | ||
+ | |||
+ | ====2.1 - Variables==== | ||
Les **Gabarits** ou // | Les **Gabarits** ou // | ||
- | <WRAP center round important | + | <WRAP center round important> |
**Important** : La documentation des gabarits se trouvent à cette adresse: **[[https:// | **Important** : La documentation des gabarits se trouvent à cette adresse: **[[https:// | ||
</ | </ | ||
Ligne 291: | Ligne 352: | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
- | trainee@ansible:~$ cd / | + | [trainee@centos8 roles]$ cd / |
- | trainee@ansible: | + | [trainee@centos8 |
+ | [trainee@centos8 haproxy]$ | ||
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
**Important** : Notez que dans ce Rôle nous n' | **Important** : Notez que dans ce Rôle nous n' | ||
</ | </ | ||
Ligne 303: | Ligne 365: | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
- | trainee@ansible: | + | [trainee@centos8 |
--- | --- | ||
- name: install | - name: install | ||
Ligne 322: | Ligne 384: | ||
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
**Important** : Notez que l' | **Important** : Notez que l' | ||
</ | </ | ||
Ligne 329: | Ligne 391: | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
- | trainee@ansible: | + | [trainee@centos8 |
--- | --- | ||
- name: reload haproxy | - name: reload haproxy | ||
Ligne 339: | Ligne 401: | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
- | trainee@ansible: | + | [trainee@centos8 |
global | global | ||
- | log / | + | |
- | log / | + | log / |
- | chroot / | + | chroot / |
- | stats socket / | + | stats socket / |
- | stats timeout 30s | + | stats timeout 30s |
- | user haproxy | + | user haproxy |
- | group haproxy | + | group haproxy |
- | daemon | + | daemon |
- | # Default SSL material locations | + | |
- | ca-base / | + | ca-base / |
- | crt-base / | + | crt-base / |
- | # Default ciphers to use on SSL-enabled listening sockets. | + | |
- | # For more information, | + | # For more information, |
- | # https:// | + | # https:// |
- | # An alternative list with additional directives can be obtained from | + | # An alternative list with additional directives can be obtained from |
- | # https:// | + | # https:// |
- | ssl-default-bind-ciphers ECDH+AESGCM: | + | ssl-default-bind-ciphers ECDH+AESGCM: |
- | ssl-default-bind-options no-sslv3 | + | ssl-default-bind-options no-sslv3 |
defaults | defaults | ||
- | log global | + | |
- | mode http | + | mode http |
- | option httplog | + | option |
- | option dontlognull | + | option |
timeout connect 5000 | timeout connect 5000 | ||
timeout client | timeout client | ||
timeout server | timeout server | ||
- | errorfile 400 / | + | |
- | errorfile 403 / | + | errorfile 403 / |
- | errorfile 408 / | + | errorfile 408 / |
- | errorfile 500 / | + | errorfile 500 / |
- | errorfile 502 / | + | errorfile 502 / |
- | errorfile 503 / | + | errorfile 503 / |
- | errorfile 504 / | + | errorfile 504 / |
frontend haproxy | frontend haproxy | ||
Ligne 392: | Ligne 454: | ||
backend dotcms | backend dotcms | ||
- | server web02 10.0.2.12:8080 check | + | server web02 10.0.2.55:8080 check |
- | server web03 10.0.2.13:8080 check | + | server web03 10.0.2.56:8080 check |
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
**Important** : Notez l' | **Important** : Notez l' | ||
</ | </ | ||
Ligne 403: | Ligne 465: | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
- | trainee@ansible: | + | [trainee@centos8 |
--- | --- | ||
haproxy_listen_address: | haproxy_listen_address: | ||
Ligne 414: | Ligne 476: | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
- | trainee@ansible: | + | [trainee@centos8 |
- | trainee@ansible: | + | [trainee@centos8 |
--- | --- | ||
- hosts: all | - hosts: all | ||
Ligne 427: | Ligne 489: | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
- | PLAY [all] ************************************************************************************************************************************************************** | + | PLAY [all] ******************************************************************************************************************************************************************************************************* |
- | TASK [Gathering Facts] ************************************************************************************************************************************************** | + | TASK [Gathering Facts] |
ok: [web04] | ok: [web04] | ||
- | TASK [haproxy : install] ************************************************************************************************************************************************ | + | TASK [haproxy : install] |
ok: [web04] | ok: [web04] | ||
- | TASK [haproxy : configure] ********************************************************************************************************************************************** | + | TASK [haproxy : configure] |
- | ok: [web04] | + | changed: [web04] |
- | TASK [haproxy : service] ************************************************************************************************************************************************ | + | TASK [haproxy : service] |
ok: [web04] | ok: [web04] | ||
- | PLAY RECAP ************************************************************************************************************************************************************** | + | RUNNING HANDLER [haproxy : reload haproxy] *********************************************************************************************************************************************************************** |
- | web04 : ok=4 | + | changed: [web04] |
+ | |||
+ | PLAY RECAP ******************************************************************************************************************************************************************************************************* | ||
+ | web04 : ok=5 | ||
</ | </ | ||
Ligne 450: | Ligne 515: | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
Debian GNU/Linux 9 | Debian GNU/Linux 9 | ||
Linux web04.i2tch.loc 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 | Linux web04.i2tch.loc 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 | ||
Ligne 460: | Ligne 525: | ||
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent | Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent | ||
permitted by applicable law. | permitted by applicable law. | ||
- | Last login: Wed Jan 30 01:47:12 2019 from 10.0.2.9 | + | Last login: Wed Mar 9 15:23:48 2022 from 10.0.2.45 |
trainee@web04: | trainee@web04: | ||
● haproxy.service - HAProxy Load Balancer | ● haproxy.service - HAProxy Load Balancer | ||
| | ||
- | | + | |
Docs: man: | Docs: man: | ||
| | ||
- | Main PID: 2444 (haproxy-systemd) | + | Process: 9089 ExecReload=/ |
+ | Process: 9087 ExecReload=/ | ||
+ | Main PID: 5394 (haproxy-systemd) | ||
Tasks: 3 (limit: 4915) | Tasks: 3 (limit: 4915) | ||
| | ||
- | | + | |
- | | + | |
- | | + | |
trainee@web04: | trainee@web04: | ||
global | global | ||
- | log / | + | |
- | log / | + | log / |
- | chroot / | + | chroot / |
- | stats socket / | + | stats socket / |
- | stats timeout 30s | + | stats timeout 30s |
- | user haproxy | + | user haproxy |
- | group haproxy | + | group haproxy |
- | daemon | + | daemon |
- | # Default SSL material locations | + | |
- | ca-base / | + | ca-base / |
- | crt-base / | + | crt-base / |
- | # Default ciphers to use on SSL-enabled listening sockets. | + | |
- | # For more information, | + | # For more information, |
- | # https:// | + | # https:// |
- | # An alternative list with additional directives can be obtained from | + | # An alternative list with additional directives can be obtained from |
- | # https:// | + | # https:// |
- | ssl-default-bind-ciphers ECDH+AESGCM: | + | ssl-default-bind-ciphers ECDH+AESGCM: |
- | ssl-default-bind-options no-sslv3 | + | ssl-default-bind-options no-sslv3 |
defaults | defaults | ||
- | log global | + | |
- | mode http | + | mode http |
- | option httplog | + | option |
- | option dontlognull | + | option |
timeout connect 5000 | timeout connect 5000 | ||
timeout client | timeout client | ||
timeout server | timeout server | ||
- | errorfile 400 / | + | |
- | errorfile 403 / | + | errorfile 403 / |
- | errorfile 408 / | + | errorfile 408 / |
- | errorfile 500 / | + | errorfile 500 / |
- | errorfile 502 / | + | errorfile 502 / |
- | errorfile 503 / | + | errorfile 503 / |
- | errorfile 504 / | + | errorfile 504 / |
frontend haproxy | frontend haproxy | ||
Ligne 525: | Ligne 594: | ||
backend dotcms | backend dotcms | ||
- | server web02 10.0.2.12:8080 check | + | server web02 10.0.2.55:8080 check |
- | server web03 10.0.2.13:8080 check | + | server web03 10.0.2.56:8080 check |
trainee@web04: | trainee@web04: | ||
déconnexion | déconnexion | ||
Connection to web04 closed. | Connection to web04 closed. | ||
+ | [trainee@centos8 roles]$ | ||
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
**Important** : Notez que les valeurs des variables spécifiées dans le fichier **/ | **Important** : Notez que les valeurs des variables spécifiées dans le fichier **/ | ||
</ | </ | ||
- | ====Gabarits Conditionnels==== | + | ====2.2 - Gabarits Conditionnels==== |
Les gabarits peuvent être configurés d'une manière conditionnelle afin de produire des résultats différents en fonction de la valeur d'une variable. Afin de comprendre le fonctionnement des gabarits conditionnels vous allez modifier l' | Les gabarits peuvent être configurés d'une manière conditionnelle afin de produire des résultats différents en fonction de la valeur d'une variable. Afin de comprendre le fonctionnement des gabarits conditionnels vous allez modifier l' | ||
Ligne 543: | Ligne 614: | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
- | trainee@ansible: | + | [trainee@centos8 |
- | trainee@ansible: | + | |
frontend haproxy | frontend haproxy | ||
bind {{ haproxy_listen_address }}: | bind {{ haproxy_listen_address }}: | ||
Ligne 561: | Ligne 631: | ||
backend dotcms | backend dotcms | ||
- | server web02 10.0.2.12:8080 check | + | server web02 10.0.2.55:8080 check |
- | server web03 10.0.2.13:8080 check | + | server web03 10.0.2.56:8080 check |
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
**Important** : Notez la condition **%%{% if haproxy_stats %}%%** qui ne tiendra compte des quatre lignes jusqu' | **Important** : Notez la condition **%%{% if haproxy_stats %}%%** qui ne tiendra compte des quatre lignes jusqu' | ||
</ | </ | ||
Ligne 572: | Ligne 642: | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
- | trainee@ansible: | + | [trainee@centos8 |
--- | --- | ||
haproxy_listen_address: | haproxy_listen_address: | ||
Ligne 581: | Ligne 651: | ||
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
- | **Important** : Notez qu' | + | **Important** : Notez qu' |
</ | </ | ||
Ligne 588: | Ligne 658: | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
- | PLAY [all] ************************************************************************************************************************************************************** | + | PLAY [all] ******************************************************************************************************************************************************************************************************* |
- | TASK [Gathering Facts] ************************************************************************************************************************************************** | + | TASK [Gathering Facts] |
ok: [web04] | ok: [web04] | ||
- | TASK [haproxy : install] ************************************************************************************************************************************************ | + | TASK [haproxy : install] |
ok: [web04] | ok: [web04] | ||
- | TASK [haproxy : configure] ********************************************************************************************************************************************** | + | TASK [haproxy : configure] |
ok: [web04] | ok: [web04] | ||
- | TASK [haproxy : service] ************************************************************************************************************************************************ | + | TASK [haproxy : service] |
ok: [web04] | ok: [web04] | ||
- | PLAY RECAP ************************************************************************************************************************************************************** | + | PLAY RECAP ******************************************************************************************************************************************************************************************************* |
- | web04 : ok=4 changed=0 | + | web04 : ok=4 changed=0 |
</ | </ | ||
Ligne 611: | Ligne 681: | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
Debian GNU/Linux 9 | Debian GNU/Linux 9 | ||
Linux web04.i2tch.loc 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 | Linux web04.i2tch.loc 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 | ||
Ligne 621: | Ligne 691: | ||
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent | Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent | ||
permitted by applicable law. | permitted by applicable law. | ||
- | Last login: Wed Jan 30 02:11:48 2019 from 10.0.2.9 | + | Last login: Wed Mar 9 15:29:27 2022 from 10.0.2.45 |
- | trainee@web04: | + | trainee@web04: |
- | errorfile 504 / | + | errorfile 504 / |
frontend haproxy | frontend haproxy | ||
Ligne 638: | Ligne 708: | ||
backend dotcms | backend dotcms | ||
- | server web02 10.0.2.12:8080 check | + | server web02 10.0.2.55:8080 check |
- | server web03 10.0.2.13:8080 check | + | server web03 10.0.2.56:8080 check |
trainee@web04: | trainee@web04: | ||
déconnexion | déconnexion | ||
Connection to web04 closed. | Connection to web04 closed. | ||
+ | [trainee@centos8 roles]$ | ||
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
**Important** : Notez que les quatre lignes concernant les statistiques ont été incluses dans le fichier. | **Important** : Notez que les quatre lignes concernant les statistiques ont été incluses dans le fichier. | ||
</ | </ | ||
Ligne 652: | Ligne 723: | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
- | trainee@ansible: | + | [trainee@centos8 |
--- | --- | ||
haproxy_listen_address: | haproxy_listen_address: | ||
Ligne 661: | Ligne 732: | ||
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
**Important** : Notez qu' | **Important** : Notez qu' | ||
</ | </ | ||
Ligne 669: | Ligne 740: | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
- | PLAY [all] ************************************************************************************************************************************************************** | + | PLAY [all] ******************************************************************************************************************************************************************************************************* |
- | TASK [Gathering Facts] ************************************************************************************************************************************************** | + | TASK [Gathering Facts] |
ok: [web04] | ok: [web04] | ||
- | TASK [haproxy : install] ************************************************************************************************************************************************ | + | TASK [haproxy : install] |
ok: [web04] | ok: [web04] | ||
- | TASK [haproxy : configure] ********************************************************************************************************************************************** | + | TASK [haproxy : configure] |
changed: [web04] | changed: [web04] | ||
- | TASK [haproxy : service] ************************************************************************************************************************************************ | + | TASK [haproxy : service] |
ok: [web04] | ok: [web04] | ||
- | RUNNING HANDLER [haproxy : reload haproxy] ****************************************************************************************************************************** | + | RUNNING HANDLER [haproxy : reload haproxy] |
changed: [web04] | changed: [web04] | ||
- | PLAY RECAP ************************************************************************************************************************************************************** | + | PLAY RECAP ******************************************************************************************************************************************************************************************************* |
- | web04 : ok=5 changed=2 | + | web04 : ok=5 changed=2 |
</ | </ | ||
Ligne 695: | Ligne 766: | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
Debian GNU/Linux 9 | Debian GNU/Linux 9 | ||
Linux web04.i2tch.loc 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 | Linux web04.i2tch.loc 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 | ||
Ligne 705: | Ligne 776: | ||
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent | Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent | ||
permitted by applicable law. | permitted by applicable law. | ||
- | Last login: Wed Jan 30 02:14:56 2019 from 10.0.2.9 | + | Last login: Wed Mar 9 15:32:20 2022 from 10.0.2.45 |
- | trainee@web04: | + | trainee@web04: |
- | errorfile 408 / | + | errorfile 408 / |
- | errorfile 500 / | + | errorfile 500 / |
- | errorfile 502 / | + | errorfile 502 / |
- | errorfile 503 / | + | errorfile 503 / |
- | errorfile 504 / | + | errorfile 504 / |
frontend haproxy | frontend haproxy | ||
Ligne 722: | Ligne 793: | ||
backend dotcms | backend dotcms | ||
- | server web02 10.0.2.12:8080 check | + | server web02 10.0.2.55:8080 check |
- | server web03 10.0.2.13:8080 check | + | server web03 10.0.2.56:8080 check |
trainee@web04: | trainee@web04: | ||
déconnexion | déconnexion | ||
Connection to web04 closed. | Connection to web04 closed. | ||
+ | [trainee@centos8 roles]$ | ||
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
**Important** : Notez que les quatre lignes concernant les statistiques n'ont pas été incluses dans le fichier. | **Important** : Notez que les quatre lignes concernant les statistiques n'ont pas été incluses dans le fichier. | ||
</ | </ | ||
Ligne 751: | Ligne 823: | ||
</ | </ | ||
- | ====Boucles==== | + | ====2.3 - Boucles==== |
Créez la variable **haproxy_backends** dans le fichier **/ | Créez la variable **haproxy_backends** dans le fichier **/ | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
- | trainee@ansible: | + | [trainee@centos8 |
--- | --- | ||
haproxy_listen_address: | haproxy_listen_address: | ||
Ligne 764: | Ligne 836: | ||
haproxy_stats: | haproxy_stats: | ||
haproxy_backends: | haproxy_backends: | ||
- | - ' | + | - ' |
- | - ' | + | - ' |
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
**Important** : Notez que la variable **haproxy_backends** est une liste YAML. | **Important** : Notez que la variable **haproxy_backends** est une liste YAML. | ||
</ | </ | ||
Ligne 775: | Ligne 847: | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
- | trainee@ansible: | + | [trainee@centos8 |
stats auth admin:admin | stats auth admin:admin | ||
{% endif %} | {% endif %} | ||
Ligne 792: | Ligne 864: | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
- | trainee@ansible: | + | [trainee@centos8 |
--- | --- | ||
haproxy_listen_address: | haproxy_listen_address: | ||
Ligne 801: | Ligne 873: | ||
haproxy_backends: | haproxy_backends: | ||
web02: | web02: | ||
- | ip: 10.0.2.12 | + | ip: 10.0.2.55 |
web03: | web03: | ||
- | ip: 10.0.2.13 | + | ip: 10.0.2.56 |
</ | </ | ||
Ligne 809: | Ligne 881: | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
- | trainee@ansible: | + | [trainee@centos8 |
stats auth admin:admin | stats auth admin:admin | ||
{% endif %} | {% endif %} | ||
Ligne 823: | Ligne 895: | ||
</ | </ | ||
- | ====Macros==== | + | ====2.4 - Macros==== |
Il est aussi possible d' | Il est aussi possible d' | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
- | trainee@ansible: | + | [trainee@centos8 |
{% macro backend(name, | {% macro backend(name, | ||
server {{ name }} {{ ip }}:{{ port }} check | server {{ name }} {{ ip }}:{{ port }} check | ||
Ligne 837: | Ligne 909: | ||
Il convient ensuite d' | Il convient ensuite d' | ||
- | <file> | + | <code> |
- | ... | + | [trainee@centos8 roles]$ vi / |
+ | [trainee@centos8 roles]$ tail / | ||
+ | {% endif %} | ||
+ | balance roundrobin | ||
+ | option httpclose | ||
+ | option forwardfor | ||
{% import ' | {% import ' | ||
backend dotcms | backend dotcms | ||
Ligne 844: | Ligne 922: | ||
{{backend.backend(key, | {{backend.backend(key, | ||
{% endfor %} | {% endfor %} | ||
- | </file> | + | </code> |
- | ====Filtres==== | + | ====2.5 - Filtres==== |
- | ===Default=== | + | ===2.5.1 - Default=== |
- | Le filtre **default** permet de fournir une valeur par défaut pour une variable. Éditez le fichier **/ | + | Le filtre **default** permet de fournir une valeur par défaut pour une variable. Éditez le fichier **/ |
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
- | trainee@ansible: | + | [trainee@centos8 |
bind {{ haproxy_listen_address }}: | bind {{ haproxy_listen_address }}: | ||
mode http | mode http | ||
Ligne 877: | Ligne 955: | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
- | trainee@ansible: | + | [trainee@centos8 |
--- | --- | ||
haproxy_listen_address: | haproxy_listen_address: | ||
Ligne 884: | Ligne 962: | ||
haproxy_backends: | haproxy_backends: | ||
web02: | web02: | ||
- | ip: 10.0.2.12 | + | ip: 10.0.2.55 |
web03: | web03: | ||
- | ip: 10.0.2.13 | + | ip: 10.0.2.56 |
</ | </ | ||
Ligne 892: | Ligne 970: | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
- | PLAY [all] ************************************************************************************************************************************************************** | + | PLAY [all] ******************************************************************************************************************************************************************************************************* |
- | TASK [Gathering Facts] ************************************************************************************************************************************************** | + | TASK [Gathering Facts] |
ok: [web04] | ok: [web04] | ||
- | TASK [haproxy : install] ************************************************************************************************************************************************ | + | TASK [haproxy : install] |
ok: [web04] | ok: [web04] | ||
- | TASK [haproxy : configure] ********************************************************************************************************************************************** | + | TASK [haproxy : configure] |
changed: [web04] | changed: [web04] | ||
- | TASK [haproxy : service] ************************************************************************************************************************************************ | + | TASK [haproxy : service] |
ok: [web04] | ok: [web04] | ||
- | RUNNING HANDLER [haproxy : reload haproxy] ****************************************************************************************************************************** | + | RUNNING HANDLER [haproxy : reload haproxy] |
changed: [web04] | changed: [web04] | ||
- | PLAY RECAP ************************************************************************************************************************************************************** | + | PLAY RECAP ******************************************************************************************************************************************************************************************************* |
- | web04 : ok=5 changed=2 | + | web04 : ok=5 changed=2 |
</ | </ | ||
Ligne 918: | Ligne 996: | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
Debian GNU/Linux 9 | Debian GNU/Linux 9 | ||
Linux web04.i2tch.loc 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 | Linux web04.i2tch.loc 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 | ||
Ligne 928: | Ligne 1006: | ||
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent | Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent | ||
permitted by applicable law. | permitted by applicable law. | ||
- | Last login: Wed Jan 30 03:16:11 2019 from 10.0.2.9 | + | Last login: Wed Mar 9 15:48:45 2022 from 10.0.2.45 |
- | trainee@web04: | + | trainee@web04: |
- | errorfile 504 / | + | errorfile 504 / |
frontend haproxy | frontend haproxy | ||
Ligne 945: | Ligne 1023: | ||
backend dotcms | backend dotcms | ||
- | server web02 10.0.2.12:8080 check | + | server web02 10.0.2.55:8080 check |
- | server web03 10.0.2.13:8080 check | + | server web03 10.0.2.56:8080 check |
trainee@web04: | trainee@web04: | ||
déconnexion | déconnexion | ||
Connection to web04 closed. | Connection to web04 closed. | ||
+ | [trainee@centos8 roles]$ | ||
</ | </ | ||
- | ===Join=== | + | ===2.5.2 - Join=== |
Le filtre **Join** : | Le filtre **Join** : | ||
Ligne 974: | Ligne 1053: | ||
</ | </ | ||
- | ===Map=== | + | ===2.5.3 - Map=== |
Le filtre **Map** : | Le filtre **Map** : | ||
Ligne 987: | Ligne 1066: | ||
haproxy_backends: | haproxy_backends: | ||
web02: | web02: | ||
- | ip: 10.0.2.12 | + | ip: 10.0.2.55 |
web03: | web03: | ||
- | ip: 10.0.2.13 | + | ip: 10.0.2.56 |
</ | </ | ||
Ligne 995: | Ligne 1074: | ||
< | < | ||
- | 10.0.2.12,10.0.2.13 | + | 10.0.2.55,10.0.2.56 |
</ | </ | ||
- | ====Gabarits Parent - Enfants==== | + | ====2.6 - Gabarits Parent - Enfants==== |
HAProxy ne gère pas uniquement le protocole http. Il peut également gérer d' | HAProxy ne gère pas uniquement le protocole http. Il peut également gérer d' | ||
- | ===Le Gabarit Parent=== | + | ===2.6.1 - Le Gabarit Parent=== |
Modifiez donc le fichier **/ | Modifiez donc le fichier **/ | ||
< | < | ||
- | trainee@ansible:~$ vi / | + | [trainee@centos8 roles]$ vi / |
- | trainee@ansible:~$ cat / | + | [trainee@centos8 roles]$ cat / |
global | global | ||
- | log / | + | |
- | log / | + | log / |
- | chroot / | + | chroot / |
- | stats socket / | + | stats socket / |
- | stats timeout 30s | + | stats timeout 30s |
- | user haproxy | + | user haproxy |
- | group haproxy | + | group haproxy |
- | daemon | + | daemon |
{% block globals %} | {% block globals %} | ||
{% endblock %} | {% endblock %} | ||
defaults | defaults | ||
- | log global | + | |
- | option dontlognull | + | option |
timeout connect 5000 | timeout connect 5000 | ||
timeout client | timeout client | ||
Ligne 1032: | Ligne 1111: | ||
{% block server %} | {% block server %} | ||
{% endblock %} | {% endblock %} | ||
- | |||
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
**Important** : Ce gabarit ne contient que des directives générales. Les directives spécifiques au protocole http ont été remplacées par des **blocs** nommés **globals**, | **Important** : Ce gabarit ne contient que des directives générales. Les directives spécifiques au protocole http ont été remplacées par des **blocs** nommés **globals**, | ||
</ | </ | ||
- | ===Le Gabarit Enfant=== | + | ===2.6.2 - Le Gabarit Enfant=== |
Créez maintenant le gabarit **/ | Créez maintenant le gabarit **/ | ||
< | < | ||
- | trainee@ansible:~$ vi / | + | [trainee@centos8 roles]$ vi / |
- | trainee@ansible:~$ cat / | + | [trainee@centos8 roles]$ cat / |
{% extends ' | {% extends ' | ||
{% block globals %} | {% block globals %} | ||
- | ca-base / | + | |
- | crt-base / | + | crt-base / |
- | ssl-default-bind-ciphers ECDH+AESGCM: | + | ssl-default-bind-ciphers ECDH+AESGCM: |
- | ssl-default-bind-options no-sslv3 | + | ssl-default-bind-options no-sslv3 |
{% endblock %} | {% endblock %} | ||
{% block defaults %} | {% block defaults %} | ||
- | mode http | + | |
- | option httplog | + | option |
- | errorfile 400 / | + | errorfile 400 / |
- | errorfile 403 / | + | errorfile 403 / |
- | errorfile 408 / | + | errorfile 408 / |
- | errorfile 500 / | + | errorfile 500 / |
- | errorfile 502 / | + | errorfile 502 / |
- | errorfile 503 / | + | errorfile 503 / |
- | errorfile 504 / | + | errorfile 504 / |
{% endblock %} | {% endblock %} | ||
{% block server %} | {% block server %} | ||
Ligne 1086: | Ligne 1164: | ||
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
**Important** : Notez que les **blocs** nommés **globals**, | **Important** : Notez que les **blocs** nommés **globals**, | ||
</ | </ | ||
Ligne 1093: | Ligne 1171: | ||
< | < | ||
- | trainee@ansible:~$ vi / | + | [trainee@centos8 roles]$ vi / |
- | trainee@ansible:~$ cat / | + | [trainee@centos8 roles]$ cat / |
--- | --- | ||
- name: install | - name: install | ||
Ligne 1115: | Ligne 1193: | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
- | PLAY [all] ************************************************************************************************************************************************************** | + | PLAY [all] ******************************************************************************************************************************************************************************************************* |
- | TASK [Gathering Facts] ************************************************************************************************************************************************** | + | TASK [Gathering Facts] |
ok: [web04] | ok: [web04] | ||
- | TASK [haproxy : install] ************************************************************************************************************************************************ | + | TASK [haproxy : install] |
ok: [web04] | ok: [web04] | ||
- | TASK [haproxy : configure] ********************************************************************************************************************************************** | + | TASK [haproxy : configure] |
changed: [web04] | changed: [web04] | ||
- | TASK [haproxy : service] ************************************************************************************************************************************************ | + | TASK [haproxy : service] |
ok: [web04] | ok: [web04] | ||
- | RUNNING HANDLER [haproxy : reload haproxy] ****************************************************************************************************************************** | + | RUNNING HANDLER [haproxy : reload haproxy] |
changed: [web04] | changed: [web04] | ||
- | PLAY RECAP ************************************************************************************************************************************************************** | + | PLAY RECAP ******************************************************************************************************************************************************************************************************* |
- | web04 : ok=5 changed=2 | + | web04 : ok=5 changed=2 |
</ | </ | ||
Ligne 1141: | Ligne 1219: | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
Debian GNU/Linux 9 | Debian GNU/Linux 9 | ||
Linux web04.i2tch.loc 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 | Linux web04.i2tch.loc 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 | ||
Ligne 1151: | Ligne 1229: | ||
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent | Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent | ||
permitted by applicable law. | permitted by applicable law. | ||
- | Last login: Wed Jan 30 06:36:19 2019 from 10.0.2.9 | + | Last login: Wed Mar 9 15:54:56 2022 from 10.0.2.45 |
- | trainee@web04: | + | trainee@web04: |
global | global | ||
- | log / | + | |
- | log / | + | log / |
- | chroot / | + | chroot / |
- | stats socket / | + | stats socket / |
- | stats timeout 30s | + | stats timeout 30s |
- | user haproxy | + | user haproxy |
- | group haproxy | + | group haproxy |
- | daemon | + | daemon |
- | ca-base / | + | ca-base / |
- | crt-base / | + | crt-base / |
- | ssl-default-bind-ciphers ECDH+AESGCM: | + | ssl-default-bind-ciphers ECDH+AESGCM: |
- | ssl-default-bind-options no-sslv3 | + | ssl-default-bind-options no-sslv3 |
defaults | defaults | ||
- | log global | + | |
- | option dontlognull | + | option |
timeout connect 5000 | timeout connect 5000 | ||
timeout client | timeout client | ||
timeout server | timeout server | ||
- | mode http | + | |
- | option httplog | + | option |
- | errorfile 400 / | + | errorfile 400 / |
- | errorfile 403 / | + | errorfile 403 / |
- | errorfile 408 / | + | errorfile 408 / |
- | errorfile 500 / | + | errorfile 500 / |
- | errorfile 502 / | + | errorfile 502 / |
- | errorfile 503 / | + | errorfile 503 / |
- | errorfile 504 / | + | errorfile 504 / |
frontend haproxy | frontend haproxy | ||
Ligne 1196: | Ligne 1274: | ||
backend dotcms | backend dotcms | ||
- | server web02 10.0.2.12:8080 check | + | server web02 10.0.2.55:8080 check |
- | server web03 10.0.2.13:8080 check | + | server web03 10.0.2.56:8080 check |
trainee@web04: | trainee@web04: | ||
déconnexion | déconnexion | ||
Connection to web04 closed. | Connection to web04 closed. | ||
+ | [trainee@centos8 roles]$ | ||
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
**Important** : Notez que les **blocs** nommés **globals**, | **Important** : Notez que les **blocs** nommés **globals**, | ||
</ | </ | ||
- | =====LAB #10 - Gestion de la Hiérarchie des Variables===== | + | =====LAB #3 - Gestion de la Hiérarchie des Variables===== |
- | Créez | + | La hiérarchie de la prise en compte des variables par Ansible peut être illustrée par le diagramme suivant |
< | < | ||
- | trainee@ansible:~$ mkdir / | + | . |
- | trainee@ansible:~$ mkdir / | + | ├── 1.commandline |
- | trainee@ansible:~$ mkdir / | + | └── roles |
+ | ├── 4.playbook.yaml | ||
+ | ├── debug | ||
+ | │ | ||
+ | │ | ||
+ | │ | ||
+ | │ | ||
+ | ├── group_vars | ||
+ | │ | ||
+ | │ | ||
+ | └── host_vars | ||
+ | └── 2.hostname.yaml | ||
+ | </ | ||
+ | |||
+ | Pour illustrer cette hiérarchie, | ||
+ | |||
+ | < | ||
+ | [trainee@centos8 roles]$ cd ../../ | ||
+ | [trainee@centos8 | ||
+ | [trainee@centos8 | ||
+ | [trainee@centos8 | ||
+ | [trainee@centos8 ~]$ | ||
</ | </ | ||
Ligne 1220: | Ligne 1320: | ||
< | < | ||
- | trainee@ansible:~$ touch / | + | [trainee@centos8 |
- | trainee@ansible:~$ touch / | + | [trainee@centos8 |
+ | [trainee@centos8 ~]$ | ||
</ | </ | ||
Ligne 1227: | Ligne 1328: | ||
< | < | ||
- | trainee@ansible:~/.ansible/ | + | [trainee@centos8 |
+ | [trainee@centos8 roles]$ tree debug | ||
debug | debug | ||
├── defaults | ├── defaults | ||
- | │ └── main.yaml | + | │ |
└── tasks | └── tasks | ||
└── main.yaml | └── main.yaml | ||
Ligne 1240: | Ligne 1342: | ||
< | < | ||
- | trainee@ansible:~$ mkdir / | + | [trainee@centos8 roles]$ mkdir / |
- | trainee@ansible:~$ touch / | + | [trainee@centos8 roles]$ touch / |
+ | [trainee@centos8 roles]$ | ||
</ | </ | ||
Ligne 1247: | Ligne 1350: | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
group_vars/ | group_vars/ | ||
- | ├── all.yaml | + | └── all.yaml |
0 directories, | 0 directories, | ||
Ligne 1257: | Ligne 1360: | ||
< | < | ||
- | trainee@ansible:~$ vi / | + | [trainee@centos8 roles]$ vi / |
- | trainee@ansible:~$ cat / | + | [trainee@centos8 roles]$ cat / |
--- | --- | ||
- debug: | - debug: | ||
Ligne 1267: | Ligne 1370: | ||
< | < | ||
- | trainee@ansible:~$ vi / | + | [trainee@centos8 roles]$ vi / |
- | trainee@ansible:~$ cat / | + | [trainee@centos8 roles]$ cat / |
--- | --- | ||
- hosts: all | - hosts: all | ||
Ligne 1278: | Ligne 1381: | ||
< | < | ||
- | trainee@ansible:~$ cd .ansible/ | + | [trainee@centos8 |
- | trainee@ansible: | + | |
- | PLAY [all] ************************************************************************************************************************************************************** | + | PLAY [all] ******************************************************************************************************************************************************************************************************* |
- | TASK [Gathering Facts] ************************************************************************************************************************************************** | + | TASK [Gathering Facts] |
ok: [web04] | ok: [web04] | ||
- | ok: [web02] | ||
ok: [web03] | ok: [web03] | ||
+ | ok: [web02] | ||
ok: [web01] | ok: [web01] | ||
- | TASK [debug : debug] **************************************************************************************************************************************************** | + | TASK [debug : debug] |
ok: [web01] => { | ok: [web01] => { | ||
" | " | ||
Ligne 1303: | Ligne 1405: | ||
} | } | ||
- | PLAY RECAP ************************************************************************************************************************************************************** | + | PLAY RECAP ******************************************************************************************************************************************************************************************************* |
- | web01 : ok=2 changed=0 | + | web01 : ok=2 changed=0 |
- | web02 : ok=2 changed=0 | + | web02 : ok=2 changed=0 |
- | web03 : ok=2 changed=0 | + | web03 : ok=2 changed=0 |
- | web04 : ok=2 changed=0 | + | web04 : ok=2 changed=0 |
</ | </ | ||
Ligne 1313: | Ligne 1415: | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
- | trainee@ansible: | + | [trainee@centos8 |
--- | --- | ||
endroit: ' | endroit: ' | ||
Ligne 1322: | Ligne 1424: | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
- | PLAY [all] ************************************************************************************************************************************************************** | + | PLAY [all] ******************************************************************************************************************************************************************************************************* |
- | TASK [Gathering Facts] ************************************************************************************************************************************************** | + | TASK [Gathering Facts] ******************************************************************************************************************************************************************************************* |
+ | ok: [web03] | ||
ok: [web04] | ok: [web04] | ||
+ | ok: [web02] | ||
ok: [web01] | ok: [web01] | ||
- | ok: [web03] | ||
- | ok: [web02] | ||
- | TASK [debug : debug] **************************************************************************************************************************************************** | + | TASK [debug : debug] ********************************************************************************************************************************************************************************************* |
- | ok: [web04] => { | + | |
- | " | + | |
- | } | + | |
ok: [web01] => { | ok: [web01] => { | ||
" | " | ||
Ligne 1343: | Ligne 1442: | ||
} | } | ||
ok: [web03] => { | ok: [web03] => { | ||
+ | " | ||
+ | } | ||
+ | ok: [web04] => { | ||
" | " | ||
} | } | ||
- | PLAY RECAP ************************************************************************************************************************************************************** | + | PLAY RECAP ******************************************************************************************************************************************************************************************************* |
- | web01 : ok=2 changed=0 | + | web01 : ok=2 changed=0 |
- | web02 : ok=2 changed=0 | + | web02 : ok=2 changed=0 |
- | web03 : ok=2 changed=0 | + | web03 : ok=2 changed=0 |
- | web04 : ok=2 changed=0 | + | web04 : ok=2 changed=0 |
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
**Important** : La variable fixée dans **defaults/ | **Important** : La variable fixée dans **defaults/ | ||
</ | </ | ||
Ligne 1360: | Ligne 1462: | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
- | trainee@ansible: | + | [trainee@centos8 |
--- | --- | ||
endroit: ' | endroit: ' | ||
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
**Important** : La déclaration de la variable peut être faite dans **roles/ | **Important** : La déclaration de la variable peut être faite dans **roles/ | ||
</ | </ | ||
Ligne 1373: | Ligne 1475: | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
- | trainee@ansible: | + | |
- | PLAY [all] ************************************************************************************************************************************************************** | + | PLAY [all] ******************************************************************************************************************************************************************************************************* |
- | TASK [Gathering Facts] ************************************************************************************************************************************************** | + | TASK [Gathering Facts] ******************************************************************************************************************************************************************************************* |
- | ok: [web02] | + | |
- | ok: [web01] | + | |
ok: [web04] | ok: [web04] | ||
ok: [web03] | ok: [web03] | ||
+ | ok: [web01] | ||
+ | ok: [web02] | ||
- | TASK [debug : debug] **************************************************************************************************************************************************** | + | TASK [debug : debug] |
ok: [web01] => { | ok: [web01] => { | ||
- | " | ||
- | } | ||
- | ok: [web04] => { | ||
" | " | ||
} | } | ||
Ligne 1395: | Ligne 1493: | ||
} | } | ||
ok: [web03] => { | ok: [web03] => { | ||
+ | " | ||
+ | } | ||
+ | ok: [web04] => { | ||
" | " | ||
} | } | ||
- | PLAY RECAP ************************************************************************************************************************************************************** | + | PLAY RECAP ******************************************************************************************************************************************************************************************************* |
- | web01 : ok=2 changed=0 | + | web01 : ok=2 changed=0 |
- | web02 : ok=2 changed=0 | + | web02 : ok=2 changed=0 |
- | web03 : ok=2 changed=0 | + | web03 : ok=2 changed=0 |
- | web04 : ok=2 changed=0 | + | web04 : ok=2 changed=0 |
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
**Important** : La variable fixée dans **group_vars/ | **Important** : La variable fixée dans **group_vars/ | ||
</ | </ | ||
Ligne 1412: | Ligne 1513: | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
- | trainee@ansible: | + | [trainee@centos8 |
--- | --- | ||
- hosts: all | - hosts: all | ||
Ligne 1423: | Ligne 1524: | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
- | PLAY [all] ************************************************************************************************************************************************************** | + | PLAY [all] ******************************************************************************************************************************************************************************************************* |
- | TASK [Gathering Facts] ************************************************************************************************************************************************** | + | TASK [Gathering Facts] |
ok: [web02] | ok: [web02] | ||
- | ok: [web04] | ||
ok: [web03] | ok: [web03] | ||
ok: [web01] | ok: [web01] | ||
+ | ok: [web04] | ||
- | TASK [debug : debug] **************************************************************************************************************************************************** | + | TASK [debug : debug] ********************************************************************************************************************************************************************************************* |
+ | ok: [web01] => { | ||
+ | " | ||
+ | } | ||
ok: [web02] => { | ok: [web02] => { | ||
" | " | ||
} | } | ||
ok: [web03] => { | ok: [web03] => { | ||
- | " | ||
- | } | ||
- | ok: [web01] => { | ||
" | " | ||
} | } | ||
Ligne 1447: | Ligne 1548: | ||
} | } | ||
- | PLAY RECAP ************************************************************************************************************************************************************** | + | PLAY RECAP ******************************************************************************************************************************************************************************************************* |
- | web01 : ok=2 changed=0 | + | web01 : ok=2 changed=0 |
- | web02 : ok=2 changed=0 | + | web02 : ok=2 changed=0 |
- | web03 : ok=2 changed=0 | + | web03 : ok=2 changed=0 |
- | web04 : ok=2 changed=0 | + | web04 : ok=2 changed=0 |
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
**Important** : La variable fixée dans **playbook.yaml** surcharge la variable fixée dans **group_vars/ | **Important** : La variable fixée dans **playbook.yaml** surcharge la variable fixée dans **group_vars/ | ||
- | </ | ||
- | |||
- | Exécutez la commande **ansible-playbook** en définissant la valeur de la variable **endroit** sur la ligne de commande : | ||
- | |||
- | < | ||
- | trainee@ansible: | ||
- | |||
- | PLAY [all] ************************************************************************************************************************************************************** | ||
- | |||
- | TASK [Gathering Facts] ************************************************************************************************************************************************** | ||
- | ok: [web01] | ||
- | ok: [web04] | ||
- | ok: [web03] | ||
- | ok: [web02] | ||
- | |||
- | TASK [debug : debug] **************************************************************************************************************************************************** | ||
- | ok: [web04] => { | ||
- | " | ||
- | } | ||
- | ok: [web01] => { | ||
- | " | ||
- | } | ||
- | ok: [web02] => { | ||
- | " | ||
- | } | ||
- | ok: [web03] => { | ||
- | " | ||
- | } | ||
- | |||
- | PLAY RECAP ************************************************************************************************************************************************************** | ||
- | web01 : ok=2 changed=0 | ||
- | web02 : ok=2 changed=0 | ||
- | web03 : ok=2 changed=0 | ||
- | web04 : ok=2 changed=0 | ||
- | </ | ||
- | |||
- | <WRAP center round important 60%> | ||
- | **Important** : La variable fixée dans sur la **ligne de commande** surcharge la variable fixée dans **playbook.yaml** qui surcharge la variable fixée dans **group_vars/ | ||
</ | </ | ||
Ligne 1499: | Ligne 1562: | ||
< | < | ||
- | trainee@ansible:~$ vi / | + | [trainee@centos8 roles]$ vi / |
- | trainee@ansible:~$ cat / | + | [trainee@centos8 roles]$ cat / |
--- | --- | ||
endroit: ' | endroit: ' | ||
Ligne 1508: | Ligne 1571: | ||
< | < | ||
- | trainee@ansible:~$ mkdir / | + | [trainee@centos8 roles]$ mkdir / |
- | trainee@ansible:~$ vi / | + | [trainee@centos8 roles]$ vi / |
- | trainee@ansible:~$ cat / | + | [trainee@centos8 roles]$ cat / |
--- | --- | ||
# endroit: ' | # endroit: ' | ||
Ligne 1518: | Ligne 1581: | ||
< | < | ||
- | trainee@ansible:~$ vi / | + | [trainee@centos8 roles]$ vi / |
- | trainee@ansible:~$ cat / | + | [trainee@centos8 roles]$ cat / |
--- | --- | ||
- hosts: all | - hosts: all | ||
Ligne 1529: | Ligne 1592: | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
- | trainee@ansible: | + | [trainee@centos8 |
localhost ansible_connection=local | localhost ansible_connection=local | ||
Ligne 1555: | Ligne 1618: | ||
< | < | ||
- | trainee@ansible:~$ cd / | + | [trainee@centos8 |
- | trainee@ansible: | + | |
- | PLAY [all] ************************************************************************************************************************************************************** | + | PLAY [all] ******************************************************************************************************************************************************************************************************* |
- | TASK [Gathering Facts] ************************************************************************************************************************************************** | + | TASK [Gathering Facts] ******************************************************************************************************************************************************************************************* |
- | ok: [web03] | + | |
- | ok: [web01] | + | |
ok: [web04] | ok: [web04] | ||
- | ok: [localhost] | + | ok: [web01] |
ok: [web02] | ok: [web02] | ||
+ | ok: [web03] | ||
+ | ok: [localhost] | ||
- | TASK [debug : debug] **************************************************************************************************************************************************** | + | TASK [debug : debug] |
ok: [localhost] => { | ok: [localhost] => { | ||
+ | " | ||
+ | } | ||
+ | ok: [web01] => { | ||
" | " | ||
} | } | ||
Ligne 1575: | Ligne 1640: | ||
} | } | ||
ok: [web03] => { | ok: [web03] => { | ||
- | " | ||
- | } | ||
- | ok: [web01] => { | ||
" | " | ||
} | } | ||
Ligne 1584: | Ligne 1646: | ||
} | } | ||
- | PLAY RECAP ************************************************************************************************************************************************************** | + | PLAY RECAP ******************************************************************************************************************************************************************************************************* |
- | localhost | + | localhost |
- | web01 : ok=2 changed=0 | + | web01 : ok=2 changed=0 |
- | web02 : ok=2 changed=0 | + | web02 : ok=2 changed=0 |
- | web03 : ok=2 changed=0 | + | web03 : ok=2 changed=0 |
- | web04 : ok=2 changed=0 | + | web04 : ok=2 changed=0 |
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
**Important** : Notez que la valeur de la variable **endroit** spécifiée dans le fichier **group_vars/ | **Important** : Notez que la valeur de la variable **endroit** spécifiée dans le fichier **group_vars/ | ||
</ | </ | ||
Ligne 1599: | Ligne 1661: | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
- | trainee@ansible: | + | [trainee@centos8 |
[group1] | [group1] | ||
localhost ansible_connection=local | localhost ansible_connection=local | ||
Ligne 1626: | Ligne 1688: | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
- | PLAY [all] ************************************************************************************************************************************************************** | + | PLAY [all] ******************************************************************************************************************************************************************************************************* |
- | TASK [Gathering Facts] ************************************************************************************************************************************************** | + | TASK [Gathering Facts] ******************************************************************************************************************************************************************************************* |
- | ok: [web04] | + | |
- | ok: [web02] | + | |
ok: [web03] | ok: [web03] | ||
ok: [web01] | ok: [web01] | ||
+ | ok: [web02] | ||
+ | ok: [web04] | ||
ok: [localhost] | ok: [localhost] | ||
- | TASK [debug : debug] **************************************************************************************************************************************************** | + | TASK [debug : debug] |
ok: [localhost] => { | ok: [localhost] => { | ||
" | " | ||
+ | } | ||
+ | ok: [web01] => { | ||
+ | " | ||
} | } | ||
ok: [web02] => { | ok: [web02] => { | ||
Ligne 1648: | Ligne 1713: | ||
} | } | ||
ok: [web04] => { | ok: [web04] => { | ||
- | " | ||
- | } | ||
- | ok: [web01] => { | ||
" | " | ||
} | } | ||
- | PLAY RECAP ************************************************************************************************************************************************************** | + | PLAY RECAP ******************************************************************************************************************************************************************************************************* |
- | localhost | + | localhost |
- | web01 : ok=2 changed=0 | + | web01 : ok=2 changed=0 |
- | web02 : ok=2 changed=0 | + | web02 : ok=2 changed=0 |
- | web03 : ok=2 changed=0 | + | web03 : ok=2 changed=0 |
- | web04 : ok=2 changed=0 | + | web04 : ok=2 changed=0 |
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
**Important** : La variable fixée dans **group_vars/ | **Important** : La variable fixée dans **group_vars/ | ||
</ | </ | ||
Ligne 1669: | Ligne 1731: | ||
< | < | ||
- | trainee@ansible:~$ mkdir / | + | [trainee@centos8 |
- | trainee@ansible: | + | [trainee@centos8 roles]$ cat / |
- | trainee@ansible:~$ cat / | + | |
--- | --- | ||
endroit: ' | endroit: ' | ||
Ligne 1679: | Ligne 1740: | ||
< | < | ||
- | trainee@ansible: | + | [trainee@centos8 |
- | PLAY [all] ************************************************************************************************************************************************************** | + | PLAY [all] ******************************************************************************************************************************************************************************************************* |
- | TASK [Gathering Facts] ************************************************************************************************************************************************** | + | TASK [Gathering Facts] ******************************************************************************************************************************************************************************************* |
- | ok: [web01] | + | |
ok: [web02] | ok: [web02] | ||
- | ok: [web04] | ||
ok: [web03] | ok: [web03] | ||
+ | ok: [web01] | ||
+ | ok: [web04] | ||
ok: [localhost] | ok: [localhost] | ||
- | TASK [debug : debug] **************************************************************************************************************************************************** | + | TASK [debug : debug] |
ok: [localhost] => { | ok: [localhost] => { | ||
" | " | ||
+ | } | ||
+ | ok: [web01] => { | ||
+ | " | ||
} | } | ||
ok: [web02] => { | ok: [web02] => { | ||
Ligne 1702: | Ligne 1766: | ||
ok: [web04] => { | ok: [web04] => { | ||
" | " | ||
+ | } | ||
+ | |||
+ | PLAY RECAP ******************************************************************************************************************************************************************************************************* | ||
+ | localhost | ||
+ | web01 : ok=2 changed=0 | ||
+ | web02 : ok=2 changed=0 | ||
+ | web03 : ok=2 changed=0 | ||
+ | web04 : ok=2 changed=0 | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important> | ||
+ | **Important** : La variable fixée dans **host_vars/ | ||
+ | </ | ||
+ | |||
+ | Exécutez la commande **ansible-playbook** en définissant la valeur de la variable **endroit** sur la ligne de commande : | ||
+ | |||
+ | < | ||
+ | [trainee@centos8 roles]$ ansible-playbook -i inventory playbook.yaml -e ' | ||
+ | |||
+ | PLAY [all] ******************************************************************************************************************************************************************************************************* | ||
+ | |||
+ | TASK [Gathering Facts] ******************************************************************************************************************************************************************************************* | ||
+ | ok: [web04] | ||
+ | ok: [web03] | ||
+ | ok: [web02] | ||
+ | ok: [web01] | ||
+ | ok: [localhost] | ||
+ | |||
+ | TASK [debug : debug] ********************************************************************************************************************************************************************************************* | ||
+ | ok: [localhost] => { | ||
+ | " | ||
} | } | ||
ok: [web01] => { | ok: [web01] => { | ||
- | " | + | " |
+ | } | ||
+ | ok: [web02] => { | ||
+ | " | ||
+ | } | ||
+ | ok: [web03] => { | ||
+ | " | ||
+ | } | ||
+ | ok: [web04] => { | ||
+ | " | ||
} | } | ||
- | PLAY RECAP ************************************************************************************************************************************************************** | + | PLAY RECAP ******************************************************************************************************************************************************************************************************* |
- | localhost | + | localhost |
- | web01 : ok=2 changed=0 | + | web01 : ok=2 changed=0 |
- | web02 : ok=2 changed=0 | + | web02 : ok=2 changed=0 |
- | web03 : ok=2 changed=0 | + | web03 : ok=2 changed=0 |
- | web04 : ok=2 changed=0 | + | web04 : ok=2 changed=0 |
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
- | **Important** : La variable fixée dans **host_vars/ | + | **Important** : La variable fixée dans sur la **ligne de commande** surcharge |
</ | </ | ||
+ | |||
+ | =====LAB #4 - Utilisation des Facts d' | ||
+ | |||
+ | Ansible Facts sont : | ||
+ | |||
+ | * des variables collectées automatiquement par le module **setup** d' | ||
+ | * spécifiques à l' | ||
+ | |||
+ | Il est cependant possible d' | ||
+ | |||
+ | < | ||
+ | [trainee@centos8 roles]$ ansible all -i web01, -m setup | more | ||
+ | web01 | SUCCESS => { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ], | ||
+ | " | ||
+ | " | ||
+ | ], | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | --More-- | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important> | ||
+ | **Important** : Notez que le nom de chaque **Fact** commence par **ansible_**. Évitez donc de créer des variables commençant var cette valeur ! | ||
+ | </ | ||
+ | |||
+ | Parmi les Facts, les plus utiles sont : | ||
+ | |||
+ | * " | ||
+ | * " | ||
+ | * " | ||
+ | * " | ||
+ | * " | ||
+ | * " | ||
+ | * " | ||
+ | * " | ||
+ | * " | ||
+ | * " | ||
+ | |||
+ | Ainsi que dictionnaire **ansible_default_ipv4** : | ||
+ | |||
+ | < | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | </ | ||
+ | |||
+ | Modifiez le fichier **inventory** en mettant les deux machines TargetA et TargetB dans le groupe **linux** : | ||
+ | |||
+ | < | ||
+ | [trainee@centos8 roles]$ vi inventory | ||
+ | [trainee@centos8 roles]$ cat inventory | ||
+ | [linux] | ||
+ | targeta | ||
+ | targetb | ||
+ | |||
+ | [group1] | ||
+ | localhost ansible_connection=local | ||
+ | |||
+ | [basededonnees] | ||
+ | web01 | ||
+ | |||
+ | [dotcms] | ||
+ | web02 | ||
+ | web03 | ||
+ | |||
+ | [equilibrage] | ||
+ | web04 | ||
+ | |||
+ | [debian: | ||
+ | basededonnees | ||
+ | dotcms | ||
+ | equilibrage | ||
+ | |||
+ | [debian: | ||
+ | ansible_user=trainee | ||
+ | </ | ||
+ | |||
+ | Modifiez le fichier **playbook.yaml** afin d' | ||
+ | |||
+ | < | ||
+ | [trainee@centos8 roles]$ vi playbook.yaml | ||
+ | [trainee@centos8 roles]$ cat playbook.yaml | ||
+ | --- | ||
+ | - hosts: all | ||
+ | become: true | ||
+ | roles: | ||
+ | - exemple01.java | ||
+ | </ | ||
+ | |||
+ | Connectez-vous à la machine TargetA et supprimez le paquet **openjdk-8-jre** : | ||
+ | |||
+ | < | ||
+ | [trainee@centos8 roles]$ ssh 10.0.2.52 | ||
+ | Debian GNU/Linux 9 | ||
+ | Linux targeta.i2tch.loc 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 | ||
+ | |||
+ | The programs included with the Debian GNU/Linux system are free software; | ||
+ | the exact distribution terms for each program are described in the | ||
+ | individual files in / | ||
+ | |||
+ | Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent | ||
+ | permitted by applicable law. | ||
+ | Last login: Wed Mar 9 11:29:25 2022 from 10.0.2.45 | ||
+ | trainee@targeta: | ||
+ | ... | ||
+ | trainee@targeta: | ||
+ | déconnexion | ||
+ | Connection to 10.0.2.52 closed. | ||
+ | [trainee@centos8 roles]$ | ||
+ | </ | ||
+ | |||
+ | Utilisez la commande scp pour copier le fichier authorized_keys de la machine virtuelle centos8 vers la machine virtuelle targetb : | ||
+ | |||
+ | < | ||
+ | [trainee@centos8 roles]$ cd ~ | ||
+ | [trainee@centos8 ~]$ scp .ssh/ | ||
+ | trainee@10.0.2.53' | ||
+ | authorized_keys | ||
+ | [trainee@centos8 ~]$ cd - | ||
+ | / | ||
+ | [trainee@centos8 roles]$ | ||
+ | </ | ||
+ | |||
+ | Connectez-vous à la machine TargetB et supprimez le paquet **java-1.8.0-openjdk** : | ||
+ | |||
+ | < | ||
+ | [trainee@centos8 roles]$ ssh 10.0.2.53 | ||
+ | Last login: Wed Mar 9 16:51:41 2022 from 10.0.2.45 | ||
+ | [trainee@targetb ~]$ sudo yum -y remove java-1.8.0-openjdk | ||
+ | ... | ||
+ | [trainee@targetb ~]$ exit | ||
+ | logout | ||
+ | Connection to 10.0.2.53 closed. | ||
+ | [trainee@centos8 roles]$ | ||
+ | </ | ||
+ | |||
+ | Grâce au Fact **ansible_os_family** il est possible d' | ||
+ | |||
+ | < | ||
+ | [trainee@centos8 roles]$ vi exemple01.java/ | ||
+ | [trainee@centos8 roles]$ cat exemple01.java/ | ||
+ | --- | ||
+ | - name: install jre (Debian) | ||
+ | package: name=openjdk-8-jre state=present | ||
+ | when: ansible_os_family == ' | ||
+ | |||
+ | - name: install jre (CentOS) | ||
+ | package: name=java-1.8.0-openjdk state=present | ||
+ | when: ansible_os_family == ' | ||
+ | </ | ||
+ | |||
+ | Modifiez le fichier **/ | ||
+ | |||
+ | < | ||
+ | [trainee@centos8 roles]$ su - | ||
+ | Password: fenestros | ||
+ | [root@centos8 ~]# vi /etc/hosts | ||
+ | [root@centos8 ~]# cat /etc/hosts | ||
+ | 127.0.0.1 | ||
+ | ::1 | ||
+ | 10.0.2.45 centos8.ittraining.loc centos8 | ||
+ | 10.0.2.54 web01.i2tch.loc web01 | ||
+ | 10.0.2.55 web02.i2tch.loc web02 | ||
+ | 10.0.2.56 web03.i2tch.loc web03 | ||
+ | 10.0.2.57 web04.i2tch.loc web04 | ||
+ | 10.0.2.52 targeta.i2tch.loc targeta | ||
+ | 10.0.2.53 targetb.i2tch.loc targetb | ||
+ | [root@centos8 ~]# exit | ||
+ | logout | ||
+ | [trainee@centos8 roles]$ | ||
+ | </ | ||
+ | |||
+ | Connectez-vous en ssh à targeta et testez la configuration de sudo : | ||
+ | |||
+ | < | ||
+ | [trainee@centos8 roles]$ ssh targeta | ||
+ | The authenticity of host ' | ||
+ | ECDSA key fingerprint is SHA256: | ||
+ | Are you sure you want to continue connecting (yes/ | ||
+ | Warning: Permanently added ' | ||
+ | Debian GNU/Linux 9 | ||
+ | Linux targeta.i2tch.loc 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 | ||
+ | |||
+ | The programs included with the Debian GNU/Linux system are free software; | ||
+ | the exact distribution terms for each program are described in the | ||
+ | individual files in / | ||
+ | |||
+ | Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent | ||
+ | permitted by applicable law. | ||
+ | Last login: Wed Mar 9 16:52:16 2022 from 10.0.2.45 | ||
+ | |||
+ | trainee@targeta: | ||
+ | Réception de:1 http:// | ||
+ | Ign:2 http:// | ||
+ | Réception de:3 http:// | ||
+ | Réception de:4 http:// | ||
+ | Réception de:5 http:// | ||
+ | Réception de:6 http:// | ||
+ | Réception de:7 http:// | ||
+ | Réception de:8 http:// | ||
+ | Réception de:9 http:// | ||
+ | Réception de:10 http:// | ||
+ | Réception de:11 http:// | ||
+ | 21,0 Mo réceptionnés en 7s (2 753 ko/s) | ||
+ | Lecture des listes de paquets... Fait | ||
+ | Construction de l' | ||
+ | Lecture des informations d' | ||
+ | 333 packages can be upgraded. Run 'apt list --upgradable' | ||
+ | |||
+ | trainee@targeta: | ||
+ | déconnexion | ||
+ | Connection to targeta closed. | ||
+ | </ | ||
+ | |||
+ | Connectez-vous en ssh à targetb et testez la configuration de sudo : | ||
+ | |||
+ | < | ||
+ | [trainee@centos8 roles]$ ssh targetb | ||
+ | The authenticity of host ' | ||
+ | ECDSA key fingerprint is SHA256: | ||
+ | Are you sure you want to continue connecting (yes/ | ||
+ | Warning: Permanently added ' | ||
+ | Last login: Wed Mar 9 16:56:33 2022 from 10.0.2.45 | ||
+ | |||
+ | [trainee@targetb ~]$ yum clean all | ||
+ | Loaded plugins: fastestmirror, | ||
+ | Cleaning repos: base extras updates | ||
+ | Other repos take up 190 M of disk space (use --verbose for details) | ||
+ | |||
+ | [trainee@targetb ~]$ sudo yum -y makecache | ||
+ | Loaded plugins: fastestmirror, | ||
+ | Loading mirror speeds from cached hostfile | ||
+ | * base: centos.mirror.ate.info | ||
+ | * extras: mirror.plusserver.com | ||
+ | * updates: mirror.plusserver.com | ||
+ | base | 3.6 kB 00: | ||
+ | extras | ||
+ | updates | ||
+ | (1/6): extras/ | ||
+ | (2/6): base/ | ||
+ | (3/6): base/ | ||
+ | (4/6): extras/ | ||
+ | (5/6): updates/ | ||
+ | (6/6): updates/ | ||
+ | Metadata Cache Created | ||
+ | |||
+ | [trainee@targetb ~]$ exit | ||
+ | logout | ||
+ | Connection to targetb closed. | ||
+ | [trainee@centos8 roles]$ | ||
+ | </ | ||
+ | |||
+ | Exécutez **ansible-playbook** et constatez le résultat : | ||
+ | |||
+ | < | ||
+ | [trainee@centos8 roles]$ ansible-playbook -i inventory playbook.yaml -l linux | ||
+ | |||
+ | PLAY [all] ******************************************************************************************************************************************************************************************************* | ||
+ | |||
+ | TASK [Gathering Facts] ******************************************************************************************************************************************************************************************* | ||
+ | ok: [targeta] | ||
+ | ok: [targetb] | ||
+ | |||
+ | TASK [exemple01.java : install jre (Debian)] ********************************************************************************************************************************************************************* | ||
+ | skipping: [targetb] | ||
+ | changed: [targeta] | ||
+ | |||
+ | TASK [exemple01.java : install jre (CentOS)] ********************************************************************************************************************************************************************* | ||
+ | skipping: [targeta] | ||
+ | changed: [targetb] | ||
+ | |||
+ | PLAY RECAP ******************************************************************************************************************************************************************************************************* | ||
+ | targeta | ||
+ | targetb | ||
+ | </ | ||
+ | |||
+ | Les conditions peuvent être combinées grâce à **and** et **or**. En voici un exemple : | ||
+ | |||
+ | < | ||
+ | tasks: | ||
+ | - name: " | ||
+ | command: / | ||
+ | when: (ansible_distribution == " | ||
+ | (ansible_distribution == " | ||
+ | </ | ||
+ | |||
+ | =====LAB #5 - La Commande ansible-vault===== | ||
+ | |||
+ | La commande **ansible-vault** permet de créer et d' | ||
+ | |||
+ | Pour illustrer son utilisation, | ||
+ | |||
+ | < | ||
+ | [trainee@centos8 roles]$ mkdir vault | ||
+ | </ | ||
+ | |||
+ | Éditez le fichier **/ | ||
+ | |||
+ | < | ||
+ | [trainee@centos8 roles]$ vi / | ||
+ | [trainee@centos8 roles]$ cat / | ||
+ | --- | ||
+ | secret: gardezmoisecret | ||
+ | </ | ||
+ | |||
+ | Modifiez le fichier **/ | ||
+ | |||
+ | < | ||
+ | [trainee@centos8 roles]$ vi playbook.yaml | ||
+ | [trainee@centos8 roles]$ cat playbook.yaml | ||
+ | --- | ||
+ | - hosts: all | ||
+ | tasks: | ||
+ | - debug: | ||
+ | msg: "Le secret est {{ secret }}" | ||
+ | </ | ||
+ | |||
+ | Exécutez la commande **ansible-playbook** : | ||
+ | |||
+ | < | ||
+ | [trainee@centos8 roles]$ ansible-playbook -i inventory playbook.yaml -l localhost | ||
+ | |||
+ | PLAY [all] ******************************************************************************************************************************************************************************************************* | ||
+ | |||
+ | TASK [Gathering Facts] ******************************************************************************************************************************************************************************************* | ||
+ | ok: [localhost] | ||
+ | |||
+ | TASK [debug] ***************************************************************************************************************************************************************************************************** | ||
+ | ok: [localhost] => { | ||
+ | " | ||
+ | } | ||
+ | |||
+ | PLAY RECAP ******************************************************************************************************************************************************************************************************* | ||
+ | localhost | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important> | ||
+ | **Important** : L' | ||
+ | </ | ||
+ | |||
+ | ====5.1 - Crypter le Fichier==== | ||
+ | |||
+ | Cryptez maintenant le fichier **/ | ||
+ | |||
+ | < | ||
+ | [trainee@centos8 roles]$ ansible-vault encrypt group_vars/ | ||
+ | New Vault password: fenestros | ||
+ | Confirm New Vault password: fenestros | ||
+ | Encryption successful | ||
+ | [trainee@centos8 roles]$ | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important> | ||
+ | **Important** : Notez que le mot de passe **fenestros** ne sera pas en clair. | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important> | ||
+ | **Important** : Notez que le mot de passe est pour la commande **ansible-vault** et non pas uniquement pour l' | ||
+ | </ | ||
+ | |||
+ | Constatez maintenant le contenu du fichier **/ | ||
+ | |||
+ | < | ||
+ | [trainee@centos8 roles]$ cat / | ||
+ | $ANSIBLE_VAULT; | ||
+ | 33343664333931323331346338346439613439633633396262393733663463363438663163383761 | ||
+ | 6566653230323032396434356132653262313962633265630a366436666261363933343663623131 | ||
+ | 63373230663530313864373236316465333464323131643933363664303332336261353732623064 | ||
+ | 3538303864633035320a376235333637656534376638613661303765373165383936653336646562 | ||
+ | 31376535333861616165346433306230366231333139323062366432333033386366 | ||
+ | </ | ||
+ | |||
+ | Exécutez de nouveau la commande **ansible-playbook** : | ||
+ | |||
+ | < | ||
+ | [trainee@centos8 roles]$ ansible-playbook -i inventory playbook.yaml -l localhost | ||
+ | |||
+ | PLAY [all] ******************************************************************************************************************************************************************************************************* | ||
+ | ERROR! Attempting to decrypt but no vault secrets found | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important> | ||
+ | **Important** : Notez l' | ||
+ | </ | ||
+ | |||
+ | Pour indiquer à la commande **ansible-playbook** que le fichier qui doit être lu soit crypté, utilisez l' | ||
+ | |||
+ | < | ||
+ | [trainee@centos8 roles]$ ansible-playbook -i inventory playbook.yaml -l localhost | ||
+ | |||
+ | PLAY [all] ******************************************************************************************************************************************************************************************************* | ||
+ | ERROR! Attempting to decrypt but no vault secrets found | ||
+ | [trainee@centos8 roles]$ ansible-playbook -i inventory playbook.yaml -l localhost --ask-vault-pass | ||
+ | Vault password: fenestros | ||
+ | |||
+ | PLAY [all] ******************************************************************************************************************************************************************************************************* | ||
+ | |||
+ | TASK [Gathering Facts] ******************************************************************************************************************************************************************************************* | ||
+ | ok: [localhost] | ||
+ | |||
+ | TASK [debug] ***************************************************************************************************************************************************************************************************** | ||
+ | ok: [localhost] => { | ||
+ | " | ||
+ | } | ||
+ | |||
+ | PLAY RECAP ******************************************************************************************************************************************************************************************************* | ||
+ | localhost | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important> | ||
+ | **Important** : Notez que le mot de passe **fenestros** ne sera pas en clair. | ||
+ | </ | ||
+ | |||
+ | ====5.2 - Editer le Fichier==== | ||
+ | |||
+ | Pour éditer le fichier, utilisez la sous-commande **edit** de la commande **ansible-vault** : | ||
+ | |||
+ | < | ||
+ | [trainee@centos8 roles]$ ansible-vault edit group_vars/ | ||
+ | Vault password: fenestros | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important> | ||
+ | **Important** : Notez que le mot de passe **fenestros** ne sera pas en clair. | ||
+ | </ | ||
+ | |||
+ | Le fichier est chargé en mémoire pour édition : | ||
+ | |||
+ | < | ||
+ | --- | ||
+ | secret: gardezlesecret | ||
+ | ~ | ||
+ | ~ | ||
+ | ~ | ||
+ | ~ | ||
+ | ~ | ||
+ | ~ | ||
+ | ~ | ||
+ | ~ | ||
+ | -- INSERT -- | ||
+ | </ | ||
+ | |||
+ | Modifiez le secret et sauvegardez le fichier : | ||
+ | |||
+ | < | ||
+ | --- | ||
+ | secret: gardezlesecret | ||
+ | ~ | ||
+ | ~ | ||
+ | ~ | ||
+ | ~ | ||
+ | ~ | ||
+ | ~ | ||
+ | ~ | ||
+ | ~ | ||
+ | :x | ||
+ | </ | ||
+ | |||
+ | Constatez que le contenu du fichier **/ | ||
+ | |||
+ | < | ||
+ | [trainee@centos8 roles]$ cat / | ||
+ | $ANSIBLE_VAULT; | ||
+ | 36633861376466313363373336643832646663666334633931663262666361306236386232316461 | ||
+ | 3331633863386666626230663038653136653830303465660a353337316634363465663962336365 | ||
+ | 61396430313965653666333738376663336139613566636437353935653232306264336235333538 | ||
+ | 6439366539653436310a666361313237623137666634663439343132393532623962353163303364 | ||
+ | 37626635363832333934363930383265313932663230356234343235643935353535 | ||
+ | </ | ||
+ | |||
+ | Exécutez de nouveau la commande **ansible-playbook** avec l' | ||
+ | |||
+ | < | ||
+ | [trainee@centos8 roles]$ ansible-playbook -i inventory playbook.yaml -l localhost --ask-vault-pass | ||
+ | Vault password: fenestros | ||
+ | |||
+ | PLAY [all] ******************************************************************************************************************************************************************************************************* | ||
+ | |||
+ | TASK [Gathering Facts] ******************************************************************************************************************************************************************************************* | ||
+ | ok: [localhost] | ||
+ | |||
+ | TASK [debug] ***************************************************************************************************************************************************************************************************** | ||
+ | ok: [localhost] => { | ||
+ | " | ||
+ | } | ||
+ | |||
+ | PLAY RECAP ******************************************************************************************************************************************************************************************************* | ||
+ | localhost | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important> | ||
+ | **Important** : Notez que le mot de passe **fenestros** ne sera pas en clair. | ||
+ | </ | ||
+ | |||
+ | ====5.3 - Décrypter le Fichier==== | ||
+ | |||
+ | Il est possible de décrypter le fichier en utilisant la sous-commande **decrypt** de la commande **ansible-vault** : | ||
+ | |||
+ | < | ||
+ | [trainee@centos8 roles]$ ansible-vault decrypt group_vars/ | ||
+ | Vault password: fenestros | ||
+ | Decryption successful | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important> | ||
+ | **Important** : Notez que le mot de passe **fenestros** ne sera pas en clair. | ||
+ | </ | ||
+ | |||
+ | Constatez que le contenu du fichier **/ | ||
+ | |||
+ | < | ||
+ | [trainee@centos8 roles]$ cat / | ||
+ | --- | ||
+ | secret: gardezlesecret | ||
+ | </ | ||
+ | |||
+ | ====5.4 - Utilisation de Mots de Passe Aléatoires==== | ||
+ | |||
+ | Installez le paquet **pwgen** : | ||
+ | |||
+ | < | ||
+ | [trainee@centos8 roles]$ su - | ||
+ | Password: fenestros | ||
+ | [root@centos8 ~]# | ||
+ | |||
+ | [root@centos8 ~]# dnf install https:// | ||
+ | Last metadata expiration check: 1:30:37 ago on Wed 09 Mar 2022 10:10:01 EST. | ||
+ | epel-release-latest-8.noarch.rpm | ||
+ | Dependencies resolved. | ||
+ | ================================================================================================================================================================================================================== | ||
+ | | ||
+ | ================================================================================================================================================================================================================== | ||
+ | Installing: | ||
+ | | ||
+ | |||
+ | Transaction Summary | ||
+ | ================================================================================================================================================================================================================== | ||
+ | Install | ||
+ | |||
+ | Total size: 22 k | ||
+ | Installed size: 32 k | ||
+ | Is this ok [y/N]: y | ||
+ | Downloading Packages: | ||
+ | Running transaction check | ||
+ | Transaction check succeeded. | ||
+ | Running transaction test | ||
+ | Transaction test succeeded. | ||
+ | Running transaction | ||
+ | Preparing | ||
+ | Installing | ||
+ | Running scriptlet: epel-release-8-14.el8.noarch | ||
+ | Verifying | ||
+ | Installed products updated. | ||
+ | |||
+ | Installed: | ||
+ | epel-release-8-14.el8.noarch | ||
+ | |||
+ | Complete! | ||
+ | |||
+ | [root@centos8 ~]# dnf install pwgen | ||
+ | Extra Packages for Enterprise Linux 8 - x86_64 | ||
+ | Extra Packages for Enterprise Linux Modular 8 - x86_64 | ||
+ | Last metadata expiration check: 0:00:01 ago on Wed 09 Mar 2022 11:41:14 EST. | ||
+ | Dependencies resolved. | ||
+ | ================================================================================================================================================================================================================== | ||
+ | | ||
+ | ================================================================================================================================================================================================================== | ||
+ | Installing: | ||
+ | | ||
+ | |||
+ | Transaction Summary | ||
+ | ================================================================================================================================================================================================================== | ||
+ | Install | ||
+ | |||
+ | Total download size: 31 k | ||
+ | Installed size: 46 k | ||
+ | Is this ok [y/N]: y | ||
+ | |||
+ | [root@centos8 ~]# exit | ||
+ | logout | ||
+ | [trainee@centos8 roles]$ | ||
+ | </ | ||
+ | |||
+ | Utilisez maintenant la commande **pwgen** pour générer un mot de passe aléatoire : | ||
+ | |||
+ | < | ||
+ | [trainee@centos8 roles]$ pwgen 16 1 | ||
+ | di3Be1AiPayeehai | ||
+ | </ | ||
+ | |||
+ | Utilisez pwgen pour créer un mot de passe aléatoire contenu dans un fichier : | ||
+ | |||
+ | < | ||
+ | [trainee@centos8 roles]$ pwgen 16 1 > vault-password | ||
+ | |||
+ | [trainee@centos8 roles]$ ls | ||
+ | backend.j2 | ||
+ | |||
+ | [trainee@centos8 roles]$ cat vault-password | ||
+ | oo3aeph5PaiVeiBu | ||
+ | </ | ||
+ | |||
+ | Utilisez maintenant le mot de passe aléatoire contenu dans le fichier **vault-password** pour crypter le fichier **/ | ||
+ | |||
+ | < | ||
+ | [trainee@centos8 roles]$ ansible-vault encrypt group_vars/ | ||
+ | Encryption successful | ||
+ | </ | ||
+ | |||
+ | Constatez le contenu du fichier **/ | ||
+ | |||
+ | < | ||
+ | [trainee@centos8 roles]$ cat group_vars/ | ||
+ | $ANSIBLE_VAULT; | ||
+ | 61326364653334653935643735623863353362333536396638356362376631633732306332316661 | ||
+ | 6662333436336237346433363637393666623165643438620a343436366136386637343238303063 | ||
+ | 38383866386631363834623461323334313030623136333334646335626165363263373966373663 | ||
+ | 3137333330653635620a396133346264656335633530353966383930613731626639393631623066 | ||
+ | 31323331383563373830306331653166326563333135326631363461313666313864 | ||
+ | </ | ||
+ | |||
+ | Exécutez de nouveau la commande **ansible-playbook** avec l' | ||
+ | |||
+ | < | ||
+ | [trainee@centos8 roles]$ ansible-playbook -i inventory playbook.yaml -l localhost --vault-password-file vault-password | ||
+ | |||
+ | PLAY [all] ******************************************************************************************************************************************************************************************************* | ||
+ | |||
+ | TASK [Gathering Facts] ******************************************************************************************************************************************************************************************* | ||
+ | ok: [localhost] | ||
+ | |||
+ | TASK [debug] ***************************************************************************************************************************************************************************************************** | ||
+ | ok: [localhost] => { | ||
+ | " | ||
+ | } | ||
+ | |||
+ | PLAY RECAP ******************************************************************************************************************************************************************************************************* | ||
+ | localhost | ||
+ | </ | ||
+ | |||
----- | ----- | ||
- | < | + | |
- | <div align=" | + | Copyright © 2023 Hugh Norris. |
- | Copyright © 2019 Hugh NORRIS | + | |
- | </ | + | |
- | </ | + |