Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
elearning:workbooks:debian:6:avance:l130:part2 [2021/05/17 12:04] adminelearning:workbooks:debian:6:avance:l130:part2 [2023/08/25 01:28] (Version actuelle) admin
Ligne 1: Ligne 1:
 ~~PDF:LANDSCAPE~~ ~~PDF:LANDSCAPE~~
  
-Version : **2021.01**+Version : **2023.02**
  
 Dernière mise-à-jour : ~~LASTMOD~~ Dernière mise-à-jour : ~~LASTMOD~~
  
-====== DOF502 - Les Commandes ansible, ansible-playbook et ansible-galaxy======+====== LCF802 - Les Commandes ansible, ansible-playbook et ansible-galaxy======
  
 =====Contenu du Module===== =====Contenu du Module=====
  
-  * **DOF502 - Les Commandes ansible, ansible-playbook et ansible-galaxy**+  * **LCF802 - Les Commandes ansible, ansible-playbook et ansible-galaxy**
     * Contenu du Module     * Contenu du Module
     * LAB #1 - Débuter avec Ansible     * LAB #1 - Débuter avec Ansible
Ligne 35: Ligne 35:
  
 <code> <code>
-trainee@ansible:~$ ansible all -i 10.0.2.52, -m ping +[trainee@centos8 ~]$ ansible all -i 10.0.2.52, -m ping
-/home/trainee/.local/lib/python3.5/site-packages/ansible/parsing/vault/__init__.py:44: CryptographyDeprecationWarning: Python 3.5 support will be dropped in the next release of cryptography. Please upgrade your Python. +
-  from cryptography.exceptions import InvalidSignature +
-[DEPRECATION WARNING]: Distribution debian 9.7 on host 10.0.2.52 should use /usr/bin/python3, but is using /usr/bin/python for backward compatibility  +
-with prior Ansible releases. A future Ansible release will default to using the discovered platform python for this host. See  +
-https://docs.ansible.com/ansible/2.10/reference_appendices/interpreter_discovery.html for more information. This feature will be removed in version  +
-2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.+
 10.0.2.52 | SUCCESS => { 10.0.2.52 | SUCCESS => {
     "ansible_facts": {     "ansible_facts": {
Ligne 51: Ligne 45:
 </code> </code>
    
-<WRAP center round important 60%>+<WRAP center round important>
 **Important** : Cette commande indique à Ansible qu'elle doit exécuter le module indiqué par l'option **-m** dans **tous** (//all//) les serveurs indiqués par l'option **-i**. La virgule placée après l'adresse IP indique à la commande ansible que la valeur est une adresse IP et non le nom d'un fichier. **Important** : Cette commande indique à Ansible qu'elle doit exécuter le module indiqué par l'option **-m** dans **tous** (//all//) les serveurs indiqués par l'option **-i**. La virgule placée après l'adresse IP indique à la commande ansible que la valeur est une adresse IP et non le nom d'un fichier.
 </WRAP> </WRAP>
Ligne 58: Ligne 52:
  
 <code> <code>
-trainee@ansible:~$ ansible --help +[trainee@centos8 ~]$ ansible --help
-/home/trainee/.local/lib/python3.5/site-packages/ansible/parsing/vault/__init__.py:44: CryptographyDeprecationWarning: Python 3.5 support will be dropped in the next release of cryptography. Please upgrade your Python. +
-  from cryptography.exceptions import InvalidSignature+
 usage: ansible [-h] [--version] [-v] [-b] [--become-method BECOME_METHOD] usage: ansible [-h] [--version] [-v] [-b] [--become-method BECOME_METHOD]
                [--become-user BECOME_USER] [-K] [-i INVENTORY] [--list-hosts]                [--become-user BECOME_USER] [-K] [-i INVENTORY] [--list-hosts]
Ligne 73: Ligne 65:
                [--ask-vault-password | --vault-password-file VAULT_PASSWORD_FILES]                [--ask-vault-password | --vault-password-file VAULT_PASSWORD_FILES]
                [-f FORKS] [-M MODULE_PATH] [--playbook-dir BASEDIR]                [-f FORKS] [-M MODULE_PATH] [--playbook-dir BASEDIR]
-               [-a MODULE_ARGS] [-m MODULE_NAME]+               [--task-timeout TASK_TIMEOUT] [-a MODULE_ARGS] [-m MODULE_NAME]
                pattern                pattern
  
Ligne 93: Ligne 85:
   --syntax-check        perform a syntax check on the playbook, but do not   --syntax-check        perform a syntax check on the playbook, but do not
                         execute it                         execute it
 +  --task-timeout TASK_TIMEOUT
 +                        set task timeout limit in seconds, must be positive
 +                        integer.
   --vault-id VAULT_IDS  the vault identity to use   --vault-id VAULT_IDS  the vault identity to use
   --vault-password-file VAULT_PASSWORD_FILES, --vault-pass-file VAULT_PASSWORD_FILES   --vault-password-file VAULT_PASSWORD_FILES, --vault-pass-file VAULT_PASSWORD_FILES
Ligne 113: Ligne 108:
                         set the poll interval if using -B (default=15)                         set the poll interval if using -B (default=15)
   -a MODULE_ARGS, --args MODULE_ARGS   -a MODULE_ARGS, --args MODULE_ARGS
-                        module arguments+                        The action's options in space separated k=v format: -a 
 +                        'opt1=val1 opt2=val2'
   -e EXTRA_VARS, --extra-vars EXTRA_VARS   -e EXTRA_VARS, --extra-vars EXTRA_VARS
                         set additional variables as key=value or YAML/JSON, if                         set additional variables as key=value or YAML/JSON, if
Ligne 127: Ligne 123:
                         further limit selected hosts to an additional pattern                         further limit selected hosts to an additional pattern
   -m MODULE_NAME, --module-name MODULE_NAME   -m MODULE_NAME, --module-name MODULE_NAME
-                        module name to execute (default=command)+                        Name of the action to execute (default=command)
   -o, --one-line        condense output   -o, --one-line        condense output
   -t TREE, --tree TREE  log output to this directory   -t TREE, --tree TREE  log output to this directory
Ligne 170: Ligne 166:
                         connect as this user (default=None)                         connect as this user (default=None)
  
-Some modules do not make sense in Ad-Hoc (include, meta, etc)+Some actions do not make sense in Ad-Hoc (include, meta, etc)
 </code> </code>
  
-Les quatre machines virtuelles **WebXX** mises à votre disposition sont dans le même réseau que la machine Ansible et ont la même configuration ssh et sudo que la machine **TargetA** :+Les quatre machines **WebXX** mises à votre disposition sont dans le même réseau que la machine centos8 et ont la même configuration ssh et sudo que la machine **debian10** :
  
 ^ Machine ^ Nom d'hôte ^ Adresse IP ^ ^ Machine ^ Nom d'hôte ^ Adresse IP ^
Ligne 184: Ligne 180:
  
 <code> <code>
-trainee@ansible:~$ scp .ssh/authorized_keys trainee@web01.i2tch.loc:/home/trainee/.ssh/authorized_keys +[trainee@centos8 ~]$ scp .ssh/authorized_keys trainee@10.0.2.54:/home/trainee/.ssh/authorized_keys 
-The authenticity of host 'web01.i2tch.loc (10.0.2.54)' can't be established.+The authenticity of host '10.0.2.54 (10.0.2.54)' can't be established.
 ECDSA key fingerprint is SHA256:sEfHBv9azmK60cjqF/aJgUc9jg56slNaZQdAUcvBOvE. ECDSA key fingerprint is SHA256:sEfHBv9azmK60cjqF/aJgUc9jg56slNaZQdAUcvBOvE.
-Are you sure you want to continue connecting (yes/no)? yes +Are you sure you want to continue connecting (yes/no/[fingerprint])? yes 
-Warning: Permanently added 'web01.i2tch.loc,10.0.2.54' (ECDSA) to the list of known hosts.+Warning: Permanently added '10.0.2.54' (ECDSA) to the list of known hosts.
 Debian GNU/Linux 9 Debian GNU/Linux 9
-trainee@web01.i2tch.loc's password:  +trainee@10.0.2.54's password: trainee 
-authorized_keys                                                                                                       100%  701     1.7MB/s   00:00     +authorized_keys                                                                                                                                                                 100%  888     1.8MB/s   00:00  
-trainee@ansible:~$ scp .ssh/authorized_keys trainee@web02.i2tch.loc:/home/trainee/.ssh/authorized_keys +    
-The authenticity of host 'web02.i2tch.loc (10.0.2.55)' can't be established.+[trainee@centos8 ~]$ scp .ssh/authorized_keys trainee@10.0.2.55:/home/trainee/.ssh/authorized_keys 
 +The authenticity of host '10.0.2.55 (10.0.2.55)' can't be established.
 ECDSA key fingerprint is SHA256:sEfHBv9azmK60cjqF/aJgUc9jg56slNaZQdAUcvBOvE. ECDSA key fingerprint is SHA256:sEfHBv9azmK60cjqF/aJgUc9jg56slNaZQdAUcvBOvE.
-Are you sure you want to continue connecting (yes/no)? yes +Are you sure you want to continue connecting (yes/no/[fingerprint])? yes 
-Warning: Permanently added 'web02.i2tch.loc,10.0.2.55' (ECDSA) to the list of known hosts.+Warning: Permanently added '10.0.2.55' (ECDSA) to the list of known hosts.
 Debian GNU/Linux 9 Debian GNU/Linux 9
-trainee@web02.i2tch.loc's password:  +trainee@10.0.2.55's password: trainee 
-authorized_keys                                                                                                       100%  701     1.8MB/s   00:00     +authorized_keys                                                                                                                                                                 100%  888     2.1MB/s   00:00  
-trainee@ansible:~$ scp .ssh/authorized_keys trainee@web03.i2tch.loc:/home/trainee/.ssh/authorized_keys +    
-The authenticity of host 'web03.i2tch.loc (10.0.2.56)' can't be established.+[trainee@centos8 ~]$ scp .ssh/authorized_keys trainee@10.0.2.56:/home/trainee/.ssh/authorized_keys 
 +The authenticity of host '10.0.2.56 (10.0.2.56)' can't be established.
 ECDSA key fingerprint is SHA256:sEfHBv9azmK60cjqF/aJgUc9jg56slNaZQdAUcvBOvE. ECDSA key fingerprint is SHA256:sEfHBv9azmK60cjqF/aJgUc9jg56slNaZQdAUcvBOvE.
-Are you sure you want to continue connecting (yes/no)? yes +Are you sure you want to continue connecting (yes/no/[fingerprint])? yes 
-Warning: Permanently added 'web03.i2tch.loc,10.0.2.56' (ECDSA) to the list of known hosts.+Warning: Permanently added '10.0.2.56' (ECDSA) to the list of known hosts.
 Debian GNU/Linux 9 Debian GNU/Linux 9
-trainee@web03.i2tch.loc's password:  +trainee@10.0.2.56's password: trainee 
-authorized_keys                                                                                                       100%  701     1.6MB/s   00:00     +authorized_keys                                                                                                                                                                 100%  888     1.7MB/s   00:00     
-trainee@ansible:~$ scp .ssh/authorized_keys trainee@web04.i2tch.loc:/home/trainee/.ssh/authorized_keys + 
-The authenticity of host 'web04.i2tch.loc (10.0.2.57)' can't be established.+[trainee@centos8 ~]$ scp .ssh/authorized_keys trainee@10.0.2.57:/home/trainee/.ssh/authorized_keys 
 +The authenticity of host '10.0.2.57 (10.0.2.57)' can't be established.
 ECDSA key fingerprint is SHA256:sEfHBv9azmK60cjqF/aJgUc9jg56slNaZQdAUcvBOvE. ECDSA key fingerprint is SHA256:sEfHBv9azmK60cjqF/aJgUc9jg56slNaZQdAUcvBOvE.
-Are you sure you want to continue connecting (yes/no)? yes +Are you sure you want to continue connecting (yes/no/[fingerprint])? yes 
-Warning: Permanently added 'web04.i2tch.loc,10.0.2.57' (ECDSA) to the list of known hosts.+Warning: Permanently added '10.0.2.57' (ECDSA) to the list of known hosts.
 Debian GNU/Linux 9 Debian GNU/Linux 9
-trainee@web04.i2tch.loc's password:  +trainee@10.0.2.57's password: trainee 
-authorized_keys                                                                                                       100%  701     2.0MB/s   00:00 +authorized_keys                                                                                                                                                                 100%  888     1.3MB/s   00:00
 </code> </code>
  
-Vérifiez que vous pouvez vous connecter aux machines virtuelles **Web01****Web02**, **Web03** et **Web04** sans entrer de mot de passe :+Modifier le fichier **/etc/hosts** dans **centos8** :
  
 <code> <code>
-trainee@ansible:~$ ssh -l trainee web01 +[trainee@centos8 ~]su 
-The authenticity of host 'web01 (10.0.2.54)' can't be established+Password: fenestros 
-ECDSA key fingerprint is SHA256:sEfHBv9azmK60cjqF/aJgUc9jg56slNaZQdAUcvBOvE+[root@centos8 ~]# vi /etc/hosts 
-Are you sure you want to continue connecting (yes/no)? yes +[root@centos8 ~]# cat /etc/hosts 
-WarningPermanently added 'web01' (ECDSA) to the list of known hosts.+127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4 
 +::1         localhost localhost.localdomain localhost6 localhost6.localdomain6 
 +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 
 +[root@centos8 ~]# exit 
 +logout 
 +[trainee@centos8 ~]$ 
 +</code> 
 + 
 +Vérifiez que vous pouvez vous connecter aux machines virtuelles **Web01**, **Web02**, **Web03** et **Web04** sans entrer de mot de passe et que la configuration de sudo est correcte : 
 + 
 +<code> 
 +[trainee@centos8 ~]$ ssh -l trainee web01
 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 235: 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: Sun Mar 21 13:35:36 2021 from 10.0.2.17+Last login: Wed Mar  9 11:47:41 2022 from 10.0.2.45 
 +trainee@web01:~$ sudo apt update 
 +Réception de:1 http://security.debian.org/debian-security stretch/updates InRelease [53,0 kB] 
 +Ign:2 http://ftp.fr.debian.org/debian stretch InRelease                              
 +Réception de:3 http://ftp.fr.debian.org/debian stretch-updates InRelease [93,6 kB] 
 +Réception de:4 http://ftp.fr.debian.org/debian stretch Release [118 kB] 
 +Réception de:5 http://ftp.fr.debian.org/debian stretch Release.gpg [3 177 B] 
 +Réception de:6 http://security.debian.org/debian-security stretch/updates/main Sources [396 kB] 
 +Réception de:7 http://security.debian.org/debian-security stretch/updates/main amd64 Packages [759 kB] 
 +Réception de:8 http://security.debian.org/debian-security stretch/updates/main Translation-en [354 kB] 
 +Réception de:9 http://ftp.fr.debian.org/debian stretch/main Sources [6 736 kB]        
 +Réception de:10 http://ftp.fr.debian.org/debian stretch/main amd64 Packages [7 080 kB] 
 +Réception de:11 http://ftp.fr.debian.org/debian stretch/main Translation-en [5 377 kB] 
 +21,0 Mo réceptionnés en 32s (638 ko/s)                                                                                                                                                                            
 +Lecture des listes de paquets... Fait 
 +Construction de l'arbre des dépendances        
 +Lecture des informations d'état... Fait 
 +341 packages can be upgraded. Run 'apt list --upgradable' to see them.
 trainee@web01:~$ exit trainee@web01:~$ exit
 déconnexion déconnexion
 Connection to web01 closed. Connection to web01 closed.
-trainee@ansible:~$ ssh -l trainee web02 +[trainee@centos8 ~]$ ssh -l trainee web02
-The authenticity of host 'web02 (10.0.2.55)' can't be established. +
-ECDSA key fingerprint is SHA256:sEfHBv9azmK60cjqF/aJgUc9jg56slNaZQdAUcvBOvE. +
-Are you sure you want to continue connecting (yes/no)? yes +
-Warning: Permanently added 'web02' (ECDSA) to the list of known hosts.+
 Debian GNU/Linux 9 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 Linux web02.i2tch.loc 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64
Ligne 253: Ligne 280:
 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: Sun Mar 21 13:36:36 2021 from 10.0.2.17+Last login: Wed Mar  9 11:40:49 2022 from 10.0.2.45 
 +trainee@web02:~$ sudo apt update 
 +Réception de:1 http://security.debian.org/debian-security stretch/updates InRelease [53,0 kB] 
 +Ign:2 http://ftp.fr.debian.org/debian stretch InRelease                         
 +Réception de:3 http://ftp.fr.debian.org/debian stretch-updates InRelease [93,6 kB] 
 +Réception de:4 http://ftp.fr.debian.org/debian stretch Release [118 kB] 
 +Réception de:5 http://ftp.fr.debian.org/debian stretch Release.gpg [3 177 B] 
 +Réception de:6 http://security.debian.org/debian-security stretch/updates/main Sources [396 kB] 
 +Réception de:7 http://security.debian.org/debian-security stretch/updates/main amd64 Packages [759 kB] 
 +Réception de:8 http://security.debian.org/debian-security stretch/updates/main Translation-en [354 kB] 
 +Réception de:9 http://ftp.fr.debian.org/debian stretch/main Sources [6 736 kB]        
 +Réception de:10 http://ftp.fr.debian.org/debian stretch/main amd64 Packages [7 080 kB] 
 +Réception de:11 http://ftp.fr.debian.org/debian stretch/main Translation-en [5 377 kB] 
 +21,0 Mo réceptionnés en 32s (639 ko/s)                                                                                                                                                                            
 +Lecture des listes de paquets... Fait 
 +Construction de l'arbre des dépendances        
 +Lecture des informations d'état... Fait 
 +341 packages can be upgraded. Run 'apt list --upgradable' to see them.
 trainee@web02:~$ exit trainee@web02:~$ exit
 déconnexion déconnexion
 Connection to web02 closed. Connection to web02 closed.
-trainee@ansible:~$ ssh -l trainee web03 +[trainee@centos8 ~]$ ssh -l trainee web03
-The authenticity of host 'web03 (10.0.2.56)' can't be established. +
-ECDSA key fingerprint is SHA256:sEfHBv9azmK60cjqF/aJgUc9jg56slNaZQdAUcvBOvE. +
-Are you sure you want to continue connecting (yes/no)? yes +
-Warning: Permanently added 'web03' (ECDSA) to the list of known hosts.+
 Debian GNU/Linux 9 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 Linux web03.i2tch.loc 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64
Ligne 271: Ligne 311:
 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: Sun Mar 21 13:37:09 2021 from 10.0.2.17+Last login: Wed Mar  9 11:40:49 2022 from 10.0.2.45 
 +trainee@web03:~$ sudo apt update 
 +Réception de:1 http://security.debian.org/debian-security stretch/updates InRelease [53,0 kB] 
 +Ign:2 http://ftp.fr.debian.org/debian stretch InRelease                         
 +Réception de:3 http://ftp.fr.debian.org/debian stretch-updates InRelease [93,6 kB] 
 +Réception de:4 http://ftp.fr.debian.org/debian stretch Release [118 kB] 
 +Réception de:5 http://ftp.fr.debian.org/debian stretch Release.gpg [3 177 B] 
 +Réception de:6 http://security.debian.org/debian-security stretch/updates/main Sources [396 kB] 
 +Réception de:7 http://security.debian.org/debian-security stretch/updates/main amd64 Packages [759 kB] 
 +Réception de:8 http://security.debian.org/debian-security stretch/updates/main Translation-en [354 kB] 
 +Réception de:9 http://ftp.fr.debian.org/debian stretch/main Sources [6 736 kB]        
 +Réception de:10 http://ftp.fr.debian.org/debian stretch/main amd64 Packages [7 080 kB] 
 +Réception de:11 http://ftp.fr.debian.org/debian stretch/main Translation-en [5 377 kB] 
 +21,0 Mo réceptionnés en 40s (524 ko/s)                                                                                                                                                                            
 +Lecture des listes de paquets... Fait 
 +Construction de l'arbre des dépendances        
 +Lecture des informations d'état... Fait 
 +341 packages can be upgraded. Run 'apt list --upgradable' to see them.
 trainee@web03:~$ exit trainee@web03:~$ exit
 déconnexion déconnexion
 Connection to web03 closed. Connection to web03 closed.
-trainee@ansible:~$ ssh -l trainee web04 +[trainee@centos8 ~]$ ssh -l trainee web04
-The authenticity of host 'web04 (10.0.2.57)' can't be established. +
-ECDSA key fingerprint is SHA256:sEfHBv9azmK60cjqF/aJgUc9jg56slNaZQdAUcvBOvE. +
-Are you sure you want to continue connecting (yes/no)? yes +
-Warning: Permanently added 'web04' (ECDSA) to the list of known hosts.+
 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 289: Ligne 342:
 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: Sun Mar 21 13:37:51 2021 from 10.0.2.17+Last login: Wed Mar  9 11:40:49 2022 from 10.0.2.45 
 +trainee@web04:~$ sudo apt update 
 +Réception de:1 http://security.debian.org/debian-security stretch/updates InRelease [53,0 kB] 
 +Ign:2 http://ftp.fr.debian.org/debian stretch InRelease           
 +Réception de:3 http://ftp.fr.debian.org/debian stretch-updates InRelease [93,6 kB] 
 +Réception de:4 http://ftp.fr.debian.org/debian stretch Release [118 kB] 
 +Réception de:5 http://ftp.fr.debian.org/debian stretch Release.gpg [3 177 B] 
 +Réception de:6 http://security.debian.org/debian-security stretch/updates/main Sources [396 kB] 
 +Réception de:7 http://ftp.fr.debian.org/debian stretch/main Sources [6 736 kB] 
 +Réception de:8 http://security.debian.org/debian-security stretch/updates/main amd64 Packages [759 kB] 
 +Réception de:9 http://ftp.fr.debian.org/debian stretch/main amd64 Packages [7 080 kB]         
 +Réception de:10 http://security.debian.org/debian-security stretch/updates/main Translation-en [354 kB] 
 +Réception de:11 http://ftp.fr.debian.org/debian stretch/main Translation-en [5 377 kB]             
 +21,0 Mo réceptionnés en 39s (535 ko/s)                                                                                                                                                                            
 +Lecture des listes de paquets... Fait 
 +Construction de l'arbre des dépendances        
 +Lecture des informations d'état... Fait 
 +341 packages can be upgraded. Run 'apt list --upgradable' to see them.
 trainee@web04:~$ exit trainee@web04:~$ exit
 déconnexion déconnexion
 Connection to web04 closed. Connection to web04 closed.
 +[trainee@centos8 ~]$
 </code> </code>
  
-Utilisez ensuite la commende **ansible** avec le module **ping** :+Utilisez ensuite la commande **ansible** avec le module **ping** :
  
 <code> <code>
-trainee@ansible:~$ ansible all -i web01, -m ping +[trainee@centos8 ~]$ ansible all -i 10.0.2.54, -m ping 
-/home/trainee/.local/lib/python3.5/site-packages/ansible/parsing/vault/__init__.py:44: CryptographyDeprecationWarning: Python 3.5 support will be dropped in the next release of cryptography. Please upgrade your Python. +10.0.2.54 | SUCCESS => {
-  from cryptography.exceptions import InvalidSignature +
-[DEPRECATION WARNING]: Distribution debian 9.7 on host web01 should use /usr/bin/python3, but is using /usr/bin/python for backward compatibility with  +
-prior Ansible releases. A future Ansible release will default to using the discovered platform python for this host. See  +
-https://docs.ansible.com/ansible/2.10/reference_appendices/interpreter_discovery.html for more informationThis feature will be removed in version  +
-2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg. +
-web01 | SUCCESS => {+
     "ansible_facts": {     "ansible_facts": {
         "discovered_interpreter_python": "/usr/bin/python"         "discovered_interpreter_python": "/usr/bin/python"
Ligne 312: Ligne 377:
     "ping": "pong"     "ping": "pong"
 } }
-trainee@ansible:~$ ansible all -i web02, -m ping +[trainee@centos8 ~]$ ansible all -i 10.0.2.55, -m ping 
-/home/trainee/.local/lib/python3.5/site-packages/ansible/parsing/vault/__init__.py:44: CryptographyDeprecationWarning: Python 3.5 support will be dropped in the next release of cryptography. Please upgrade your Python. +10.0.2.55 | SUCCESS => {
-  from cryptography.exceptions import InvalidSignature +
-[DEPRECATION WARNING]: Distribution debian 9.7 on host web02 should use /usr/bin/python3, but is using /usr/bin/python for backward compatibility with  +
-prior Ansible releases. A future Ansible release will default to using the discovered platform python for this host. See  +
-https://docs.ansible.com/ansible/2.10/reference_appendices/interpreter_discovery.html for more information. This feature will be removed in version  +
-2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg. +
-web02 | SUCCESS => { +
-    "ansible_facts":+
-        "discovered_interpreter_python": "/usr/bin/python" +
-    }, +
-    "changed": false, +
-    "ping": "pong" +
-+
-trainee@ansible:~$ ansible all -i web03, -m ping +
-/home/trainee/.local/lib/python3.5/site-packages/ansible/parsing/vault/__init__.py:44: CryptographyDeprecationWarning: Python 3.5 support will be dropped in the next release of cryptography. Please upgrade your Python. +
-  from cryptography.exceptions import InvalidSignature +
-[DEPRECATION WARNING]: Distribution debian 9.7 on host web03 should use /usr/bin/python3, but is using /usr/bin/python for backward compatibility with  +
-prior Ansible releases. A future Ansible release will default to using the discovered platform python for this host. See  +
-https://docs.ansible.com/ansible/2.10/reference_appendices/interpreter_discovery.html for more informationThis feature will be removed in version  +
-2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg. +
-web03 | SUCCESS => { +
-    "ansible_facts":+
-        "discovered_interpreter_python": "/usr/bin/python" +
-    }, +
-    "changed": false, +
-    "ping": "pong" +
-+
-trainee@ansible:~$ ansible all -i web04, -m ping +
-/home/trainee/.local/lib/python3.5/site-packages/ansible/parsing/vault/__init__.py:44: CryptographyDeprecationWarning: Python 3.5 support will be dropped in the next release of cryptography. Please upgrade your Python. +
-  from cryptography.exceptions import InvalidSignature +
-[DEPRECATION WARNING]: Distribution debian 9.7 on host web04 should use /usr/bin/python3, but is using /usr/bin/python for backward compatibility with  +
-prior Ansible releases. A future Ansible release will default to using the discovered platform python for this host. See  +
-https://docs.ansible.com/ansible/2.10/reference_appendices/interpreter_discovery.html for more informationThis feature will be removed in version  +
-2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg. +
-web04 | SUCCESS => {+
     "ansible_facts": {     "ansible_facts": {
         "discovered_interpreter_python": "/usr/bin/python"         "discovered_interpreter_python": "/usr/bin/python"
Ligne 359: Ligne 390:
  
 <code> <code>
-trainee@ansible:~$ ansible all -i web01,web02,web03,web04 -m ping +[trainee@centos8 ~]$ ansible all -i web01,web02,web03,web04 -m ping 
-/home/trainee/.local/lib/python3.5/site-packages/ansible/parsing/vault/__init__.py:44: CryptographyDeprecationWarning: Python 3.5 support will be dropped in the next release of cryptography. Please upgrade your Python. +web02 | SUCCESS => {
-  from cryptography.exceptions import InvalidSignature +
-[DEPRECATION WARNING]: Distribution debian 9.7 on host web03 should use /usr/bin/python3, but is using /usr/bin/python for backward compatibility with  +
-prior Ansible releases. A future Ansible release will default to using the discovered platform python for this host. See  +
-https://docs.ansible.com/ansible/2.10/reference_appendices/interpreter_discovery.html for more information. This feature will be removed in version  +
-2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg. +
-web03 | SUCCESS => {+
     "ansible_facts": {     "ansible_facts": {
         "discovered_interpreter_python": "/usr/bin/python"         "discovered_interpreter_python": "/usr/bin/python"
Ligne 373: Ligne 398:
     "ping": "pong"     "ping": "pong"
 } }
-[DEPRECATION WARNING]: Distribution debian 9.7 on host web01 should use /usr/bin/python3, but is using /usr/bin/python for backward compatibility with  
-prior Ansible releases. A future Ansible release will default to using the discovered platform python for this host. See  
-https://docs.ansible.com/ansible/2.10/reference_appendices/interpreter_discovery.html for more information. This feature will be removed in version  
-2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg. 
 web01 | SUCCESS => { web01 | SUCCESS => {
     "ansible_facts": {     "ansible_facts": {
Ligne 384: Ligne 405:
     "ping": "pong"     "ping": "pong"
 } }
-[DEPRECATION WARNING]: Distribution debian 9.7 on host web04 should use /usr/bin/python3, but is using /usr/bin/python for backward compatibility with  +web03 | SUCCESS => {
-prior Ansible releases. A future Ansible release will default to using the discovered platform python for this host. See  +
-https://docs.ansible.com/ansible/2.10/reference_appendices/interpreter_discovery.html for more information. This feature will be removed in version  +
-2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg. +
-web04 | SUCCESS => {+
     "ansible_facts": {     "ansible_facts": {
         "discovered_interpreter_python": "/usr/bin/python"         "discovered_interpreter_python": "/usr/bin/python"
Ligne 395: Ligne 412:
     "ping": "pong"     "ping": "pong"
 } }
-[DEPRECATION WARNING]: Distribution debian 9.7 on host web02 should use /usr/bin/python3, but is using /usr/bin/python for backward compatibility with  +web04 | SUCCESS => {
-prior Ansible releases. A future Ansible release will default to using the discovered platform python for this host. See  +
-https://docs.ansible.com/ansible/2.10/reference_appendices/interpreter_discovery.html for more information. This feature will be removed in version  +
-2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg. +
-web02 | SUCCESS => {+
     "ansible_facts": {     "ansible_facts": {
         "discovered_interpreter_python": "/usr/bin/python"         "discovered_interpreter_python": "/usr/bin/python"
Ligne 408: Ligne 421:
 </code> </code>
  
-<WRAP center round important 60%>+<WRAP center round important>
 **Important** : Notez que les résultats ne sont pas retournés dans un ordre séquentiel par rapport à la commande exécutée. En effet, ansible a paralléliser l'exécution des commandes. **Important** : Notez que les résultats ne sont pas retournés dans un ordre séquentiel par rapport à la commande exécutée. En effet, ansible a paralléliser l'exécution des commandes.
 </WRAP> </WRAP>
Ligne 415: Ligne 428:
  
 <code> <code>
-trainee@ansible:~$ ansible all -i web01,web02,web03,web04 -m command --args 'uptime' +[trainee@centos8 ~]$ ansible all -i web01,web02,web03,web04 -m command --args 'uptime' 
-/home/trainee/.local/lib/python3.5/site-packages/ansible/parsing/vault/__init__.py:44CryptographyDeprecationWarningPython 3.5 support will be dropped in the next release of cryptography. Please upgrade your Python. +web02 | CHANGED | rc=0 >> 
-  from cryptography.exceptions import InvalidSignature + 11:40:49 up 18:26,  1 user,  load average0,24, 0,11, 0,03
-[DEPRECATION WARNING]Distribution debian 9.7 on host web03 should use /usr/bin/python3but is using /usr/bin/python for backward compatibility with  +
-prior Ansible releases. A future Ansible release will default to using the discovered platform python for this host. See  +
-https://docs.ansible.com/ansible/2.10/reference_appendices/interpreter_discovery.html for more information. This feature will be removed in version  +
-2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.+
 web03 | CHANGED | rc=0 >> web03 | CHANGED | rc=0 >>
- 11:59:28 up  1:03,  1 user,  load average: 0,04, 0,01, 0,00 + 11:40:49 up 18:26,  1 user,  load average: 0,10, 0,03, 0,01
-[DEPRECATION WARNING]: Distribution debian 9.7 on host web01 should use /usr/bin/python3, but is using /usr/bin/python for backward compatibility with  +
-prior Ansible releases. A future Ansible release will default to using the discovered platform python for this host. See  +
-https://docs.ansible.com/ansible/2.10/reference_appendices/interpreter_discovery.html for more information. This feature will be removed in version  +
-2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.+
 web01 | CHANGED | rc=0 >> web01 | CHANGED | rc=0 >>
- 11:59:28 up  1:03,  1 user,  load average: 0,00, 0,00, 0,00 + 11:40:49 up 18:26,  1 user,  load average: 0,00, 0,00, 0,00
-[DEPRECATION WARNING]: Distribution debian 9.7 on host web02 should use /usr/bin/python3, but is using /usr/bin/python for backward compatibility with  +
-prior Ansible releases. A future Ansible release will default to using the discovered platform python for this host. See  +
-https://docs.ansible.com/ansible/2.10/reference_appendices/interpreter_discovery.html for more information. This feature will be removed in version  +
-2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg. +
-web02 | CHANGED | rc=0 >> +
- 11:59:28 up  1:03,  1 user,  load average: 0,04, 0,03, 0,00 +
-[DEPRECATION WARNING]: Distribution debian 9.7 on host web04 should use /usr/bin/python3, but is using /usr/bin/python for backward compatibility with  +
-prior Ansible releases. A future Ansible release will default to using the discovered platform python for this host. See  +
-https://docs.ansible.com/ansible/2.10/reference_appendices/interpreter_discovery.html for more information. This feature will be removed in version  +
-2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.+
 web04 | CHANGED | rc=0 >> web04 | CHANGED | rc=0 >>
- 11:59:28 up  1:02,  1 user,  load average: 0,00, 0,00, 0,00+ 11:40:49 up 18:26,  1 user,  load average: 0,00, 0,00, 0,00
 </code> </code>
- 
-Exécutez ensuite une commande pour installer **apache2** dans les machines web01, web02, web03 et web04 en utilisant le module **command**. Vous devez voire la confirmation que le paquet a déjà été installé - **apache2 is already the newest version** : 
- 
-<code> 
-trainee@ansible:~$ ansible all -i web01,web02,web03,web04 -m command --args 'sudo apt-get install -y apache2' 
-/home/trainee/.local/lib/python3.5/site-packages/ansible/parsing/vault/__init__.py:44: CryptographyDeprecationWarning: Python 3.5 support will be dropped in the next release of cryptography. Please upgrade your Python. 
-  from cryptography.exceptions import InvalidSignature 
-[WARNING]: Consider using 'become', 'become_method', and 'become_user' rather than running sudo 
-[DEPRECATION WARNING]: Distribution debian 9.7 on host web04 should use /usr/bin/python3, but is using /usr/bin/python for backward compatibility with  
-prior Ansible releases. A future Ansible release will default to using the discovered platform python for this host. See  
-https://docs.ansible.com/ansible/2.10/reference_appendices/interpreter_discovery.html for more information. This feature will be removed in version  
-2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg. 
-web04 | CHANGED | rc=0 >> 
-Lecture des listes de paquets… 
-Construction de l'arbre des dépendances… 
-Lecture des informations d'état… 
-apache2 is already the newest version (2.4.25-3+deb9u6). 
-0 mis à jour, 0 nouvellement installés, 0 à enlever et 0 non mis à jour. 
-[DEPRECATION WARNING]: Distribution debian 9.7 on host web03 should use /usr/bin/python3, but is using /usr/bin/python for backward compatibility with  
-prior Ansible releases. A future Ansible release will default to using the discovered platform python for this host. See  
-https://docs.ansible.com/ansible/2.10/reference_appendices/interpreter_discovery.html for more information. This feature will be removed in version  
-2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg. 
-web03 | CHANGED | rc=0 >> 
-Lecture des listes de paquets… 
-Construction de l'arbre des dépendances… 
-Lecture des informations d'état… 
-apache2 is already the newest version (2.4.25-3+deb9u6). 
-0 mis à jour, 0 nouvellement installés, 0 à enlever et 0 non mis à jour. 
-[DEPRECATION WARNING]: Distribution debian 9.7 on host web02 should use /usr/bin/python3, but is using /usr/bin/python for backward compatibility with  
-prior Ansible releases. A future Ansible release will default to using the discovered platform python for this host. See  
-https://docs.ansible.com/ansible/2.10/reference_appendices/interpreter_discovery.html for more information. This feature will be removed in version  
-2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg. 
-web02 | CHANGED | rc=0 >> 
-Lecture des listes de paquets… 
-Construction de l'arbre des dépendances… 
-Lecture des informations d'état… 
-apache2 is already the newest version (2.4.25-3+deb9u6). 
-0 mis à jour, 0 nouvellement installés, 0 à enlever et 0 non mis à jour. 
-[DEPRECATION WARNING]: Distribution debian 9.7 on host web01 should use /usr/bin/python3, but is using /usr/bin/python for backward compatibility with  
-prior Ansible releases. A future Ansible release will default to using the discovered platform python for this host. See  
-https://docs.ansible.com/ansible/2.10/reference_appendices/interpreter_discovery.html for more information. This feature will be removed in version  
-2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg. 
-web01 | CHANGED | rc=0 >> 
-Lecture des listes de paquets… 
-Construction de l'arbre des dépendances… 
-Lecture des informations d'état… 
-apache2 is already the newest version (2.4.25-3+deb9u6). 
-0 mis à jour, 0 nouvellement installés, 0 à enlever et 0 non mis à jour. 
-</code> 
- 
-<WRAP center round important 60%> 
-**Important** : Notez l'utilisation de la commande **sudo**. 
-</WRAP> 
  
 =====LAB #2 - La Commande ansible-playbook===== =====LAB #2 - La Commande ansible-playbook=====
Ligne 504: Ligne 446:
  
 Un Playbook File contient une liste de **Plays** qui regroupent des tâches, appelées des **tasks**. Chaque task est une commande à exécuter sur une machine cible : Un Playbook File contient une liste de **Plays** qui regroupent des tâches, appelées des **tasks**. Chaque task est une commande à exécuter sur une machine cible :
 +
 +{{ :elearning:workbooks:debian:6:avance:l130:ansible-playbooks.png?nolink&600 |}}
  
 {{ :elearning:workbooks:debian:6:avance:playbook.png?nolink&400 |}} {{ :elearning:workbooks:debian:6:avance:playbook.png?nolink&400 |}}
 +
 +{{ :elearning:workbooks:debian:6:avance:l130:ansible-playbook.png?nolink&600 |}}
  
 Dans l'exemple suivant, le playbook contient deux **Play** commençant par le caractère **-** : Dans l'exemple suivant, le playbook contient deux **Play** commençant par le caractère **-** :
Ligne 594: Ligne 540:
   * Dans le cas contraire, le handler n'est pas appelé.    * Dans le cas contraire, le handler n'est pas appelé. 
  
-<WRAP center round important 60%>+<WRAP center round important>
 **Important** : Notez que les handlers sont appelés **après** l'exécution de tous les **tasks**. Pour appeler un handler immédiatement, il convient d'utiliser **meta: flush_handlers** à l'emplacement voulu. **Important** : Notez que les handlers sont appelés **après** l'exécution de tous les **tasks**. Pour appeler un handler immédiatement, il convient d'utiliser **meta: flush_handlers** à l'emplacement voulu.
 </WRAP> </WRAP>
Ligne 778: Ligne 724:
 Dans cet exemple, la valeur du mot clef **hosts:** est le nom d'un groupe. Dans cet exemple, la valeur du mot clef **hosts:** est le nom d'un groupe.
  
-<WRAP center round important 60%>+<WRAP center round important>
 **Important** : Notez qu'il existe un groupe spécial appelé **all**. Ce groupe n'a pas besoin d'être défini et contient l'ensemble des hôtes références dans l'Inventory File **Important** : Notez qu'il existe un groupe spécial appelé **all**. Ce groupe n'a pas besoin d'être défini et contient l'ensemble des hôtes références dans l'Inventory File
 </WRAP> </WRAP>
  
-Dans la machine virtuelle Ansible, créez le fichier Inventory File suivant :+Dans la machine virtuelle **centos8**, créez le fichier Inventory File suivant :
  
 <code> <code>
-trainee@ansible:~$ vi inventory +[trainee@centos8 ~]$ vi inventory 
-trainee@ansible:~$ cat inventory+[trainee@centos8 ~]$ cat inventory
 [basededonnees] [basededonnees]
 web01 web01
Ligne 809: Ligne 755:
  
 <code> <code>
-trainee@ansible:~$ vi playbook.yaml  +[trainee@centos8 ~]$ vi playbook.yaml 
-trainee@ansible:~$ cat playbook.yaml  +[trainee@centos8 ~]$ cat playbook.yaml
---- +
-- hosts: basededonnees +
-  become: true +
-  tasks: +
-    - name: install +
-      package: name=postgresql state=installed +
-    - name: service +
-      service: name=postgresql state=started enabled=yes +
-      tags: service +
-- hosts: dotcms +
-  become: true +
-  tasks: +
-    - name: install jre +
-      package: name=openjdk-8-jre state=installed +
-- hosts: equilibrage +
-  become: true +
-  tasks: +
-    - name: install +
-      package: name=haproxy stated=installed +
-    - name: service +
-      service: name=haproxy state=started enabled=yes +
-      tags: service +
-</code> +
- +
-Exécutez la commande **ansible-playbook** : +
- +
-<code> +
-trainee@ansible:~$ ansible-playbook -i inventory playbook.yaml +
-/home/trainee/.local/lib/python3.5/site-packages/ansible/parsing/vault/__init__.py:44: CryptographyDeprecationWarning: Python 3.5 support will be dropped in the next release of cryptography. Please upgrade your Python. +
-  from cryptography.exceptions import InvalidSignature +
- +
-PLAY [basededonnees*********************************************************************************************************************************** +
- +
-TASK [Gathering Facts] ********************************************************************************************************************************* +
-[DEPRECATION WARNING]: Distribution debian 9.7 on host web01 should use /usr/bin/python3, but is using /usr/bin/python for backward compatibility with  +
-prior Ansible releases. A future Ansible release will default to using the discovered platform python for this host. See  +
-https://docs.ansible.com/ansible/2.10/reference_appendices/interpreter_discovery.html for more information. This feature will be removed in version  +
-2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg. +
-ok: [web01] +
- +
-TASK [install] ***************************************************************************************************************************************** +
-fatal: [web01]: FAILED! => {"changed": false, "msg": "value of state must be one of: absent, build-dep, fixed, latest, present, got: installed"+
- +
-PLAY RECAP ********************************************************************************************************************************************* +
-web01                      : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   +
-</code> +
- +
-<WRAP center round important 60%> +
-**Important** : Notez l'erreur qui est bloquante. L'erreur nous apprend que le mot clef **installed** devrait être remplacé par **present**.  +
-</WRAP> +
- +
-En consultant le fichier playbook.yaml, on peut constater le mot **installed** aux lignes **6**, **14** et **19** : +
- +
-<code> +
-trainee@ansible:~$ nl playbook.yaml +
-     1 --- +
-     2 - hosts: basededonnees +
-     3   become: true +
-     4   tasks: +
-     5     - name: install +
-     6       package: name=postgresql state=installed +
-     7     - name: service +
-     8       service: name=postgresql state=started enabled=yes +
-     9       tags: service +
-    10 - hosts: dotcms +
-    11   become: true +
-    12   tasks: +
-    13     - name: install jre +
-    14       package: name=openjdk-8-jre state=installed +
-    15 - hosts: equilibrage +
-    16   become: true +
-    17   tasks: +
-    18     - name: install +
-    19       package: name=haproxy stated=installed +
-    20     - name: service +
-    21       service: name=haproxy state=started enabled=yes +
-    22       tags: service +
-</code> +
- +
-Corrigez le fichier playbook.yaml aux lignes **6**, **14** et **19** et remplacez le mot **installed** par **present** : +
- +
-<code> +
-trainee@ansible:~$ vi playbook.yaml +
-trainee@ansible:~$ cat playbook.yaml+
 --- ---
 - hosts: basededonnees - hosts: basededonnees
Ligne 913: Ligne 775:
   tasks:   tasks:
     - name: install     - name: install
-      package: name=haproxy stated=present+      package: name=haproxy state=present
     - name: service     - name: service
       service: name=haproxy state=started enabled=yes       service: name=haproxy state=started enabled=yes
Ligne 919: Ligne 781:
 </code> </code>
  
-Ré-exécutez la commande **ansible-playbook** :+Exécutez la commande **ansible-playbook** :
  
 <code> <code>
-trainee@ansible:~$ ansible-playbook -i inventory playbook.yaml +[trainee@centos8 ~]$ ansible-playbook -i inventory playbook.yaml
-/home/trainee/.local/lib/python3.5/site-packages/ansible/parsing/vault/__init__.py:44: CryptographyDeprecationWarning: Python 3.5 support will be dropped in the next release of cryptography. Please upgrade your Python. +
-  from cryptography.exceptions import InvalidSignature+
  
-PLAY [basededonnees] ***********************************************************************************************************************************+PLAY [basededonnees] *********************************************************************************************************************************************************************************************
  
-TASK [Gathering Facts] ********************************************************************************************************************************* +TASK [Gathering Facts] *******************************************************************************************************************************************************************************************
-[DEPRECATION WARNING]: Distribution debian 9.7 on host web01 should use /usr/bin/python3, but is using /usr/bin/python for backward compatibility with  +
-prior Ansible releases. A future Ansible release will default to using the discovered platform python for this host. See  +
-https://docs.ansible.com/ansible/2.10/reference_appendices/interpreter_discovery.html for more information. This feature will be removed in version  +
-2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.+
 ok: [web01] ok: [web01]
  
-TASK [install] ***************************************************************************************************************************************** +TASK [install] ***************************************************************************************************************************************************************************************************
-[WARNING]: Updating cache and auto-installing missing dependency: python-apt+
 changed: [web01] changed: [web01]
  
-TASK [service] *****************************************************************************************************************************************+TASK [service] ***************************************************************************************************************************************************************************************************
 ok: [web01] ok: [web01]
  
-PLAY [dotcms] ****************************************************************************************************************************************** +PLAY [dotcms] **************************************************************************************************************************************************************************************************** 
- +TASK [Gathering Facts] *******************************************************************************************************************************************************************************************
-TASK [Gathering Facts] ********************************************************************************************************************************* +
-[DEPRECATION WARNING]: Distribution debian 9.7 on host web03 should use /usr/bin/python3, but is using /usr/bin/python for backward compatibility with  +
-prior Ansible releases. A future Ansible release will default to using the discovered platform python for this host. See  +
-https://docs.ansible.com/ansible/2.10/reference_appendices/interpreter_discovery.html for more information. This feature will be removed in version  +
-2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg. +
-ok: [web03] +
-[DEPRECATION WARNING]: Distribution debian 9.7 on host web02 should use /usr/bin/python3, but is using /usr/bin/python for backward compatibility with  +
-prior Ansible releases. A future Ansible release will default to using the discovered platform python for this host. See  +
-https://docs.ansible.com/ansible/2.10/reference_appendices/interpreter_discovery.html for more information. This feature will be removed in version  +
-2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.+
 ok: [web02] ok: [web02]
- 
-TASK [install jre] ************************************************************************************************************************************* 
 ok: [web03] ok: [web03]
-ok: [web02] 
  
-PLAY [equilibrage] ************************************************************************************************************************************* +TASK [install jre] ***********************************************************************************************************************************************************************************************
- +
-TASK [Gathering Facts] ********************************************************************************************************************************* +
-[DEPRECATION WARNING]: Distribution debian 9.7 on host web04 should use /usr/bin/python3, but is using /usr/bin/python for backward compatibility with  +
-prior Ansible releases. A future Ansible release will default to using the discovered platform python for this host. See  +
-https://docs.ansible.com/ansible/2.10/reference_appendices/interpreter_discovery.html for more information. This feature will be removed in version  +
-2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg. +
-ok: [web04] +
- +
-TASK [install] ***************************************************************************************************************************************** +
-fatal: [web04]: FAILED! => {"changed": false, "msg": "Unsupported parameters for (ansible.legacy.apt) module: stated Supported parameters include: allow_unauthenticated, autoclean, autoremove, cache_valid_time, deb, default_release, dpkg_options, force, force_apt_get, install_recommends, only_upgrade, package, policy_rc_d, purge, state, update_cache, update_cache_retries, update_cache_retry_max_delay, upgrade"+
- +
-PLAY RECAP ********************************************************************************************************************************************* +
-web01                      : ok=3    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0    +
-web02                      : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0    +
-web03                      : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0    +
-web04                      : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0  +
-</code> +
- +
-<WRAP center round important 60%> +
-**Important** : Notez l'erreur qui est bloquante. L'erreur indique qu'il existe une erreur de syntaxe dans le fichier playbook.yaml.  +
-</WRAP> +
- +
-En consultant le fichier playbook.yaml, il existe une erreur à la ligne 19 - **stated** devrait être corrigé en **state** : +
- +
-<code> +
-trainee@ansible:~$ nl playbook.yaml +
-     1 --- +
-     2 - hosts: basededonnees +
-     3   become: true +
-     4   tasks: +
-     5     - name: install +
-     6       package: name=postgresql state=present +
-     7     - name: service +
-     8       service: name=postgresql state=started enabled=yes +
-     9       tags: service +
-    10 - hosts: dotcms +
-    11   become: true +
-    12   tasks: +
-    13     - name: install jre +
-    14       package: name=openjdk-8-jre state=present +
-    15 - hosts: equilibrage +
-    16   become: true +
-    17   tasks: +
-    18     - name: install +
-    19       package: name=haproxy stated=present +
-    20     - name: service +
-    21       service: name=haproxy state=started enabled=yes +
-    22       tags: service +
-</code> +
- +
-Corrigez le fichier playbook.yaml : +
- +
-<code> +
-trainee@ansible:~$ vi playbook.yaml  +
-trainee@ansible:~$ cat playbook.yaml  +
---- +
-- hosts: basededonnees +
-  become: true +
-  tasks: +
-    - name: install +
-      package: name=postgresql state=present +
-    - name: service +
-      service: name=postgresql state=started enabled=yes +
-      tags: service +
-- hosts: dotcms +
-  become: true +
-  tasks: +
-    - name: install jre +
-      package: name=openjdk-8-jre state=present +
-- hosts: equilibrage +
-  become: true +
-  tasks: +
-    - name: install +
-      package: name=haproxy state=present +
-    - name: service +
-      service: name=haproxy state=started enabled=yes +
-      tags: service +
-</code> +
- +
-Ré-exécutez la commande **ansible-playbook** : +
- +
-<code> +
-trainee@ansible:~$ ansible-playbook -i inventory playbook.yaml +
-/home/trainee/.local/lib/python3.5/site-packages/ansible/parsing/vault/__init__.py:44: CryptographyDeprecationWarning: Python 3.5 support will be dropped in the next release of cryptography. Please upgrade your Python. +
-  from cryptography.exceptions import InvalidSignature +
- +
-PLAY [basededonnees] *********************************************************************************************************************************** +
- +
-TASK [Gathering Facts] ********************************************************************************************************************************* +
-[DEPRECATION WARNING]: Distribution debian 9.7 on host web01 should use /usr/bin/python3, but is using /usr/bin/python for backward compatibility with  +
-prior Ansible releases. A future Ansible release will default to using the discovered platform python for this host. See  +
-https://docs.ansible.com/ansible/2.10/reference_appendices/interpreter_discovery.html for more information. This feature will be removed in version  +
-2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg. +
-ok: [web01] +
- +
-TASK [install] ***************************************************************************************************************************************** +
-ok: [web01] +
- +
-TASK [service] ***************************************************************************************************************************************** +
-ok: [web01] +
- +
-PLAY [dotcms] ****************************************************************************************************************************************** +
- +
-TASK [Gathering Facts] ********************************************************************************************************************************* +
-[DEPRECATION WARNING]: Distribution debian 9.7 on host web03 should use /usr/bin/python3, but is using /usr/bin/python for backward compatibility with  +
-prior Ansible releases. A future Ansible release will default to using the discovered platform python for this host. See  +
-https://docs.ansible.com/ansible/2.10/reference_appendices/interpreter_discovery.html for more information. This feature will be removed in version  +
-2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.+
 ok: [web03] ok: [web03]
-[DEPRECATION WARNING]: Distribution debian 9.7 on host web02 should use /usr/bin/python3, but is using /usr/bin/python for backward compatibility with  
-prior Ansible releases. A future Ansible release will default to using the discovered platform python for this host. See  
-https://docs.ansible.com/ansible/2.10/reference_appendices/interpreter_discovery.html for more information. This feature will be removed in version  
-2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg. 
 ok: [web02] ok: [web02]
  
-TASK [install jre] ************************************************************************************************************************************* +PLAY [equilibrage] ***********************************************************************************************************************************************************************************************
-ok: [web02] +
-ok: [web03] +
- +
-PLAY [equilibrage] *************************************************************************************************************************************+
  
-TASK [Gathering Facts] ********************************************************************************************************************************* +TASK [Gathering Facts] *******************************************************************************************************************************************************************************************
-[DEPRECATION WARNING]: Distribution debian 9.7 on host web04 should use /usr/bin/python3, but is using /usr/bin/python for backward compatibility with  +
-prior Ansible releases. A future Ansible release will default to using the discovered platform python for this host. See  +
-https://docs.ansible.com/ansible/2.10/reference_appendices/interpreter_discovery.html for more information. This feature will be removed in version  +
-2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.+
 ok: [web04] ok: [web04]
  
-TASK [install] ***************************************************************************************************************************************** +TASK [install] ***************************************************************************************************************************************************************************************************
-[WARNING]: Updating cache and auto-installing missing dependency: python-apt+
 changed: [web04] changed: [web04]
  
-TASK [service] *****************************************************************************************************************************************+TASK [service] ***************************************************************************************************************************************************************************************************
 ok: [web04] ok: [web04]
  
-PLAY RECAP ********************************************************************************************************************************************* +PLAY RECAP ******************************************************************************************************************************************************************************************************* 
-web01                      : ok=3    changed=   unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   +web01                      : ok=3    changed=   unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
 web02                      : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0    web02                      : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
 web03                      : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0    web03                      : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
-web04                      : ok=3    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0 +web04                      : ok=3    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
 </code> </code>
- 
-<WRAP center round important 60%> 
-**Important** : Notez que seul **web04** a été modifié. 
-</WRAP> 
  
 Il est possible de limiter l'action de la commande **ansible-playbook** avec l'option **-l**. Exécutez la commande **ansible-playbook** en limitant l'action d'ansible-playbook au groupe **equilibrage** : Il est possible de limiter l'action de la commande **ansible-playbook** avec l'option **-l**. Exécutez la commande **ansible-playbook** en limitant l'action d'ansible-playbook au groupe **equilibrage** :
  
 <code> <code>
-trainee@ansible:~$ ansible-playbook -i inventory playbook.yaml -l equilibrage +[trainee@centos8 ~]$ ansible-playbook -i inventory playbook.yaml -l equilibrage
-/home/trainee/.local/lib/python3.5/site-packages/ansible/parsing/vault/__init__.py:44: CryptographyDeprecationWarning: Python 3.5 support will be dropped in the next release of cryptography. Please upgrade your Python. +
-  from cryptography.exceptions import InvalidSignature+
  
-PLAY [basededonnees] ***********************************************************************************************************************************+PLAY [basededonnees] *********************************************************************************************************************************************************************************************
 skipping: no hosts matched skipping: no hosts matched
  
-PLAY [dotcms] ******************************************************************************************************************************************+PLAY [dotcms] ****************************************************************************************************************************************************************************************************
 skipping: no hosts matched skipping: no hosts matched
  
-PLAY [equilibrage] *************************************************************************************************************************************+PLAY [equilibrage] ***********************************************************************************************************************************************************************************************
  
-TASK [Gathering Facts] ********************************************************************************************************************************* +TASK [Gathering Facts] *******************************************************************************************************************************************************************************************
-[DEPRECATION WARNING]: Distribution debian 9.7 on host web04 should use /usr/bin/python3, but is using /usr/bin/python for backward compatibility with  +
-prior Ansible releases. A future Ansible release will default to using the discovered platform python for this host. See  +
-https://docs.ansible.com/ansible/2.10/reference_appendices/interpreter_discovery.html for more information. This feature will be removed in version  +
-2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.+
 ok: [web04] ok: [web04]
  
-TASK [install] *****************************************************************************************************************************************+TASK [install] ***************************************************************************************************************************************************************************************************
 ok: [web04] ok: [web04]
  
-TASK [service] *****************************************************************************************************************************************+TASK [service] ***************************************************************************************************************************************************************************************************
 ok: [web04] ok: [web04]
  
-PLAY RECAP ********************************************************************************************************************************************* +PLAY RECAP ******************************************************************************************************************************************************************************************************* 
-web04                      : ok=3    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0 +web04                      : ok=3    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0  
 </code> </code>
  
Ligne 1142: Ligne 853:
  
 <code> <code>
-trainee@ansible:~$ ansible-playbook -i inventory playbook.yaml -l web04 +[trainee@centos8 ~]$ ansible-playbook -i inventory playbook.yaml -l web04
-/home/trainee/.local/lib/python3.5/site-packages/ansible/parsing/vault/__init__.py:44: CryptographyDeprecationWarning: Python 3.5 support will be dropped in the next release of cryptography. Please upgrade your Python. +
-  from cryptography.exceptions import InvalidSignature+
  
-PLAY [basededonnees] ***********************************************************************************************************************************+PLAY [basededonnees] *********************************************************************************************************************************************************************************************
 skipping: no hosts matched skipping: no hosts matched
  
-PLAY [dotcms] ******************************************************************************************************************************************+PLAY [dotcms] ****************************************************************************************************************************************************************************************************
 skipping: no hosts matched skipping: no hosts matched
  
-PLAY [equilibrage] *************************************************************************************************************************************+PLAY [equilibrage] ***********************************************************************************************************************************************************************************************
  
-TASK [Gathering Facts] ********************************************************************************************************************************* +TASK [Gathering Facts] *******************************************************************************************************************************************************************************************
-[DEPRECATION WARNING]: Distribution debian 9.7 on host web04 should use /usr/bin/python3, but is using /usr/bin/python for backward compatibility with  +
-prior Ansible releases. A future Ansible release will default to using the discovered platform python for this host. See  +
-https://docs.ansible.com/ansible/2.10/reference_appendices/interpreter_discovery.html for more information. This feature will be removed in version  +
-2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.+
 ok: [web04] ok: [web04]
  
-TASK [install] *****************************************************************************************************************************************+TASK [install] ***************************************************************************************************************************************************************************************************
 ok: [web04] ok: [web04]
  
-TASK [service] *****************************************************************************************************************************************+TASK [service] ***************************************************************************************************************************************************************************************************
 ok: [web04] ok: [web04]
  
-PLAY RECAP ********************************************************************************************************************************************* +PLAY RECAP ******************************************************************************************************************************************************************************************************* 
-web04                      : ok=3    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0  +web04                      : ok=3    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0    
 </code> </code>
  
Ligne 1187: Ligne 892:
  
 <code> <code>
-trainee@ansible:~$ ansible-playbook -i inventory playbook.yaml --tags service +[trainee@centos8 ~]$ ansible-playbook -i inventory playbook.yaml --tags service
-/home/trainee/.local/lib/python3.5/site-packages/ansible/parsing/vault/__init__.py:44: CryptographyDeprecationWarning: Python 3.5 support will be dropped in the next release of cryptography. Please upgrade your Python. +
-  from cryptography.exceptions import InvalidSignature+
  
-PLAY [basededonnees] ***********************************************************************************************************************************+PLAY [basededonnees] *********************************************************************************************************************************************************************************************
  
-TASK [Gathering Facts] ********************************************************************************************************************************* +TASK [Gathering Facts] *******************************************************************************************************************************************************************************************
-[DEPRECATION WARNING]: Distribution debian 9.7 on host web01 should use /usr/bin/python3, but is using /usr/bin/python for backward compatibility with  +
-prior Ansible releases. A future Ansible release will default to using the discovered platform python for this host. See  +
-https://docs.ansible.com/ansible/2.10/reference_appendices/interpreter_discovery.html for more information. This feature will be removed in version  +
-2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.+
 ok: [web01] ok: [web01]
  
-TASK [service] *****************************************************************************************************************************************+TASK [service] ***************************************************************************************************************************************************************************************************
 ok: [web01] ok: [web01]
  
-PLAY [dotcms] ******************************************************************************************************************************************+PLAY [dotcms] ****************************************************************************************************************************************************************************************************
  
-TASK [Gathering Facts] ********************************************************************************************************************************* +TASK [Gathering Facts] *******************************************************************************************************************************************************************************************
-[DEPRECATION WARNING]: Distribution debian 9.7 on host web02 should use /usr/bin/python3, but is using /usr/bin/python for backward compatibility with  +
-prior Ansible releases. A future Ansible release will default to using the discovered platform python for this host. See  +
-https://docs.ansible.com/ansible/2.10/reference_appendices/interpreter_discovery.html for more information. This feature will be removed in version  +
-2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.+
 ok: [web02] ok: [web02]
-[DEPRECATION WARNING]: Distribution debian 9.7 on host web03 should use /usr/bin/python3, but is using /usr/bin/python for backward compatibility with  
-prior Ansible releases. A future Ansible release will default to using the discovered platform python for this host. See  
-https://docs.ansible.com/ansible/2.10/reference_appendices/interpreter_discovery.html for more information. This feature will be removed in version  
-2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg. 
 ok: [web03] ok: [web03]
  
-PLAY [equilibrage] *************************************************************************************************************************************+PLAY [equilibrage] ***********************************************************************************************************************************************************************************************
  
-TASK [Gathering Facts] ********************************************************************************************************************************* +TASK [Gathering Facts] *******************************************************************************************************************************************************************************************
-[DEPRECATION WARNING]: Distribution debian 9.7 on host web04 should use /usr/bin/python3, but is using /usr/bin/python for backward compatibility with  +
-prior Ansible releases. A future Ansible release will default to using the discovered platform python for this host. See  +
-https://docs.ansible.com/ansible/2.10/reference_appendices/interpreter_discovery.html for more information. This feature will be removed in version  +
-2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.+
 ok: [web04] ok: [web04]
  
-TASK [service] *****************************************************************************************************************************************+TASK [service] ***************************************************************************************************************************************************************************************************
 ok: [web04] ok: [web04]
  
-PLAY RECAP *********************************************************************************************************************************************+PLAY RECAP *******************************************************************************************************************************************************************************************************
 web01                      : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0    web01                      : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
 web02                      : ok=1    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0    web02                      : ok=1    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
Ligne 1239: Ligne 926:
  
 <code> <code>
-trainee@ansible:~$ ansible-playbook -i inventory playbook.yaml --tags service -l equilibrage +[trainee@centos8 ~]$ ansible-playbook -i inventory playbook.yaml --tags service -l equilibrage
-/home/trainee/.local/lib/python3.5/site-packages/ansible/parsing/vault/__init__.py:44: CryptographyDeprecationWarning: Python 3.5 support will be dropped in the next release of cryptography. Please upgrade your Python. +
-  from cryptography.exceptions import InvalidSignature+
  
-PLAY [basededonnees] ***********************************************************************************************************************************+PLAY [basededonnees] *********************************************************************************************************************************************************************************************
 skipping: no hosts matched skipping: no hosts matched
  
-PLAY [dotcms] ******************************************************************************************************************************************+PLAY [dotcms] ****************************************************************************************************************************************************************************************************
 skipping: no hosts matched skipping: no hosts matched
  
-PLAY [equilibrage] *************************************************************************************************************************************+PLAY [equilibrage] ***********************************************************************************************************************************************************************************************
  
-TASK [Gathering Facts] ********************************************************************************************************************************* +TASK [Gathering Facts] *******************************************************************************************************************************************************************************************
-[DEPRECATION WARNING]: Distribution debian 9.7 on host web04 should use /usr/bin/python3, but is using /usr/bin/python for backward compatibility with  +
-prior Ansible releases. A future Ansible release will default to using the discovered platform python for this host. See  +
-https://docs.ansible.com/ansible/2.10/reference_appendices/interpreter_discovery.html for more information. This feature will be removed in version  +
-2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.+
 ok: [web04] ok: [web04]
  
-TASK [service] *****************************************************************************************************************************************+TASK [service] ***************************************************************************************************************************************************************************************************
 ok: [web04] ok: [web04]
  
-PLAY RECAP ********************************************************************************************************************************************* +PLAY RECAP ******************************************************************************************************************************************************************************************************* 
-web04                      : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0 +web04                      : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
 </code> </code>
  
Ligne 1270: Ligne 951:
  
 Les **Rôles** permettent la création d'une bibliothèque réutilisable.  Les **Rôles** permettent la création d'une bibliothèque réutilisable. 
 +
 +{{ :elearning:workbooks:debian:6:avance:l130:blog-ansible.png?nolink&600 |}}
  
 Un **Rôle** est un répertoire contenant les sous-répertoires suivants : Un **Rôle** est un répertoire contenant les sous-répertoires suivants :
Ligne 1288: Ligne 971:
     * contient des variables de configuration de haute priorité, difficilement sur-chargées par des variables ailleurs.     * contient des variables de configuration de haute priorité, difficilement sur-chargées par des variables ailleurs.
  
-<WRAP center round important 60%>+<WRAP center round important>
 **Important** : Notez que seul le répertoire **tasks** est obligatoire. **Important** : Notez que seul le répertoire **tasks** est obligatoire.
 </WRAP> </WRAP>
Ligne 1370: Ligne 1053:
 {{ :elearning:workbooks:debian:6:avance:l130:ansible4.png?direct&600 |}} {{ :elearning:workbooks:debian:6:avance:l130:ansible4.png?direct&600 |}}
  
-<WRAP center round important 60%>+<WRAP center round important>
 **Important** : Notez que la convention utilisée pour les noms est //nom_utilisateur.rôle//. **Important** : Notez que la convention utilisée pour les noms est //nom_utilisateur.rôle//.
 </WRAP> </WRAP>
  
-Dans la machine **Ansible**, collez la commande copiée et exécutez-la :+Dans la machine **centos8**, collez la commande copiée et exécutez-la :
  
 <code> <code>
-trainee@ansible:~$ ansible-galaxy install geerlingguy.java +[trainee@centos8 ~]$ ansible-galaxy install geerlingguy.java
-/home/trainee/.local/lib/python3.5/site-packages/ansible/parsing/vault/__init__.py:44: CryptographyDeprecationWarning: Python 3.5 support will be dropped in the next release of cryptography. Please upgrade your Python. +
-  from cryptography.exceptions import InvalidSignature+
 Starting galaxy role install process Starting galaxy role install process
 - downloading role 'java', owned by geerlingguy - downloading role 'java', owned by geerlingguy
-- downloading role from https://github.com/geerlingguy/ansible-role-java/archive/1.10.0.tar.gz+- downloading role from https://github.com/geerlingguy/ansible-role-java/archive/2.0.1.tar.gz
 - extracting geerlingguy.java to /home/trainee/.ansible/roles/geerlingguy.java - extracting geerlingguy.java to /home/trainee/.ansible/roles/geerlingguy.java
-- geerlingguy.java (1.10.0) was installed successfully+- geerlingguy.java (2.0.1) was installed successfully
 </code> </code>
  
Ligne 1390: Ligne 1071:
  
 <code> <code>
-trainee@ansible:~$ su - +[trainee@centos8 ~]$ su - 
-Mot de passe fenestros +Password:  
-root@ansible:~# apt-get install tree +[root@centos8 ~]which tree 
-... +/usr/bin/tree 
-root@ansible:~# exit +[root@centos8 ~]# exit 
-déconnexion +logout 
-trainee@ansible:~$ tree /home/trainee/.ansible/roles/geerlingguy.java+[trainee@centos8 ~]$ tree /home/trainee/.ansible/roles/geerlingguy.java
 /home/trainee/.ansible/roles/geerlingguy.java /home/trainee/.ansible/roles/geerlingguy.java
 ├── defaults ├── defaults
-│   └── main.yml+│   └── main.yml
 ├── LICENSE ├── LICENSE
 ├── meta ├── meta
-│   └── main.yml+│   └── main.yml
 ├── molecule ├── molecule
-│   └── default +│   └── default 
-│       ├── converge.yml +│       ├── converge.yml 
-│       └── molecule.yml+│       └── molecule.yml
 ├── README.md ├── README.md
 ├── tasks ├── tasks
-│   ├── main.yml +│   ├── main.yml 
-│   ├── setup-Debian.yml +│   ├── setup-Debian.yml 
-│   ├── setup-FreeBSD.yml +│   ├── setup-FreeBSD.yml 
-│   └── setup-RedHat.yml+│   └── setup-RedHat.yml
 ├── templates ├── templates
-│   └── java_home.sh.j2+│   └── java_home.sh.j2
 └── vars └── vars
     ├── Debian-10.yml     ├── Debian-10.yml
 +    ├── Debian-11.yml
     ├── Debian-8.yml     ├── Debian-8.yml
     ├── Debian-9.yml     ├── Debian-9.yml
     ├── Fedora.yml     ├── Fedora.yml
     ├── FreeBSD.yml     ├── FreeBSD.yml
-    ├── RedHat-6.yml 
     ├── RedHat-7.yml     ├── RedHat-7.yml
     ├── RedHat-8.yml     ├── RedHat-8.yml
Ligne 1433: Ligne 1114:
 </code> </code>
  
-<WRAP center round important 60%>+<WRAP center round important>
 **Important** : Notez que dans ce cas il n'y a pas eu de dépendances. Par contre la commande **ansible-galaxy** sait résoudre et gérer les dépendances. **Important** : Notez que dans ce cas il n'y a pas eu de dépendances. Par contre la commande **ansible-galaxy** sait résoudre et gérer les dépendances.
 </WRAP> </WRAP>
Ligne 1440: Ligne 1121:
  
 <code> <code>
-trainee@ansible:~$ vi playbook_java.yaml +[trainee@centos8 ~]$ vi playbook_java.yaml 
-trainee@ansible:~$ cat playbook_java.yaml+[trainee@centos8 ~]$ cat playbook_java.yaml
 --- ---
 - hosts: all - hosts: all
Ligne 1449: Ligne 1130:
 </code> </code>
  
-Avant d'excuter ce playbook, créez le fichier **~/.ansible.cfg** :+Avant d’exécuter ce playbook, créez le fichier **~/.ansible.cfg** :
  
 <code> <code>
-trainee@ansible:~$ vi .ansible.cfg +[trainee@centos8 ~]$ vi .ansible.cfg 
-trainee@ansible:~$ cat .ansible.cfg+[trainee@centos8 ~]$ cat .ansible.cfg
 [defaults] [defaults]
 deprecation_warnings=False deprecation_warnings=False
 +log_path = ./ansible.log
 </code> </code>
  
-<WRAP center round important 60%>+<WRAP center round important>
 **Important** : Le comportement d'Ansible peut être configuré par des directives dans la variable d'environnement **ANSIBLE_CONFIG** ou dans le fichier **ansible.cfg** dans le répertoire courant de travail ou dans le fichier **.ansible.cfg** dans le répertoire personnel de l'utilisateur ou dans le fichier **/etc/ansible/ansible.cfg**, selon le premier qui est trouvé. Pour une liste complète des directives, consultez la page [[https://docs.ansible.com/ansible/latest/reference_appendices/config.html]]. **Important** : Le comportement d'Ansible peut être configuré par des directives dans la variable d'environnement **ANSIBLE_CONFIG** ou dans le fichier **ansible.cfg** dans le répertoire courant de travail ou dans le fichier **.ansible.cfg** dans le répertoire personnel de l'utilisateur ou dans le fichier **/etc/ansible/ansible.cfg**, selon le premier qui est trouvé. Pour une liste complète des directives, consultez la page [[https://docs.ansible.com/ansible/latest/reference_appendices/config.html]].
 </WRAP> </WRAP>
Ligne 1465: Ligne 1147:
  
 <code> <code>
-trainee@ansible:~$ ansible-config list +[trainee@centos8 ~]$ ansible-config list | more
-/home/trainee/.local/lib/python3.5/site-packages/ansible/parsing/vault/__init__.py:44: CryptographyDeprecationWarning: Python 3.5 support will be dropped in the next release of cryptography. Please upgrade your Python. +
-  from cryptography.exceptions import InvalidSignature+
 ACTION_WARNINGS: ACTION_WARNINGS:
   default: true   default: true
-  description: +  description: [By default Ansible will issue a warning when received from a task 
-  - By default Ansible will issue a warning when received from a task action (module +      action (module or action plugin)These warnings can be silenced by adjusting 
-    or action plugin) +      this setting to False.]
-  - These warnings can be silenced by adjusting this setting to False.+
   env:   env:
-  - name: ANSIBLE_ACTION_WARNINGS+  - {name: ANSIBLE_ACTION_WARNINGS}
   ini:   ini:
-  - key: action_warnings +  - {key: action_warningssection: defaults}
-    section: defaults+
   name: Toggle action warnings   name: Toggle action warnings
   type: boolean   type: boolean
Ligne 1487: Ligne 1165:
     the command line supplied become method     the command line supplied become method
   env:   env:
-  - name: ANSIBLE_AGNOSTIC_BECOME_PROMPT+  - {name: ANSIBLE_AGNOSTIC_BECOME_PROMPT}
   ini:   ini:
-  - key: agnostic_become_prompt +  - {key: agnostic_become_promptsection: privilege_escalation}
-    section: privilege_escalation+
   name: Display an agnostic become prompt   name: Display an agnostic become prompt
   type: boolean   type: boolean
   version_added: '2.5'   version_added: '2.5'
-  yaml: +  yaml: {key: privilege_escalation.agnostic_become_prompt}
-    key: privilege_escalation.agnostic_become_prompt+
 ALLOW_WORLD_READABLE_TMPFILES: ALLOW_WORLD_READABLE_TMPFILES:
   default: false   default: false
-  deprecated: +  deprecated: {alternatives: world_readable_tmp, collection_name: ansible.builtin, 
-    alternatives: mostly the same config will workbut now controlled from the plugin +    version: '2.14'why: moved to shell plugins} 
-      itself and not using the general constant. +  description: ['This setting has been moved to the individual shell plugins as a 
-    collection_name: ansible.builtin +      plugin option :ref:`shell_plugins`.', 'The existing configuration settings are 
-    version: '2.14' +      still accepted with the shell plugin adding additional options, like variables.', 
-    why: moved to a per plugin approach that is more flexible +    This message will be removed in 2.14.] 
-  description: +  name: Allow world-readable temporary files 
-  - This makes the temporary files created on the machine world-readable and will +  type: boolean 
-    issue a warning instead of failing the task+ANSIBLE_CONNECTION_PATH: 
-:+  default: null 
 +  description: [Specify where to look for the ansible-connection script. This location 
 +      will be checked before searching $PATH., 'If null, ansible will start with the 
 +      same directory as the ansible script.'
 +  env: 
 +  - {name: ANSIBLE_CONNECTION_PATH} 
 +  ini: 
 +  - {key: ansible_connection_path, section: persistent_connection} 
 +  name: Path of ansible-connection script 
 +  type: path 
 +  version_added: '2.8' 
 +  yaml: {key: persistent_connection.ansible_connection_path} 
 +ANSIBLE_COW_ACCEPTLIST: 
 +  default: [bud-frogs, bunny, cheese, daemon, default, dragon, elephant-in-snake, 
 +    elephant, eyes, hellokitty, kitty, luke-koala, meow, milk, moofasa, moose, ren, 
 +    sheep, small, stegosaurus, stimpy, supermilker, three-eyes, turkey, turtle, tux, 
 +    udder, vader-koala, vader, www] 
 +  description: White list of cowsay templates that are 'safe' to use, set to empty 
 +    list if you want to enable all installed templates
 +  env: 
 +  - deprecated: {alternatives: ANSIBLE_COW_ACCEPTLIST, collection_name: ansible.builtin, 
 +--More--
 </code> </code>
  
Ligne 1513: Ligne 1210:
  
 <code> <code>
-trainee@ansible:~$ ansible-playbook -i inventory playbook_java.yaml +[trainee@centos8 ~]$ ansible-playbook -i inventory playbook_java.yaml
-/home/trainee/.local/lib/python3.5/site-packages/ansible/parsing/vault/__init__.py:44: CryptographyDeprecationWarning: Python 3.5 support will be dropped in the next release of cryptography. Please upgrade your Python. +
-  from cryptography.exceptions import InvalidSignature+
  
-PLAY [all] *********************************************************************************************************************************************+PLAY [all] *******************************************************************************************************************************************************************************************************
  
-TASK [Gathering Facts] *********************************************************************************************************************************+TASK [Gathering Facts] *******************************************************************************************************************************************************************************************
 ok: [web04] ok: [web04]
 ok: [web01] ok: [web01]
-ok: [web02] 
 ok: [web03] ok: [web03]
 +ok: [web02]
  
-TASK [geerlingguy.java : Include OS-specific variables for Fedora or FreeBSD.] *************************************************************************+TASK [geerlingguy.java : Include OS-specific variables for Fedora or FreeBSD.] ***********************************************************************************************************************************
 skipping: [web01] skipping: [web01]
 skipping: [web02] skipping: [web02]
Ligne 1531: Ligne 1226:
 skipping: [web04] skipping: [web04]
  
-TASK [geerlingguy.java : Include version-specific variables for CentOS/RHEL.] **************************************************************************+TASK [geerlingguy.java : Include version-specific variables for CentOS/RHEL.] ************************************************************************************************************************************
 skipping: [web01] skipping: [web01]
 skipping: [web02] skipping: [web02]
Ligne 1537: Ligne 1232:
 skipping: [web04] skipping: [web04]
  
-TASK [geerlingguy.java : Include version-specific variables for Ubuntu.] *******************************************************************************+TASK [geerlingguy.java : Include version-specific variables for Ubuntu.] *****************************************************************************************************************************************
 skipping: [web01] skipping: [web01]
 skipping: [web02] skipping: [web02]
Ligne 1543: Ligne 1238:
 skipping: [web04] skipping: [web04]
  
-TASK [geerlingguy.java : Include version-specific variables for Debian.] ******************************************************************************* +TASK [geerlingguy.java : Include version-specific variables for Debian.] *****************************************************************************************************************************************
-ok: [web01]+
 ok: [web02] ok: [web02]
 ok: [web03] ok: [web03]
 +ok: [web01]
 ok: [web04] ok: [web04]
  
-TASK [geerlingguy.java : Define java_packages.] ********************************************************************************************************+TASK [geerlingguy.java : Define java_packages.] ******************************************************************************************************************************************************************
 ok: [web01] ok: [web01]
 ok: [web02] ok: [web02]
Ligne 1555: Ligne 1250:
 ok: [web04] ok: [web04]
  
-TASK [geerlingguy.java : include_tasks] ****************************************************************************************************************+TASK [geerlingguy.java : include_tasks] **************************************************************************************************************************************************************************
 skipping: [web01] skipping: [web01]
 skipping: [web02] skipping: [web02]
Ligne 1561: Ligne 1256:
 skipping: [web04] skipping: [web04]
  
-TASK [geerlingguy.java : include_tasks] ****************************************************************************************************************+TASK [geerlingguy.java : include_tasks] **************************************************************************************************************************************************************************
 included: /home/trainee/.ansible/roles/geerlingguy.java/tasks/setup-Debian.yml for web01, web02, web03, web04 included: /home/trainee/.ansible/roles/geerlingguy.java/tasks/setup-Debian.yml for web01, web02, web03, web04
  
-TASK [geerlingguy.java : Ensure 'man' directory exists.] ***********************************************************************************************+TASK [geerlingguy.java : Ensure 'man' directory exists.] *********************************************************************************************************************************************************
 skipping: [web01] skipping: [web01]
 skipping: [web02] skipping: [web02]
Ligne 1570: Ligne 1265:
 skipping: [web04] skipping: [web04]
  
-TASK [geerlingguy.java : Ensure Java is installed.] ****************************************************************************************************+TASK [geerlingguy.java : Ensure Java is installed.] **************************************************************************************************************************************************************
 changed: [web04] changed: [web04]
-changed: [web02] 
 changed: [web03] changed: [web03]
 +changed: [web02]
 changed: [web01] changed: [web01]
  
-TASK [geerlingguy.java : include_tasks] ****************************************************************************************************************+TASK [geerlingguy.java : include_tasks] **************************************************************************************************************************************************************************
 skipping: [web01] skipping: [web01]
 skipping: [web02] skipping: [web02]
Ligne 1582: Ligne 1277:
 skipping: [web04] skipping: [web04]
  
-TASK [geerlingguy.java : Set JAVA_HOME if configured.] *************************************************************************************************+TASK [geerlingguy.java : Set JAVA_HOME if configured.] ***********************************************************************************************************************************************************
 skipping: [web01] skipping: [web01]
 skipping: [web02] skipping: [web02]
Ligne 1588: Ligne 1283:
 skipping: [web04] skipping: [web04]
  
-PLAY RECAP *********************************************************************************************************************************************+PLAY RECAP *******************************************************************************************************************************************************************************************************
 web01                      : ok=5    changed=1    unreachable=0    failed=0    skipped=7    rescued=0    ignored=0    web01                      : ok=5    changed=1    unreachable=0    failed=0    skipped=7    rescued=0    ignored=0   
 web02                      : ok=5    changed=1    unreachable=0    failed=0    skipped=7    rescued=0    ignored=0    web02                      : ok=5    changed=1    unreachable=0    failed=0    skipped=7    rescued=0    ignored=0   
Ligne 1595: Ligne 1290:
 </code> </code>
  
-<WRAP center round important 60%> +Notez qu'Ansible a pu localiser le Rôle grâce à la valeur de la variable Ansible **ANSIBLE_ROLES_PATH**. La valeur par défaut de cette variable est **~/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles** :
-**Important** : Notez qu'Ansible a pu localiser le Rôle grâce à la valeur de la variable Ansible **ANSIBLE_ROLES_PATH**. La valeur par défaut de cette variable est **~/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles**+
-</WRAP>+
  
 +<code>
 +[trainee@centos8 ~]$ ansible-config dump |grep ROLES_PATH
 +DEFAULT_ROLES_PATH(default) = ['/home/trainee/.ansible/roles', '/usr/share/ansible/roles', '/etc/ansible/roles']
 +</code>
 +
 +Le PLAY RECAP contient 7 catégories :
 +
 +  * **ok**
 +    * le nombre de tâches qui ont été traitées sans erreur
 +  * **changed**
 +    * le nombre de tâches qui ont effectué des modifications sur un des hôtes concernés
 +  * **unreachable**
 +    * le nombre de tâches qui n'ont pas été exécutées parce que l'hôte ne pouvait pas être contacté
 +  * **failed**
 +    * le nombre de tâches en erreur pour lesquelles la valeur de **ignore_errors:** était fixée à **false**
 +  * **skipped**
 +    * le nombre de tâches qui n'ont pas été exécutées parce que la valeur de la clause **when** était **fausse**
 +  * **rescued**
 +    * le nombre de tâches de type **rescue** qui ont été exécutées suite à une erreur ailleurs dans le playbook
 +  * **ignored**
 +    * le nombre de tâches en erreur pour lesquelles la valeur de **ignore_errors:** était fixée à **true**
 +
 +Pour mieux expliquer la catégorie **rescued**, considérez le code suivant :
 +
 +<file>
 +---
 + - name: Ansible Blocks
 +   hosts: server1
 +   gather_facts: false
 +
 +   tasks:
 +     - block:
 +        - name: List home directory content
 +          command: "ls -l ~/"
 +
 +        - name: Failing intentionally
 +          command: "ls -l /tmp/does-not-exist"
 +
 +       rescue:
 +        - name: Rescue block (perform recovery)
 +          debug:
 +            msg: "Something went wrong, cleaning up.."
 +
 +       always:
 +        - name: This will execute always
 +          debug:
 +            msg: "I will execute even in failure scenario"
 +</file>
 +
 +Dans le cas ci-dessus, la deuxième tâche dans la section **block** va générer une erreur. Dans ce cas la tâche dans la section **rescue** sera exécutée. Dans **tous** les cas la tâche dans la section **always** sera exécutée.
  
 ----- -----
-<html> + 
-<div align="center"> +Copyright © 2023 Hugh Norris.
-Copyright © 2021 Hugh NORRIS +
-</div> +
-</html>+
Menu