Différences

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

Lien vers cette vue comparative

Prochaine révision
Révision précédente
elearning:workbooks:centos:8:lcf900:l706 [2022/05/17 08:07] – created adminelearning:workbooks:centos:8:lcf900:l706 [2024/06/10 11:46] (Version actuelle) admin
Ligne 1: Ligne 1:
 ~~PDF:LANDSCAPE~~ ~~PDF:LANDSCAPE~~
  
-Version **2022.01**+Version **2024.01**
  
 Dernière mise-à-jour : ~~LASTMOD~~ Dernière mise-à-jour : ~~LASTMOD~~
  
-======DOF506 Ansible par la Pratique======+======LDF906 Red Hat® Ansible® Automation Platform======
  
 =====Contenu du Module===== =====Contenu du Module=====
  
-  * **DOF506 Validations des Acquis**+  * **LDF906 Red Hat® Ansible® Automation Platform**
     * Contenu du Module     * Contenu du Module
-    * LAB #1 - Automatiser avec Ansible +    * LAB #1 - Ansible® Automation Controller 
-      * 1.1 - Instructions +      * 1.1 - Préparation 
-      * 1.2 - Corrigés +      * 1.2 - Installation  
-        Erreur #1 +      1.3 - Consultation 
-        Erreur #2 +    * LAB #2 - Ansible® Automation Hub 
-        Erreur #3 +      * 2.- Préparation 
-        Erreurs 4et 6+      2.2 - Installation  
 +      * 2.3 - Consultation 
 +    * LAB #3 - Connecter l'Ansible® Automation Hub et l'Ansible® Automation Controller 
 +      * 3.1 - Configurer Ansible® Automation Hub 
 +      * 3.- Configurer Ansible® Automation Controller 
 +    LAB #4 - Sauvegarder et Restaurer la Plateforme Ansible® Automation 
 +      * 4.1 - Sauvegarder l'Ansible® Automation Controller 
 +      * 4.2 - Sauvegarder l'Ansible® Automation Hub 
 +      * 4.- Restaurer l'Ansible® Automation Hub à l'Identique 
 +    LAB #5 - Utilisation de l'Ansible® Automation Controller 
 +      * 5.1 - Créer un Job Simple 
 +      * 5.2 - Créer un Projet 
 +      * 5.3 - Créer un Inventory 
 +      * 5.- Créer des Informations d'Identification 
 +      * 5.5 - Créer un Gabarit 
 +      * 5.- Exécuter un Job 
 +    * LAB #6 - Utilisation de l'Ansible® Automation Hub 
 +      * 6.1 - Créer une Collection 
 +      * 6.1 - Téléverser une Collection
  
-=====LAB #1 - Automatiser avec Ansible=====+=====LAB#1 - Ansible® Automation Controller=====
  
-Connectez-vous à la machine virtuelle **CentOS_7** :+====1.1 - Préparation==== 
 + 
 +Avant de commencer, ouvrez un compte développeur chez **[[https://developers.redhat.com|Red Hat]]**. 
 + 
 +<WRAP center round important 50%> 
 +**Important** : Notez vos coordonnées de connexion au compte Red Hat. 
 +</WRAP> 
 + 
 +Démarrez votre essai de **[[https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux/server/trial|Red Hat 9]]**. 
 + 
 +<WRAP center round important 50%> 
 +**Important** : Vous n'avez **PAS** besoin de l'iso de Red Hat 9. Annulez donc son téléchargement après que celui-ci a démarré. 
 +</WRAP> 
 + 
 +Connectez-vous ensuite à votre VM **RedHat_10.0.2.101_SSH**. 
 + 
 +Enregistrez la VM dans **votre** compte Red Hat :
  
 <code> <code>
-trainee@traineeXX:~$ ssh -l trainee centos7+[trainee@redhat9 ~]su - 
 +Password: fenestros 
 + 
 +[root@redhat9 ~]# subscription-manager register 
 +Registering to: subscription.rhsm.redhat.com:443/subscription 
 +Username: <login> 
 +Password: <password> 
 +The system has been registered with ID: a85a9fe3-334d-4b0c-9a98-f408e7d3a1e7 
 +The registered system name is: redhat9.ittraining.loc
 </code> </code>
  
-====1.1 - Instructions ====+Configurez SELinux en mode permissive :
  
-Il vous est demandé d'automatiser avec Ansible :+<code> 
 +[root@redhat9 ~]# setenforce permissive 
 +</code>
  
-  * l'installation du serveur vsftpd, +Désarchivez le fichier **ansible-automation-platform-setup-bundle-2.4-2.2-x86_64.tar.gz** et consultez le contenu du répertoire créé :
-  * la mise à jour éventuelle de firewalld, +
-  * la création d'une règle dans firewalld pour le trafic vers le serveur vsfptd, +
-  la création sécurisée de deux comptes ftp : +
-    user : mike +
-      mot de passe : toto +
-    user : bob +
-      * mot de passe tata+
  
-Installez donc Ansible à partir des dépôts :+<code> 
 +[root@redhat9 ~]# tar xvf ansible-automation-platform-setup-bundle-2.4-2.2-x86_64.tar.gz 
 + 
 +[root@redhat9 ~]# cd ansible-automation-platform-setup-bundle-2.4-2.2-x86_64/ 
 + 
 +[root@redhat9 ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# ls 
 +bundle  collections  group_vars  inventory  README.md  setup.sh 
 +</code> 
 + 
 +Consultez le fichier **README.md** :
  
 <code> <code>
-[trainee@centos7 ~]$ su +[root@redhat9 ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# cat README.md  
-Mot de passe fenestros +Red Hat Ansible Automation Platform Deployment 
-Dernière connexion : jeudi 5 septembre 2019 à 18:28:51 CEST sur pts/+============================================== 
-[root@centos7 ~]# yum install epel-release + 
-[root@centos7 ~]# yum install ansible+This collection of files provides a complete set of playbooks for deploying 
 +Red Hat Ansible Automation Platform in your environment on hosts running 
 +Red Hat Enterprise Linux. 
 + 
 +For getting started with installation and setup instructions, please refer to
 + 
 +- Install Guide -- https://access.redhat.com/documentation/en-us/red_hat_ansible_automation_platform/2.4/html-single/red_hat_ansible_automation_platform_installation_guide/index
 </code> </code>
  
-Vérifiez ensuite la présence des exécutables :+<WRAP center round important 50%> 
 +**Important** : Notez l'URL du **[[https://access.redhat.com/documentation/en-us/red_hat_ansible_automation_platform/2.4/html-single/red_hat_ansible_automation_platform_installation_guide/index|guide d'installation]]**. 
 +</WRAP> 
 + 
 +Modifiez le fichier **/etc/hosts** :
  
 <code> <code>
-[root@centos7 ~]# which ansible +[root@redhat9 ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# vi /etc/hosts 
-/bin/ansible +[root@redhat9 ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# cat /etc/hosts 
-[root@centos7 ~]# which ansible-playbook +127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4 
-/bin/ansible-playbook+::1         localhost localhost.localdomain localhost6 localhost6.localdomain6 
 +redhat9.ittraining.loc  10.0.2.101 
 +autohub.ittraining.loc  10.0.2.102
 </code> </code>
  
-Afin de vous aider, on vous fournit deux fichiers :+Installez ensuite le paquet **ansible-core** :
  
 <code> <code>
-[root@centos7 ~]# cat vsftpd.yml +[root@redhat9 ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# dnf install ansible-core 
---- +Updating Subscription Management repositories. 
-name: ftp server install +Red Hat Enterprise Linux 9 for x86_64 - BaseOS (RPMs)                                                                                                                              15 MB/s |  14 MB     00:00     
-  hostslocalhost +Red Hat Enterprise Linux 9 for x86_64 - AppStream (RPMs)                                                                                                                           21 MB/s |  25 MB     00:01     
-  gather_factsno +Last metadata expiration check0:00:03 ago on Fri 20 Oct 2023 12:21:53 PM CEST. 
-  becomeyes +Dependencies resolved. 
-  vars_files+================================================================================================================================================================================================================== 
-    users.yml + Package                                                  Architecture                        Version                                         Repository                                                     Size 
-  tasks+================================================================================================================================================================================================================== 
-    namelatest vsftpd version +Installing
-      yum+ ansible-core                                             x86_64                              2.14.2-5.el9_2                                  rhel-9-for-x86_64-appstream-rpms                              3.4 M 
-        namevsftpd +Installing dependencies
-        statelatest + git-core                                                 x86_64                              2.39.3-1.el9_2                                  rhel-9-for-x86_64-appstream-rpms                              4.3 M 
-    namelatest firewalld version + libnsl2                                                  x86_64                              2.0.0-1.el9                                     rhel-9-for-x86_64-appstream-rpms                               33 k 
-        namefirewalld + mpdecimal                                                x86_64                              2.5.1-3.el9                                     rhel-9-for-x86_64-appstream-rpms                               88 k 
-        statelatest + python3.11                                               x86_64                              3.11.2-2.el9_2.2                                rhel-9-for-x86_64-appstream-rpms                               28 k 
-    - namevsftpd + python3.11-cffi                                          x86_64                              1.15.1-1.el9                                    rhel-9-for-x86_64-appstream-rpms                              315 k 
-      service+ python3.11-cryptography                                  x86_64                              37.0.2-5.el9                                    rhel-9-for-x86_64-appstream-rpms                              1.2 M 
-        name vsftpd + python3.11-libs                                          x86_64                              3.11.2-2.el9_2.2                                rhel-9-for-x86_64-appstream-rpms                              9.9 M 
-        enabledtrue + python3.11-pip-wheel                                     noarch                              22.3.1-2.el9                                    rhel-9-for-x86_64-appstream-rpms                              1.4 M 
-        statestarted + python3.11-ply                                           noarch                              3.11-1.el9                                      rhel-9-for-x86_64-appstream-rpms                              141 k 
-    - namefirewalld + python3.11-pycparser                                     noarch                              2.20-1.el9                                      rhel-9-for-x86_64-appstream-rpms                              161 k 
-      service+ python3.11-pyyaml                                        x86_64                              6.0-1.el9                                       rhel-9-for-x86_64-appstream-rpms                              229 k 
-        namefirewalld + python3.11-setuptools-wheel                              noarch                              65.5.1-2.el9                                    rhel-9-for-x86_64-appstream-rpms                              714 k 
-        enabledtrue + python3.11-six                                           noarch                              1.16.0-1.el9                                    rhel-9-for-x86_64-appstream-rpms                               47 k 
-        statestarted + sshpass                                                  x86_64                              1.09-4.el9                                      rhel-9-for-x86_64-appstream-rpms                               30 k 
-    - namefirewalld allows ftp + 
-      firewalld+Transaction Summary 
-        permanentyes +================================================================================================================================================================================================================== 
-        immediateyes +Install  15 Packages 
-        stateenabled + 
-    nameCreate_FTP_users +Total download size22 M 
-      user+Installed size88 M 
-        password: "{{ item.password | password_hash(sha512}}+Is this ok [y/N]y 
-        with_items"{{ ftp_users }}"+Downloading Packages
 +(1/15): sshpass-1.09-4.el9.x86_64.rpm                                                                                                                                              24 kB/s |  30 kB     00:01     
 +(2/15)libnsl2-2.0.0-1.el9.x86_64.rpm                                                                                                                                             26 kB/s |  33 kB     00:01     
 +(3/15)python3.11-six-1.16.0-1.el9.noarch.rpm                                                                                                                                     36 kB/s |  47 kB     00:01     
 +(4/15): python3.11-pycparser-2.20-1.el9.noarch.rpm                                                                                                                                153 kB/s | 161 kB     00:01     
 +(5/15): python3.11-setuptools-wheel-65.5.1-2.el9.noarch.rpm                                                                                                                       420 kB/s | 714 kB     00:01     
 +(6/15)python3.11-cffi-1.15.1-1.el9.x86_64.rpm                                                                                                                                   179 kB/s | 315 kB     00:01     
 +(7/15)python3.11-pyyaml-6.0-1.el9.x86_64.rpm                                                                                                                                    288 kB/s | 229 kB     00:00     
 +(8/15)python3.11-cryptography-37.0.2-5.el9.x86_64.rpm                                                                                                                           704 kB/s | 1.2 MB     00:01     
 +(9/15): mpdecimal-2.5.1-3.el9.x86_64.rpm                                                                                                                                           55 kB/s |  88 kB     00:01     
 +(10/15): git-core-2.39.3-1.el9_2.x86_64.rpm                                                                                                                                        18 MB/s | 4.3 MB     00:00     
 +(11/15)python3.11-ply-3.11-1.el9.noarch.rpm                                                                                                                                     111 kB/s | 141 kB     00:01     
 +(12/15)python3.11-pip-wheel-22.3.1-2.el9.noarch.rpm                                                                                                                             850 kB/s | 1.4 MB     00:01     
 +(13/15)ansible-core-2.14.2-5.el9_2.x86_64.rpm                                                                                                                                   2.3 MB/s | 3.4 MB     00:01     
 +(14/15)python3.11-3.11.2-2.el9_2.2.x86_64.rpm                                                                                                                                    28 kB/s |  28 kB     00:00     
 +(15/15): python3.11-libs-3.11.2-2.el9_2.2.x86_64.rpm                                                                                                                              5.9 MB/s | 9.9 MB     00:01     
 +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 
 +Total                                                                                                                                                                             3.1 MB/s |  22 MB     00:07      
 +Red Hat Enterprise Linux 9 for x86_64 - AppStream (RPMs)                                                                                                                          3.5 MB/s | 3.6 kB     00:00     
 +Importing GPG key 0xFD431D51
 + Userid     "Red Hat, Inc. (release key 2) <security@redhat.com>" 
 + Fingerprint567E 347A D004 4ADE 55BA 8A5F 199E 2F91 FD43 1D51 
 + From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release 
 +Is this ok [y/N]
 +Key imported successfully 
 +Importing GPG key 0x5A6340B3
 + Userid     : "Red Hat, Inc. (auxiliary key 3<security@redhat.com>
 + Fingerprint7E46 2425 8C40 6535 D56D 6F13 5054 E4A4 5A63 40B3 
 + From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release 
 +Is this ok [y/N]: y
 </code> </code>
 +
 +====1.2 - Installation===
 +
 +Éditez maintenant le fichier **inventory** :
  
 <code> <code>
-[root@centos7 ~]# ansible-vault view secrets.yml +[root@redhat9 ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# vi inventory
-Vault password: fenestros +
-ftp_users: +
- { username: mike, password: toto } +
- { username: bob, password: tata }+
 </code> </code>
  
-Lors de l'exécution de la commande ansible-playback, vous obtenez le résultat suivant :+<file> 
 +... 
 +[automationcontroller] 
 +redhat9.ittraining.loc ansible_connection=local node_type=hybrid 
 +... 
 +</file> 
 + 
 +<WRAP center round important 50%> 
 +**Important** : Cette section configure une installation d'un seul noeud ayant une base de données interne. 
 +</WRAP> 
 + 
 +Configurez ensuite le mot de passe **fenestros** aux endroits indiqués : 
 + 
 +<file> 
 +... 
 +[all:vars] 
 +admin_password='fenestros' 
 + 
 +pg_host='' 
 +pg_port=5432 
 + 
 +pg_database='awx' 
 +pg_username='awx' 
 +pg_password='fenestros' 
 +pg_sslmode='prefer'  # set to 'verify-full' for client-side enforced SSL 
 +... 
 +</file> 
 + 
 +<file> 
 +... 
 +registry_url='registry.redhat.io' 
 +registry_username='yyyyyyyyyyy' 
 +registry_password='xxxxxxxxxxx' 
 +... 
 +</file> 
 + 
 +Cette section configure une installation d'un seul noeud ayant une base de données interne. 
 + 
 +<WRAP center round todo 50%> 
 +**A faire** : **Remplacez** 'yyyyyyyyyyy' avec **votre** Red Hat login et 'xxxxxxxxxxx' avec **votre** mot de passe Red Hat. 
 +</WRAP> 
 + 
 +<file> 
 +... 
 +automationhub_admin_password='fenestros' 
 + 
 +automationhub_pg_host='' 
 +automationhub_pg_port=5432 
 + 
 +automationhub_pg_database='automationhub' 
 +automationhub_pg_username='automationhub' 
 +automationhub_pg_password='fenestros' 
 +automationhub_pg_sslmode='prefer' 
 +... 
 +</file> 
 + 
 +<file> 
 +... 
 +automationedacontroller_admin_password='fenestros' 
 + 
 +automationedacontroller_pg_host='' 
 +automationedacontroller_pg_port=5432 
 + 
 +automationedacontroller_pg_database='automationedacontroller' 
 +automationedacontroller_pg_username='automationedacontroller' 
 +automationedacontroller_pg_password='fenestros' 
 +automationedacontroller_pg_sslmode='prefer' 
 +... 
 +</file> 
 + 
 +<file> 
 +... 
 +# The default install will deploy SSO with sso_use_https=True 
 +# Keystore password is required for https enabled SSO 
 +sso_keystore_password='fenestros' 
 + 
 +# Single-Sign-On configuration 
 +sso_console_admin_password='fenestros' 
 +... 
 +</file> 
 + 
 +Exécutez le script d'installation **setup.sh** et patientez une quinzaine de minutes :
  
 <code> <code>
-[root@centos7 ~]# ansible-playbook vsftpd.yml +[root@redhat9 ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# ./setup.sh  
- [WARNING]: Could not match supplied host pattern, ignoringall+... 
 +PLAY RECAP ********************************************************************* 
 +localhost                  ok=0    changed=0    unreachable=0    failed=0    skipped=1    rescued=0    ignored=0    
 +redhat9.ittraining.loc     ok=374  changed=170  unreachable=0    failed=0    skipped=246  rescued=0    ignored=6  
 +</code>
  
- [WARNING]: provided hosts list is empty, only localhost is available+====1.3 - Consultation====
  
-ERROR! Syntax Error while loading YAML.+Connectez-vous à votre VM **Debian_10.0.2.46_VNC** :
  
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-20_14-58-21.png?800 |}}
  
-The error appears to have been in '/root/vsftpd.yml': line 14, column 13, but may +Ouvrez un navigateur Web et naviguez à **https://10.0.2.101** :
-be elsewhere in the file depending on the exact syntax problem.+
  
-The offending line appears to be:+{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-20_15-03-31.png?800 |}}
  
-    namelatest firewalld version +Acceptez le certificat auto-signé :
-        name: firewalld +
-        ^ here+
  
-exception type<class 'yaml.scanner.ScannerError'> +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-20_15-03-59.png?800 |}} 
-exceptionmapping values are not allowed in this context + 
- in "<unicode string>", line 14, column 13+Connectez-vous à votre Ansible® Automation Controller en utilisant le compte **admin** et le mot de passe **fenestros** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-20_15-04-22.png?800 |}} 
 + 
 +Cliquez sur le bouton **Username/password** et enregistrez votre Ansible® Automation Controller auprès de Red Hat en utilisant **votre** compte 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-20_15-06-26.png?800 |}} 
 + 
 +Vous obtiendrez : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-20_15-07-58.png?800 |}} 
 + 
 +=====LAB #2 - Ansible® Automation Hub===== 
 + 
 +====2.1 - Préparation==== 
 + 
 +Connectez-vous maintenant à votre VM **autohub.ittraining.loc** : 
 + 
 +<code> 
 +[root@redhat9 ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# ssh -l trainee 10.0.2.102
 </code> </code>
  
-A vous de jouer !+Enregistrez la VM dans **votre** compte Red Hat :
  
-[isauth account,@admin]+<code> 
 +[root@autohub ~]# subscription-manager register 
 +Registering to: subscription.rhsm.redhat.com:443/subscription 
 +Username: <login> 
 +Password: <password> 
 +The system has been registered with ID: a85a9fe3-334d-4b0c-9a98-f408e7d3a1e7 
 +The registered system name is: autohub.ittraining.loc 
 +</code>
  
-====1.2 - Corrigés====+Configurez SELinux en mode permissive :
  
-===Erreur #1===+<code> 
 +[root@autohub ~]setenforce permissive 
 +</code>
  
-Éditez le fichier **vsftpd.yml** :+Désarchivez le fichier **ansible-automation-platform-setup-bundle-2.4-2.2-x86_64.tar.gz** et consultez le contenu du répertoire créé :
  
 <code> <code>
-[root@centos7 ~]# vi vsftpd.yml +[root@autohub ~]# tar xvf ansible-automation-platform-setup-bundle-2.4-2.2-x86_64.tar.gz 
-[root@centos7 ~]# cat vsftpd.yml + 
---- +[root@autohub ~]# cd ansible-automation-platform-setup-bundle-2.4-2.2-x86_64/ 
-name: ftp server install + 
-  hosts: localhost +[root@autohub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# ls 
-  gather_facts: no +bundle  collections  group_vars  inventory  README.md  setup.sh
-  become: yes +
-  vars_files: +
-    users.yml +
-  tasks: +
-    name: latest vsftpd version +
-      yum: +
-        name: vsftpd +
-        state: latest +
-    name: latest firewalld version +
-      yum:   <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<Ajouter yum: +
-        name: firewalld +
-        state: latest +
-    name: vsftpd +
-      service: +
-        name vsftpd +
-        enabled: true +
-        state: started +
-    name: firewalld +
-      service: +
-        name: firewalld +
-        enabled: true +
-        state: started +
-    name: firewalld allows ftp +
-      firewalld: +
-        permanent: yes +
-        immediate: yes +
-        state: enabled +
-    name: Create_FTP_users +
-      user: +
-        password: "{{ item.password | password_hash(sha512) }}" +
-        with_items: "{{ ftp_users }}"+
 </code> </code>
  
-Relancez la commande **ansible-playbook** :+Modifiez le fichier **/etc/hosts** selon votre numéro de stagiaire :
  
 <code> <code>
-[root@centos7 ~]# ansible-playbook vsftpd.yml +[root@autohub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# vi /etc/hosts 
-[WARNING]: provided hosts list is empty, only localhost is availableNote that the implicit localhost does not match 'all' +[root@autohub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# cat /etc/hosts 
-ERROR! Syntax Error while loading YAML+127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4 
-  mapping values are not allowed in this context+::1         localhost localhost.localdomain localhost6 localhost6.localdomain6 
 +10.0.2.102       autohub.ittraining.loc 
 +</code>
  
-The error appears to be in '/root/vsftpd.yml'line 20, column 16, but may +Installez ensuite le paquet **ansible-core** : 
-be elsewhere in the file depending on the exact syntax problem.+ 
 +<code> 
 +[root@autohub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# dnf install ansible-core 
 +Updating Subscription Management repositories. 
 +Red Hat Enterprise Linux 9 for x86_64 - BaseOS (RPMs)                                                                                                                              25 MB/s |  14 MB     00:00     
 +Red Hat Enterprise Linux 9 for x86_64 - AppStream (RPMs)                                                                                                                           35 MB/s |  25 MB     00:00     
 +Dependencies resolved. 
 +================================================================================================================================================================================================================== 
 + Package                                                  Architecture                        Version                                         Repository                                                     Size 
 +================================================================================================================================================================================================================== 
 +Installing: 
 + ansible-core                                             x86_64                              2.14.2-5.el9_2                                  rhel-9-for-x86_64-appstream-rpms                              3.4 M 
 +Installing dependencies: 
 + git-core                                                 x86_64                              2.39.3-1.el9_2                                  rhel-9-for-x86_64-appstream-rpms                              4.3 M 
 + libnsl2                                                  x86_64                              2.0.0-1.el9                                     rhel-9-for-x86_64-appstream-rpms                               33 k 
 + mpdecimal                                                x86_64                              2.5.1-3.el9                                     rhel-9-for-x86_64-appstream-rpms                               88 k 
 + python3.11                                               x86_64                              3.11.2-2.el9_2.2                                rhel-9-for-x86_64-appstream-rpms                               28 k 
 + python3.11-cffi                                          x86_64                              1.15.1-1.el9                                    rhel-9-for-x86_64-appstream-rpms                              315 k 
 + python3.11-cryptography                                  x86_64                              37.0.2-5.el9                                    rhel-9-for-x86_64-appstream-rpms                              1.2 M 
 + python3.11-libs                                          x86_64                              3.11.2-2.el9_2.2                                rhel-9-for-x86_64-appstream-rpms                              9.9 M 
 + python3.11-pip-wheel                                     noarch                              22.3.1-2.el9                                    rhel-9-for-x86_64-appstream-rpms                              1.4 M 
 + python3.11-ply                                           noarch                              3.11-1.el9                                      rhel-9-for-x86_64-appstream-rpms                              141 k 
 + python3.11-pycparser                                     noarch                              2.20-1.el9                                      rhel-9-for-x86_64-appstream-rpms                              161 k 
 + python3.11-pyyaml                                        x86_64                              6.0-1.el9                                       rhel-9-for-x86_64-appstream-rpms                              229 k 
 + python3.11-setuptools-wheel                              noarch                              65.5.1-2.el9                                    rhel-9-for-x86_64-appstream-rpms                              714 k 
 + python3.11-six                                           noarch                              1.16.0-1.el9                                    rhel-9-for-x86_64-appstream-rpms                               47 k 
 + sshpass                                                  x86_64                              1.09-4.el9                                      rhel-9-for-x86_64-appstream-rpms                               30 k
  
-The offending line appears to be:+Transaction Summary 
 +================================================================================================================================================================================================================== 
 +Install  15 Packages
  
-        name vsftpd +Total download size: 22 M 
-        enabledtrue +Installed size88 M 
-               ^ here+Is this ok [y/N]: y 
 +Downloading Packages: 
 +(1/15): sshpass-1.09-4.el9.x86_64.rpm                                                                                                                                              24 kB/s |  30 kB     00:01     
 +(2/15): libnsl2-2.0.0-1.el9.x86_64.rpm                                                                                                                                             26 kB/s |  33 kB     00:01     
 +(3/15): python3.11-six-1.16.0-1.el9.noarch.rpm                                                                                                                                     36 kB/s |  47 kB     00:01     
 +(4/15): python3.11-pycparser-2.20-1.el9.noarch.rpm                                                                                                                                153 kB/s | 161 kB     00:01     
 +(5/15): python3.11-setuptools-wheel-65.5.1-2.el9.noarch.rpm                                                                                                                       420 kB/s | 714 kB     00:01     
 +(6/15): python3.11-cffi-1.15.1-1.el9.x86_64.rpm                                                                                                                                   179 kB/s | 315 kB     00:01     
 +(7/15): python3.11-pyyaml-6.0-1.el9.x86_64.rpm                                                                                                                                    288 kB/s | 229 kB     00:00     
 +(8/15): python3.11-cryptography-37.0.2-5.el9.x86_64.rpm                                                                                                                           704 kB/s | 1.2 MB     00:01     
 +(9/15): mpdecimal-2.5.1-3.el9.x86_64.rpm                                                                                                                                           55 kB/s |  88 kB     00:01     
 +(10/15): git-core-2.39.3-1.el9_2.x86_64.rpm                                                                                                                                        18 MB/s | 4.3 MB     00:00     
 +(11/15): python3.11-ply-3.11-1.el9.noarch.rpm                                                                                                                                     111 kB/s | 141 kB     00:01     
 +(12/15): python3.11-pip-wheel-22.3.1-2.el9.noarch.rpm                                                                                                                             850 kB/s | 1.4 MB     00:01     
 +(13/15): ansible-core-2.14.2-5.el9_2.x86_64.rpm                                                                                                                                   2.3 MB/s | 3.4 MB     00:01     
 +(14/15): python3.11-3.11.2-2.el9_2.2.x86_64.rpm                                                                                                                                    28 kB/s |  28 kB     00:00     
 +(15/15): python3.11-libs-3.11.2-2.el9_2.2.x86_64.rpm                                                                                                                              5.9 MB/s | 9.9 MB     00:01     
 +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 
 +Total                                                                                                                                                                             3.1 MB/s |  22 MB     00:07      
 +Red Hat Enterprise Linux 9 for x86_64 - AppStream (RPMs)                                                                                                                          3.5 MB/s | 3.6 kB     00:00     
 +Importing GPG key 0xFD431D51: 
 + Userid     : "Red Hat, Inc. (release key 2) <security@redhat.com>" 
 + Fingerprint: 567E 347A D004 4ADE 55BA 8A5F 199E 2F91 FD43 1D51 
 + From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release 
 +Is this ok [y/N]: y 
 +Key imported successfully 
 +Importing GPG key 0x5A6340B3: 
 + Userid     : "Red Hat, Inc. (auxiliary key 3) <security@redhat.com>" 
 + Fingerprint: 7E46 2425 8C40 6535 D56D 6F13 5054 E4A4 5A63 40B3 
 + From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release 
 +Is this ok [y/N]: y
 </code> </code>
  
-===Erreur #2===+====2.2 - Installation====
  
-Editez le fichier **vsftpd.yml** :+Éditez maintenant le fichier **inventory** :
  
 <code> <code>
-[root@centos7 ~]# vi vsftpd.yml +[root@autohub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# vi inventory
-[root@centos7 ~]# cat vsftpd.yml +
---- +
-name: ftp server install +
-  hosts: localhost +
-  gather_facts: no +
-  become: yes +
-  vars_files: +
-    users.yml +
-  tasks: +
-    name: latest vsftpd version +
-      yum: +
-        name: vsftpd +
-        state: latest +
-    name: latest firewalld version +
-      yum:   <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<Ajouter yum: +
-        name: firewalld +
-        state: latest +
-    - name: vsftpd +
-      service: +
-        name: vsftpd <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<Ajouter le caractère : après name +
-        enabled: true +
-        state: started +
-    - name: firewalld +
-      service: +
-        name: firewalld +
-        enabled: true +
-        state: started +
-    - name: firewalld allows ftp +
-      firewalld: +
-        permanent: yes +
-        immediate: yes +
-        state: enabled +
-    - name: Create_FTP_users +
-      user: +
-        password: "{{ item.password | password_hash(sha512) }}" +
-        with_items: "{{ ftp_users }}"+
 </code> </code>
  
-Relancez la commande **ansible-playbook** :+<file> 
 +... 
 +[automationhub] 
 +autohub.ittraining.loc ansible_connection=local 
 +... 
 +</file> 
 + 
 +<file> 
 +... 
 +# Automation Hub Configuration 
 +
 + 
 +automationhub_admin_password='fenestros' 
 + 
 +automationhub_pg_host='' 
 +automationhub_pg_port=5432 
 + 
 +automationhub_pg_database='automationhub' 
 +automationhub_pg_username='automationhub' 
 +automationhub_pg_password='fenestros' 
 +automationhub_pg_sslmode='prefer' 
 +... 
 +</file> 
 + 
 +Exécutez le script d'installation **setup.sh** et patientez une quinzaine de minutes :
  
 <code> <code>
-[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all' +[root@autohub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# ./setup.sh 
-ERRORvars file users.yml was not found +... 
-Could not find file on the Ansible Controller. +PLAY RECAP ********************************************************************* 
-If you are using a module and expect the file to exist on the remote, see the remote_src option+autohub.ittraining.loc     ok=165  changed=51   unreachable=0    failed=2    skipped=173  rescued=0    ignored=0    
 +localhost                  : ok=0    changed=0    unreachable=0    failed=0    skipped=1    rescued=0    ignored=0    
 + 
 +[error] Oops An error occurred while running setup
 +[warn] /var/log/tower does not existSetup log saved to setup.log. 
 +[warn] Provided path does not exist or is not accessible. Setup log saved to ./setup.log.
 </code> </code>
  
-===Erreur #3===+En cas d'erreur(s), ré-exécutez le script setup.sh :
  
-Créez le fichier **users.yml** :+<code> 
 +[root@autohub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# ./setup.sh  
 +... 
 +PLAY RECAP ********************************************************************* 
 +autohub.ittraining.loc     : ok=900  changed=150  unreachable=0    failed=0    skipped=379  rescued=0    ignored=0    
 +localhost                  : ok=0    changed=0    unreachable=0    failed=0    skipped=1    rescued=0    ignored=0    
 + 
 +The setup process completed successfully. 
 +[warn] /var/log/tower does not exist. Setup log saved to setup.log. 
 +[warn] Provided path does not exist or is not accessible. Setup log saved to ./setup.log. 
 +</code> 
 + 
 +====2.3 - Consultation==== 
 + 
 +Connectez-vous à votre VM **Debian_10.0.2.46_VNC** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-20_14-58-21.png?800 |}} 
 + 
 +Ouvrez un navigateur Web et naviguez à **https://10.0.2.102** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-23_13-45-08.png?800 |}} 
 + 
 +Acceptez le certificat auto-signé : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-23_13-45-47.png?800 |}} 
 + 
 +Connectez-vous à votre Ansible® Automation Hub en utilisant le compte **admin** et le mot de passe **fenestros** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-23_13-47-59.png?800 |}} 
 + 
 +Vous obtiendrez : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-23_13-46-39.png?800 |}} 
 + 
 +=====LAB #3 - Connecter l'Ansible® Automation Hub et l'Ansible® Automation Controller===== 
 + 
 +====3.1 - Configurer Ansible® Automation Hub==== 
 + 
 +Dans l'interface de votre Ansible® Automation Hub, cliquez sur **Collections > API token > Load token** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-23_14-41-04.png?800 |}} 
 + 
 +Copiez le token ainsi généré : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-23_14-42-06.png?800 |}} 
 + 
 +Collez ce token dans un bloc-note (mousepad) : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-23_14-43-04.png?800 |}} 
 + 
 +====3.2 - Configurer Ansible® Automation Controller==== 
 + 
 +Ouvrez l'interface de votre Ansible® Automation Controller : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-23_14-44-21.png?800 |}} 
 + 
 +Naviguez à **Resources > Credentials** et cliquez sur le bouton **Add** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-23_14-53-41.png?800 |}} 
 + 
 +Renseignez les champs **Name**, **Description** et **Galaxy Server URL**. Choisissez **Galaxy/Automation Hub API Token** dans le menu déroulant **Credential Type** et collez le token API dans **API token** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-23_14-58-29.png?800 |}} 
 + 
 +Cliquez sur la loupe à gauche du champs **Organization** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-23_14-59-02.png?800 |}} 
 + 
 +Cochez l'organisation **Default** et cliquez sur le bouton **Select** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-23_14-59-23.png?800 |}} 
 + 
 +Validez en cliquant sur le bouton **Save** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-23_14-59-43.png?800 |}} 
 + 
 +Vous obtiendrez : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-23_15-00-08.png?800 |}} 
 + 
 +Cliquez sur **Settings > Jobs settings** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-23_15-02-26.png?800 |}} 
 + 
 +Vous obtiendrez : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-23_15-03-51.png?800 |}} 
 + 
 +Descendez la page et cliquez sur le bouton **Edit** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-23_15-04-32.png?800 |}} 
 + 
 +Activez l'option **Ignore Ansible Galaxy SSL Certificate Validation** pour permettre l'utilisation de votre certificat auto-signé : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-23_15-05-05.png?800 |}} 
 + 
 +Descendez en bas de la page et cliquez sur le bouton **Save** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-23_15-05-28.png?800 |}} 
 + 
 +Naviguez à **Organizations** et cliquez sur l'icône d'un stylo à droite du nom **Default** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-23_15-08-17.png?800 |}} 
 + 
 +Dans le champs **Galaxy Credentials**, supprimez **Ansible Galaxy** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-23_15-08-44.png?800 |}} 
 + 
 +Cliquez sur la loupe à gauche du champs **Galaxy Credentials** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-23_15-09-02.png?800 |}} 
 + 
 +Vous obtiendrez : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-23_15-09-29.png?800 |}} 
 + 
 +Cochez **Autohub** PUIS **Ansible Galaxy** puis cliquez sur le bouton **Select** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-23_15-10-21.png?800 |}} 
 + 
 +Cliquez ensuite sur le bouton **Save** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-23_15-10-44.png?800 |}} 
 + 
 +Vous obtiendrez : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-23_15-11-57.png?800 |}} 
 + 
 +<WRAP center round tip 50%> 
 +**Good News** : Votre Ansible® Automation Hub et votre Ansible® Automation Controller sont maintenant connectés. 
 +</WRAP> 
 + 
 +=====LAB #4 - Sauvegarder et Restaurer la Plateforme Ansible® Automation===== 
 + 
 +====4.1 - Sauvegarder l'Ansible® Automation Controller==== 
 + 
 +Revenez dans votre Ansible® Automation Controller. 
 + 
 +La sauvegarde de l'Ansible® Automation Controller s'effectue en utilisant le même script utilisé pour l'installation auquel il convient de passer l'option **-b** :
  
 <code> <code>
-[root@centos7 ~]# vi users.yml +[root@redhat9 ~]# cd ansible-automation-platform-setup-bundle-2.4-2.2-x86_64/ 
-[root@centos7 ~]# cat users.yml  +[root@redhat9 ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# ./setup.sh -b 
-ftp_users+... 
- - { username: mike, passwordtoto } +PLAY RECAP ********************************************************************* 
- { usernamebob, passwordtata }+localhost                  ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0    
 +redhat9.ittraining.loc     ok=91   changed=49   unreachable=0    failed=0    skipped=90   rescued=0    ignored=0    
 + 
 +The setup process completed successfully. 
 +Setup log saved to /var/log/tower/backup-2023-10-24-10:43:16.log.
 </code> </code>
  
-Relancez la commande **ansible-playbook** :+A l'issue de la sauvegarde vous constaterez la présence d'une archive **tar.gz** ainsi qu'un lien symbolique dénommé **automation-platform-backup-latest.tar.gz** dans le répertoire **courant** :
  
 <code> <code>
-[root@centos7 ~]# mv user.yml users.yml  +[root@redhat9 ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# ls -l 
-[root@centos7 ~]# ansible-playbook vsftpd.yml +total 108 
-[WARNING]provided hosts list is empty, only localhost is availableNote that the implicit localhost does not match 'all'+-rw-------1 root root 74610 Oct 24 10:43 automation-platform-backup-2023-10-24-10:43:19.tar.gz 
 +lrwxrwxrwx. 1 root root   117 Oct 24 10:43 automation-platform-backup-latest.tar.gz -> /root/ansible-automation-platform-setup-bundle-2.4-2.2-x86_64/./automation-platform-backup-2023-10-24-10:43:19.tar.gz 
 +drwxr-xr-x. 5 root root    55 Oct 13 17:00 bundle 
 +drwxr-xr-x3 root root    33 Oct 13 16:56 collections 
 +drwxr-xr-x. 2 root root    17 Oct 13 16:56 group_vars 
 +-rw-r--r--. 1 root root  9063 Oct 20 12:21 inventory 
 +-rw-r--r--. 1 root root   530 Oct 13 17:11 README.md 
 +-rwxr-xr-x. 1 root root 14780 Oct 13 16:56 setup.sh 
 +</code>
  
-PLAY [ftp server install] ***********************************************************************************************************************************************+Dans ce cas, la taille de l'archive est de 76K :
  
-TASK [latest vsftpd version*******************************************************************************************************************************************+<code> 
-changed[localhost]+[root@redhat9 ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# du -hs automation-platform-backup-
 +76K     automation-platform-backup-2023-10-24-10:43:19.tar.gz 
 +0       automation-platform-backup-latest.tar.gz 
 +</code>
  
-TASK [latest firewalld version] ***************************************************************************************************************************************** +====4.2 - Sauvegarder l'Ansible® Automation Hub====
-changed: [localhost]+
  
-TASK [vsftpd] *********************************************************************************************************************************************************** +Connectez-vous maintenant à votre VM **autohub.ittraining.loc** :
-changed[localhost]+
  
-TASK [firewalld******************************************************************************************************************************************************** +<code> 
-ok: [localhost]+[root@redhat9 ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# ssh -l trainee 10.0.2.102 
 +</code>
  
-TASK [firewalld allows ftp] ********************************************************************************************************************************************* +La sauvegarde de l'Ansible® Automation Hub s'effectue en utilisant le même script utilisé pour l'installation auquel il convient de passer l'option **-b** :
-ok[localhost]+
  
-TASK [Create_FTP_users************************************************************************************************************************************************* +<code> 
-fatal[localhost]FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'sha512' is undefined\n\nThe error appears to be in '/root/vsftpd.yml': line 32, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n        state: enabled\n    - name: Create_FTP_users\n      ^ here\n"}+[root@autohub ~]# cd ansible-automation-platform-setup-bundle-2.4-2.2-x86_64/ 
 +[root@autohub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# ./setup.sh -b 
 +... 
 +PLAY RECAP ********************************************************************* 
 +autohub.ittraining.loc     ok=70   changed=29   unreachable=0    failed=0    skipped=114  rescued=0    ignored=0    
 +localhost                  ok=   changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
  
-PLAY RECAP ************************************************************************************************************************************************************** +The setup process completed successfully. 
-localhost                  : ok=5    changed=3    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0  +[warn] /var/log/tower does not exist. Setup log saved to backup.log. 
 +[warn] Provided path does not exist or is not accessible. Setup log saved to ./backup.log.
 </code> </code>
  
-===Erreurs 4, 5 et 6===+A l'issue de la sauvegarde vous constaterez la présence d'une archive **tar.gz** ainsi qu'un lien symbolique dénommé **automation-platform-backup-latest.tar.gz** dans le répertoire **courant** :
  
 <code> <code>
-[root@centos7 ~]# vi vsftpd.yml +[root@autohub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# ls -l 
-[root@centos7 ~]# cat vsftpd.yml +total 612124 
---- +-rw-------. 1 root root 621857468 Oct 24 11:09 automation-platform-backup-2023-10-24-11:07:36.tar.gz 
-name: ftp server install +lrwxrwxrwx. 1 root root       117 Oct 24 11:09 automation-platform-backup-latest.tar.gz -> /root/ansible-automation-platform-setup-bundle-2.4-2.2-x86_64/./automation-platform-backup-2023-10-24-11:07:36.tar.gz 
-  hosts: localhost +-rw-r-----. 1 root root    116738 Oct 24 11:09 backup.log 
-  gather_facts: no +drwxr-xr-x. 5 root root        55 Oct 13 17:00 bundle 
-  become: yes +-rw-r--r--. 1 root root      1751 Oct 23 12:28 certified_collection_seed_2023-10-23-12-13-33.log 
-  vars_files: +drwxr-xr-x. 3 root root        33 Oct 13 16:56 collections 
-    users.yml +drwxr-xr-x. 2 root root        17 Oct 13 16:56 group_vars 
-  tasks: +-rw-r--r--. 1 root root      8962 Oct 23 11:23 inventory 
-    namelatest vsftpd version +-rw-r--r--. 1 root root       530 Oct 13 17:11 README.md 
-      yum+-rw-r-----. 1 root root   4796277 Oct 23 12:32 setup.log 
-        name: vsftpd +-rwxr-xr-x1 root root     14780 Oct 13 16:56 setup.sh 
-        state: latest +-rw-r--r--. 1 root root       605 Oct 23 12:31 validated_collection_seed_2023-10-23-12-28-02.log
-    namelatest firewalld version +
-      yum:   <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<Ajouter yum+
-        namefirewalld +
-        statelatest +
-    name: vsftpd +
-      service+
-        namevsftpd <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<Ajouter le caractère : après name +
-        enabledtrue +
-        state: started +
-    name: firewalld +
-      service+
-        name: firewalld +
-        enabled: true +
-        state: started +
-    namefirewalld allows ftp +
-      firewalld: +
-        permanent: yes +
-        immediate: yes +
-        state: enabled +
-    nameCreate_FTP_users +
-      user: +
-        name: "{{ item.username }}"  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<Ajouter la ligne name: +
-        password: "{{ item.password | password_hash('sha512') }}" <<<<<<<<<<<<Entourer sha512 avec des caractères ' +
-      with_items: "{{ ftp_users }}" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<Aligner with_items: avec user:+
 </code> </code>
  
-Relancez la commande **ansible-playbook** :+Dans ce cas, la taille de l'archive est de 594M :
  
 <code> <code>
-[root@centos7 ~]# ansible-playbook vsftpd.yml +[root@autohub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# du -hs automation-platform-backup-* 
-[WARNING]: provided hosts list is empty, only localhost is availableNote that the implicit localhost does not match 'all'+594M    automation-platform-backup-2023-10-24-11:07:36.tar.gz 
 +0       automation-platform-backup-latest.tar.gz 
 +</code>
  
-PLAY [ftp server install] ***********************************************************************************************************************************************+====4.3 - Restaurer l'Ansible® Automation Hub à l'Identique====
  
-TASK [latest vsftpd version] ******************************************************************************************************************************************** +Copiez le fichier **automation-platform-backup-2023-10-24-11:07:36.tar.gz** vers le fichier **automation-platform-backup.tar.gz** :
-ok[localhost]+
  
-TASK [latest firewalld version] ***************************************************************************************************************************************** +<code> 
-ok: [localhost]+[root@autohub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# cp automation-platform-backup-2023-10-24-11\:07\:36.tar.gz automation-platform-backup.tar.gz 
 +</code>
  
-TASK [vsftpd] *********************************************************************************************************************************************************** +Copiez le fichier **automation-platform-backup.tar.gz** vers votre VM **backuphub** selon votre numéro de stagiaire :
-ok[localhost]+
  
-TASK [firewalld******************************************************************************************************************************************************** +<code> 
-ok: [localhost]+[root@autohub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# scp automation-platform-backup.tar.gz trainee@10.0.2.103:/home/trainee 
 +The authenticity of host '10.0.2.103 (10.0.2.103)' can't be established. 
 +ED25519 key fingerprint is SHA256:k/cooDrUynjprBohmFjJd22Ii2xlCXFdTHt/HAXpDE4. 
 +This key is not known by any other names 
 +Are you sure you want to continue connecting (yes/no/[fingerprint])? yes 
 +Warning: Permanently added '10.0.2.103' (ED25519) to the list of known hosts. 
 +trainee@10.0.2.103's password: trainee 
 +automation-platform-backup.tar.gz                                                                                                                        100%  593MB 315.5MB/  00:01 
 +</code>
  
-TASK [firewalld allows ftp] ********************************************************************************************************************************************* +Copiez ensuite le fichier **inventory** vers votre VM **backuphub** selon votre numéro de stagiaire :
-ok[localhost]+
  
-TASK [Create_FTP_users] ************************************************************************************************************************************************* +<code> 
-changed: [localhost=> (item={u'username'u'mike', u'password'u'toto'}) +[root@autohub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# scp inventory trainee@10.0.2.103:/home/trainee 
-changed[localhost] =(item={u'username': u'bob', u'password': u'tata'})+trainee@10.0.2.103'password: trainee 
 +inventory                                                                                                                                                100% 8962     8.9MB/  00:00 
 +</code>
  
-PLAY RECAP ************************************************************************************************************************************************************** +Connectez-vous maintenant à votre VM **backuphub** selon votre numéro de stagiaire : 
-localhost                  : ok=6    changed=1    unreachable=   failed=   skipped=   rescued=0    ignored=0  + 
 +<code> 
 +[root@autohub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# ssh -l trainee 10.0.2.103 
 +trainee@10.0.2.103's password: trainee 
 +Register this system with Red Hat Insights: insights-client --register 
 +Create an account or view all your systems at https://red.ht/insights-dashboard 
 +Last login: Tue Oct 24 13:02:01 2023 from 10.0.2.1 
 +[trainee@backuphub ~]$ su - 
 +Password: fenestros 
 +[root@backuphub ~]#
 </code> </code>
  
-Crypter le fichier users.yml :+Enregistrez la VM dans **votre** compte Red Hat :
  
 <code> <code>
-[root@centos7 ~]# ansible-vault encrypt users.yml +[root@backuphub ~]# subscription-manager register 
-New Vault passwordfenestros +Registering to: subscription.rhsm.redhat.com:443/subscription 
-Confirm New Vault password: fenestros +Username<login> 
-Encryption successful+Password: <password
 +The system has been registered with IDa52fe25b-0bfd-4c60-8898-68de681c9fda 
 +The registered system name is: backuphub.ittraining.loc
 </code> </code>
  
-Consultez le fichier users.yml :+Configurez SELinux en mode permissive :
  
 <code> <code>
-[root@centos7 ~]# ansible-vault view users.yml +[root@backuphub ~]# setenforce permissive 
-Vault password:  +</code> 
-ftp_users: + 
- { username: mike, password: toto } +Désarchivez le fichier **ansible-automation-platform-setup-bundle-2.4-2.2-x86_64.tar.gz** et consultez le contenu du répertoire créé 
- { username: bob, password: tata }+ 
 +<code> 
 +[root@backuphub ~]# tar xvf ansible-automation-platform-setup-bundle-2.4-2.2-x86_64.tar.gz 
 + 
 +[root@backuphub ~]# cd ansible-automation-platform-setup-bundle-2.4-2.2-x86_64/
  
-[root@centos7 ~]# cat users.yml  +[root@autohub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# ls 
-$ANSIBLE_VAULT;1.1;AES256 +bundle  collections  group_vars  inventory  README.md  setup.sh
-30323061313265353234666230373765333865663061626362646332376639356463623238343166 +
-3635356261383732373633626230353837393735393933390a323561663963666262343835363166 +
-61306137383463303138656131626236633935383031323864396164366139323265653732663834 +
-6130656163356661360a663635333537373961616230353766666130633537323065663161393939 +
-65353936613539303631373530643536616335356461323735646165616136303839636166663232 +
-38616133393235636632646461346430373966306463636662333431373936633837616336326461 +
-38633139616339343865626630333531366138313761663330346231333131346535663761396233 +
-35353036373530323636636335336539616433373461653866316138306632323038626266623264 +
-6634+
 </code> </code>
  
-Exécutez le playbook :+Installez le paquet **ansible-core** :
  
 <code> <code>
-[root@centos7 ~]# ansible-playbook vsftpd.yml --ask-vault-pass +[root@backuphub ~]# dnf install ansible-core 
-Vault password: fenestros +</code>
-[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'+
  
-PLAY [ftp server install] *************************************************************************************************************************************************+Copiez le fichier **/home/trainee/automation-platform-backup.tar.gz** dans le répertoire courant :
  
-TASK [latest vsftpd version********************************************************************************************************************************************** +<code> 
-ok: [localhost]+[root@backuphub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# cp /home/trainee/automation-platform-backup.tar.gz . 
 +</code>
  
-TASK [latest firewalld version] ******************************************************************************************************************************************* +Ajoutez un lien symbolique vers le fichier **automation-platform-backup.tar.gz** :
-ok[localhost]+
  
-TASK [vsftpd************************************************************************************************************************************************************* +<code> 
-ok: [localhost]+[root@backuphub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# ln -s automation-platform-backup.tar.gz automation-platform-backup-latest.tar.gz  
 +[root@backuphub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# ls -l 
 +total 607316 
 +lrwxrwxrwx. 1 root root        33 Oct 24 13:26 automation-platform-backup-latest.tar.gz -> automation-platform-backup.tar.gz 
 +-rw-------. 1 root root 621857468 Oct 24 13:22 automation-platform-backup.tar.gz 
 +drwxr-xr-x. 5 root root        55 Oct 13 17:00 bundle 
 +drwxr-xr-x. 3 root root        33 Oct 13 16:56 collections 
 +drwxr-xr-x. 2 root root        17 Oct 13 16:56 group_vars 
 +-rw-r--r--. 1 root root      8896 Oct 13 16:56 inventory 
 +-rw-r--r--. 1 root root       530 Oct 13 17:11 README.md 
 +-rwxr-xr-x. 1 root root     14780 Oct 13 16:56 setup.sh 
 +</code>
  
-TASK [firewalld] ********************************************************************************************************************************************************** +<WRAP center round important 50%> 
-ok: [localhost]+**Important** : Le processus de restauration recherche le fichier identifié par le lien symbolique **automation-platform-backup-latest.tar.gz**. 
 +</WRAP>
  
-TASK [firewalld allows ftp] *********************************************************************************************************************************************** +Copiez le fichier **/home/trainee/inventory** dans le répertoire courant :
-ok[localhost]+
  
-TASK [Create_FTP_users*************************************************************************************************************************************************** +<code> 
-changed[localhost] => (item={u'username': u'mike', u'password': u'toto'}) +[root@backuphub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# cp /home/trainee/inventory . 
-changed: [localhost] =(item={u'username': u'bob', u'password': u'tata'})+cpoverwrite './inventory'? y 
 +</code>
  
-PLAY RECAP **************************************************************************************************************************************************************** +Modifiez le nom d'hôte de la VM : 
-localhost                  ok=7    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   + 
 +<code> 
 +[root@backuphub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# hostnamectl set-hostname autohub.ittraining.loc
 </code> </code>
  
-Notez que malgré le fait que le fichier **users.yml** soit crypté, les mots de passe des utilisateurs apparaissent en clair lors de l'exécution de la commande **ansible-playbook**. Pour palier à ce problème de sécurité, ajoutez **no_log: True** à la fin du fichier **vsftpd.yml** :+Modifiez le fichier **/etc/hosts** :
  
 +<code>
 +[root@backuphub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# vi /etc/hosts
 +[root@backuphub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# cat /etc/hosts
 +127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
 +::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
 +10.0.2.103      autohub.ittraining.loc
 +</code>
 +
 +Installez maintenant un nouvel Ansible® Automation Hub :
  
 <code> <code>
-[root@centos7 ~]# vi vsftpd.yml +[root@backuphub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# ./setup.sh
-[root@centos7 ~]# cat vsftpd.yml+
 ... ...
-    - nameCreate_FTP_users +PLAY RECAP ********************************************************************* 
-      user+autohub.ittraining.loc     : ok=165  changed=51   unreachable=0    failed=2    skipped=173  rescued=0    ignored=0    
-        name: "{{ item.username }}" # pas d'instruction name +localhost                  ok=0    changed=0    unreachable=0    failed=0    skipped=1    rescued=0    ignored=0    
-        password: "{{ item.password | password_hash('sha512') }}" # erreur de guillement + 
-      with_items: "{{ ftp_users }}" # erreur d'indentation +[error] Oops!  An error occurred while running setup
-      no_log: True+[warn] /var/log/tower does not exist. Setup log saved to setup.log
 +[warn] Provided path does not exist or is not accessible. Setup log saved to ./setup.log.
 </code> </code>
  
-De cette façon lors de l'exécution de la commande **ansible-playbook** vous obtiendrez :+En cas d'erreur(s), ré-exécutez le script setup.sh :
  
 <code> <code>
-[root@centos7 ~]# ansible-playbook vsftpd.yml --ask-vault-pass +[root@backuphub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# ./setup.sh
-Vault password: fenestros +
-[WARNING]: provided hosts list is empty, only localhost is availableNote that the implicit localhost does not match 'all'+
 ... ...
-TASK [Create_FTP_users] *************************************************************************************************************************************************** +PLAY RECAP ********************************************************************* 
-changed[localhost] => (item=None) +autohub.ittraining.loc     ok=900  changed=150  unreachable=0    failed=0    skipped=379  rescued=0    ignored=0    
-changed: [localhost] => (item=None)+localhost                  : ok=0    changed=0    unreachable=0    failed=0    skipped=1    rescued=0    ignored=0   
  
-PLAY RECAP **************************************************************************************************************************************************************** +The setup process completed successfully. 
-localhost                  : ok=7    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0 +[warn] /var/log/tower does not exist. Setup log saved to setup.log. 
 +[warn] Provided path does not exist or is not accessible. Setup log saved to ./setup.log.
 </code> </code>
  
-[/isauth]+Dernièrement, procédez à la restauration : 
 + 
 +<code> 
 +[root@backuphub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# ./setup.sh -r 
 +... 
 +PLAY RECAP ********************************************************************* 
 +autohub.ittraining.loc     : ok=78   changed=23   unreachable=0    failed=0    skipped=101  rescued=0    ignored=0    
 + 
 +The setup process completed successfully. 
 +[warn/var/log/tower does not exist. Setup log saved to restore.log. 
 +[warn] Provided path does not exist or is not accessible. Setup log saved to ./restore.log. 
 +</code> 
 + 
 +=====LAB #5 - Utilisation de l'Ansible® Automation Controller===== 
 + 
 +====5.1 - Créer un Job Simple==== 
 + 
 +Revenez dans votre Ansible® Automation Controller. 
 + 
 +Commencez par créer un playbook simple, destiné à imprimer la phrase **Hello World!** : 
 + 
 +<code> 
 +[root@redhat9 ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# cd ~ 
 + 
 +[root@redhat9 ~]# vi hello-world.yml 
 + 
 +[root@redhat9 ~]# cat hello-world.yml 
 +--- 
 +- hosts: all 
 +  tasks: 
 +    - name: Hello World 
 +      debug: 
 +        msg: Hello World! 
 +</code> 
 + 
 +Vérifiez la syntaxe de ce playbook : 
 + 
 +<code> 
 +[root@redhat9 ~]# ansible-playbook --syntax-check hello-world.yml 
 +[WARNING]: provided hosts list is empty, only localhost is available. Note that the 
 +implicit localhost does not match 'all' 
 + 
 +playbook: hello-world.yml 
 +</code> 
 + 
 +Notez l'avertissement **[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'**. En effet, Ansible ne trouve pas de fichier inventory. Créez donc le fichier inventory : 
 + 
 +<code> 
 +[root@redhat9 ~]# vi inventory 
 +[root@redhat9 ~]# cat inventory 
 +[Test] 
 +localhost ansible_connection=local 
 +</code> 
 + 
 +Vérifiez de nouveau la syntaxe de ce playbook : 
 + 
 +<code> 
 +[root@redhat9 ~]# ansible-playbook --syntax-check hello-world.yml 
 +[WARNING]: provided hosts list is empty, only localhost is available. Note that the 
 +implicit localhost does not match 'all' 
 + 
 +playbook: hello-world.yml 
 +</code> 
 + 
 +Notez l'avertissement **[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'**. En effet, Ansible cherche les fichiers inventory **/etc/ansible/hosts**. Bien que ce fichier existe, il est vide de toute déclaration active : 
 + 
 +<code> 
 +[root@redhat9 ~]# ls -l /etc/ansible/hosts  
 +-rw-r--r--. 1 root root 1018 Jun  5 17:30 /etc/ansible/hosts 
 +[root@redhat9 ~]# cat /etc/ansible/hosts  
 +# This is the default ansible 'hosts' file. 
 +
 +# It should live in /etc/ansible/hosts 
 +
 +#   - Comments begin with the '#' character 
 +#   - Blank lines are ignored 
 +#   - Groups of hosts are delimited by [header] elements 
 +#   - You can enter hostnames or ip addresses 
 +#   - A hostname/ip can be a member of multiple groups 
 + 
 +# Ex 1: Ungrouped hosts, specify before any group headers: 
 + 
 +## green.example.com 
 +## blue.example.com 
 +## 192.168.100.1 
 +## 192.168.100.10 
 + 
 +# Ex 2: A collection of hosts belonging to the 'webservers' group: 
 + 
 +## [webservers] 
 +## alpha.example.org 
 +## beta.example.org 
 +## 192.168.1.100 
 +## 192.168.1.110 
 + 
 +# If you have multiple hosts following a pattern, you can specify 
 +# them like this: 
 + 
 +## www[001:006].example.com 
 + 
 +# Ex 3: A collection of database servers in the 'dbservers' group: 
 + 
 +## [dbservers] 
 +## 
 +## db01.intranet.mydomain.net 
 +## db02.intranet.mydomain.net 
 +## 10.25.1.56 
 +## 10.25.1.57 
 + 
 +# Here's another example of host ranges, this time there are no 
 +# leading 0s: 
 + 
 +## db-[99:101]-node.example.com 
 + 
 +</code> 
 + 
 +Testez le playbook en indiquant le fichier inventory créé au dessus : 
 + 
 +<code> 
 +[root@redhat9 ~]# ansible-playbook -i inventory hello-world.yml  
 + 
 +PLAY [all] *************************************************************************** 
 + 
 +TASK [Gathering Facts] *************************************************************** 
 +ok: [localhost] 
 + 
 +TASK [Hello World] ******************************************************************* 
 +ok: [localhost] => { 
 +    "msg": "Hello World!" 
 +
 + 
 +PLAY RECAP *************************************************************************** 
 +localhost                  : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
 +</code> 
 + 
 +====5.2 - Créer un Projet==== 
 + 
 +Pour exécuter ce même playbook avec Red Hat® Ansible® Automation Platform, il faut créer un projet. Les projets sont des répertoire dans **/var/lib/awx/projects** et doivent contenir le(s) playbook(s) : 
 + 
 +<code> 
 +[root@redhat9 ~]# mkdir /var/lib/awx/projects/myrepo 
 +[root@redhat9 ~]# cp hello-world.yml /var/lib/awx/projects/myrepo 
 +</code> 
 + 
 +Connectez-vous à votre **VM Debian_10.0.2.46_VNC**. Ouvrez un navigateur Web et naviguez à **https://10.0.2.101** :  
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-26_15-26-39.png?800 |}} 
 + 
 +Cliquez sur **Projects** puis sur le bouton **Add** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-26_15-27-34.png?800 |}} 
 + 
 +Indiquez **Test Project** dans **Name**, **My test Project** dans **Description**, choisissez **myrepo** dans **Playbook Directory** et cliquez sur le bouton **Save** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-26_15-34-15.png?800 |}} 
 + 
 +Vérifiez les informations de votre projet : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-26_15-35-21.png?800 |}} 
 + 
 +====5.3 - Créer un Inventory==== 
 + 
 +Cliquez ensuite sur **Inventories** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-26_15-36-12.png?800 |}} 
 + 
 +Cliquez sur le lien **Demo Inventory** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-26_15-37-05.png?800 |}} 
 + 
 +Cliquez sur le lien **Hosts** et cochez **localhost** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-26_15-39-48.png?800 |}} 
 + 
 +====5.4 - Créer des Informations d'Identification==== 
 + 
 +Cliquez sur **Credentials** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-26_15-40-55.png?800 |}} 
 + 
 +Éditez **Demo Credential** en indiquant **trainee** en tant que **Username** et **trainee** en tant que **Password** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-26_15-45-09.png?800 |}} 
 + 
 +Cliquez sur le bouton **Save** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-26_15-45-46.png?800 |}} 
 + 
 +Vous obtiendrez : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-26_15-46-12.png?800 |}} 
 + 
 +====5.5 - Créer un Gabarit==== 
 + 
 +Cliquez sur **Templates** puis cliquez sur **Demo Job Template** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-26_15-46-33.png?800 |}} 
 + 
 +Cliquez sur la loupe dans le champs **Project** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-26_15-47-30.png?800 |}} 
 + 
 +Vous obtiendrez : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-26_15-47-47.png?800 |}} 
 + 
 +Cochez **Test Project** puis cliquez sur le bouton **Select** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-26_15-48-05.png?800 |}} 
 + 
 +Vous verrez le Playbook **hello-world.yml** apparaître dans le champs **Playbook** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-26_15-48-45.png?800 |}} 
 + 
 +Cliquez sur le bouton **Save** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-26_15-50-44.png?800 |}} 
 + 
 +Vérifiez votre Template puis cliquez sur le lien **Templates** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-26_15-51-06.png?800 |}} 
 + 
 +====5.6 - Exécuter un Job==== 
 + 
 +Cliquez sur l'icône de la fusée en face de **Demo Job Template** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-26_15-52-22.png?800 |}} 
 + 
 +Cliquez sur **Jobs** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-26_15-53-10.png?800 |}} 
 + 
 +Cliquez sur **Demo Job Template** et constatez la réussite de l'exécution du Job : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-10-26_15-53-26.png?800 |}} 
 + 
 +=====LAB #6 - Utilisation de l'Ansible® Automation Hub===== 
 + 
 +====6.1 - Créer une Collection==== 
 + 
 +Connectez-vous ensuite à votre VM **autohub.ittraining.loc** : 
 + 
 +<code> 
 +[root@redhat9 ~]# ssh -l trainee 10.0.2.102 
 +</code> 
 + 
 +Créez un répertoire appelé **collection** et placez-vous dedans : 
 + 
 +<code> 
 +[trainee@autohub ~]$ mkdir collection 
 + 
 +[trainee@autohub ~]$ cd collection 
 +</code> 
 + 
 +Créez une **Collection** vide appelée **ittraining** dans un **Namespace** appelé **ittraining** avec la commande **ansible-galaxy** : 
 + 
 +<code> 
 +[trainee@autohub collection]$ ansible-galaxy collection init ittraining.ittraining 
 +- Collection ittraining.ittraining was created successfully 
 +</code> 
 + 
 +Consultez l'arborescence de la Collection : 
 + 
 +<code> 
 +[trainee@autohub collection]$ tree 
 +
 +└── ittraining 
 +    └── ittraining 
 +        ├── docs 
 +        ├── galaxy.yml 
 +        ├── meta 
 +        │   └── runtime.yml 
 +        ├── plugins 
 +        │   └── README.md 
 +        ├── README.md 
 +        └── roles 
 + 
 +6 directories, 4 files 
 +</code> 
 + 
 +Les informations concernant la Collection sont stockées dans le fichier **~/collections/ittraining/ittraining/galaxy.yml** : 
 + 
 +<code> 
 +[trainee@autohub collection]$ cat ittraining/ittraining/galaxy.yml  
 +### REQUIRED 
 +# The namespace of the collection. This can be a company/brand/organization or product namespace under which all 
 +# content lives. May only contain alphanumeric lowercase characters and underscores. Namespaces cannot start with 
 +# underscores or numbers and cannot contain consecutive underscores 
 +namespace: ittraining 
 + 
 +# The name of the collection. Has the same character restrictions as 'namespace' 
 +name: ittraining 
 + 
 +# The version of the collection. Must be compatible with semantic versioning 
 +version: 1.0.0 
 + 
 +# The path to the Markdown (.md) readme file. This path is relative to the root of the collection 
 +readme: README.md 
 + 
 +# A list of the collection's content authors. Can be just the name or in the format 'Full Name <email> (url) 
 +# @nicks:irc/im.site#channel' 
 +authors: 
 +- your name <example@domain.com> 
 + 
 + 
 +### OPTIONAL but strongly recommended 
 +# A short summary description of the collection 
 +description: your collection description 
 + 
 +# Either a single license or a list of licenses for content inside of a collection. Ansible Galaxy currently only 
 +# accepts L(SPDX,https://spdx.org/licenses/) licenses. This key is mutually exclusive with 'license_file' 
 +license: 
 +- GPL-2.0-or-later 
 + 
 +# The path to the license file for the collection. This path is relative to the root of the collection. This key is 
 +# mutually exclusive with 'license' 
 +license_file: '' 
 + 
 +# A list of tags you want to associate with the collection for indexing/searching. A tag name has the same character 
 +# requirements as 'namespace' and 'name' 
 +tags: [] 
 + 
 +# Collections that this collection requires to be installed for it to be usable. The key of the dict is the 
 +# collection label 'namespace.name'. The value is a version range 
 +# L(specifiers,https://python-semanticversion.readthedocs.io/en/latest/#requirement-specification). Multiple version 
 +# range specifiers can be set and are separated by ',' 
 +dependencies: {} 
 + 
 +# The URL of the originating SCM repository 
 +repository: http://example.com/repository 
 + 
 +# The URL to any online docs 
 +documentation: http://docs.example.com 
 + 
 +# The URL to the homepage of the collection/project 
 +homepage: http://example.com 
 + 
 +# The URL to the collection issue tracker 
 +issues: http://example.com/issue/tracker 
 + 
 +# A list of file glob-like patterns used to filter any files or directories that should not be included in the build 
 +# artifact. A pattern is matched from the relative path of the file or directory of the collection directory. This 
 +# uses 'fnmatch' to match the files or directories. Some directories and files like 'galaxy.yml', '*.pyc', '*.retry', 
 +# and '.git' are always filtered. Mutually exclusive with 'manifest' 
 +build_ignore: [] 
 + 
 +# A dict controlling use of manifest directives used in building the collection artifact. The key 'directives' is a 
 +# list of MANIFEST.in style 
 +# L(directives,https://packaging.python.org/en/latest/guides/using-manifest-in/#manifest-in-commands). The key 
 +# 'omit_default_directives' is a boolean that controls whether the default directives are used. Mutually exclusive 
 +# with 'build_ignore' 
 +# manifest: null 
 +</code> 
 + 
 +Éditez la ligne **requires-ansible** dans le fichier **~/collections/ittraining/ittraining/meta/runtime.yml** : 
 + 
 +<code> 
 +[trainee@autohub collection]$ vi ittraining/ittraining/meta/runtime.yml 
 + 
 +[trainee@autohub collection]$ cat ittraining/ittraining/meta/runtime.yml  
 +--- 
 +# Collections must specify a minimum required ansible version to upload 
 +# to galaxy 
 +requires_ansible: '>=2.9.10' 
 + 
 +# Content that Ansible needs to load from another location or that has 
 +# been deprecated/removed 
 +# plugin_routing: 
 +#   action: 
 +#     redirected_plugin_name: 
 +#       redirect: ns.col.new_location 
 +#     deprecated_plugin_name: 
 +#       deprecation: 
 +#         removal_version: "4.0.0" 
 +#         warning_text:
 +#           See the porting guide on how to update your playbook to 
 +#           use ns.col.another_plugin instead. 
 +#     removed_plugin_name: 
 +#       tombstone: 
 +#         removal_version: "2.0.0" 
 +#         warning_text:
 +#           See the porting guide on how to update your playbook to 
 +#           use ns.col.another_plugin instead. 
 +#   become: 
 +#   cache: 
 +#   callback: 
 +#   cliconf: 
 +#   connection: 
 +#   doc_fragments: 
 +#   filter: 
 +#   httpapi: 
 +#   inventory: 
 +#   lookup: 
 +#   module_utils: 
 +#   modules: 
 +#   netconf: 
 +#   shell: 
 +#   strategy: 
 +#   terminal: 
 +#   test: 
 +#   vars: 
 + 
 +# Python import statements that Ansible needs to load from another location 
 +# import_redirection: 
 +#   ansible_collections.ns.col.plugins.module_utils.old_location: 
 +#     redirect: ansible_collections.ns.col.plugins.module_utils.new_location 
 + 
 +# Groups of actions/modules that take a common set of options 
 +# action_groups: 
 +#   group_name: 
 +#     - module1 
 +#     - module2 
 +</code> 
 + 
 +Placez-vous dans le répertoire **~/collections/ittraining/ittraining/** : 
 + 
 +<code> 
 +[trainee@autohub collection]$ cd ittraining/ittraining/ 
 + 
 +[trainee@autohub ittraining]$ ls 
 +docs  galaxy.yml  meta  plugins  README.md  roles 
 +</code> 
 + 
 +Construisez la Collection **ittraining-ittraining-1.0.0.tar.gz** avec la commande **ansible-galaxy collection build** : 
 + 
 +<code> 
 +[trainee@autohub ittraining]$ ansible-galaxy collection build 
 +Created collection for ittraining.ittraining at /home/trainee/collection/ittraining/ittraining/ittraining-ittraining-1.0.0.tar.gz 
 +</code> 
 + 
 +====6.2 - Téléverser une Collection==== 
 + 
 +Connectez-vous à votre **VM Debian_10.0.2.46_VNC**. Ouvrez un navigateur Web et naviguez à **https://10.0.2.102** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-11-16_15-36-10.png?800 |}} 
 + 
 +Cliquez ensuite sur **Namespaces** dans le menu de gauche puis cliquez sur le bouton **Create** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-11-16_15-36-54.png?800 |}} 
 + 
 +Renseignez le nom **ittraining** et cliquez sur le bouton **Create** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-11-16_15-37-20.png?800 |}} 
 + 
 +Notez que pour l'instant, il n'y a pas de **Collections** dans ce **Namespace**. Cliquez donc sur le bouton **Upload collection** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-11-16_15-38-01.png?800 |}} 
 + 
 +Dans la fenêtre **New collection**, cliquez sur **Select file** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-11-16_15-39-36.png?800 |}} 
 + 
 +<WRAP center round important 50%> 
 +**Important** : Notez que le dépôt de destination est **staging**. Le dépôt staging est utilisé pour téléverser toute nouvelle Collection avant que celle-ci soit vérifiée pour publication. 
 +</WRAP> 
 + 
 +Choisissez le fichier **ittraining-ittraining-1.0.0.tar.gz** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-11-16_15-41-10.png?800 |}} 
 + 
 +Cliquez ensuite sur le bouton **Upload** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-11-16_15-41-29.png?800 |}} 
 + 
 +A l'issu de quelques secondes, la **Collection** est téléversée : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-11-16_15-41-53.png?800 |}} 
 + 
 +<WRAP center round important 50%> 
 +**Important** : Notez la ligne **Approval status: waiting for approval**. 
 +</WRAP> 
 + 
 +Développez l'item **Collections** dans le menu de gauche : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-11-16_15-42-23.png?800 |}} 
 + 
 +Cliquez sur **Repositories** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-11-16_15-42-44.png?800 |}} 
 + 
 +Descendez en bas de la liste des **Repositories** et cliquez sur **staging** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-11-16_15-43-01.png?800 |}} 
 + 
 +Vous obtiendrez : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-11-16_15-43-28.png?800 |}} 
 + 
 +Cliquez sur l'onglet **Collection versions** et notez la présence de la Collection **ittraining-ittraining-1.0.0** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-11-16_15-43-51.png?800 |}} 
 + 
 +Cliquez ensuite sur l'item **Approval** dans le menu de gauche : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-11-16_15-45-11.png?800 |}} 
 + 
 +<WRAP center round important 50%> 
 +**Important** : Notez que l'item **Approvals** est présent parce que vous êtes connecté en tant qu'administrateur. 
 +</WRAP> 
 + 
 +Dans le cas où vous souhaiteriez rejeter cette Collection, il conviendrait de cliquez sur les trois points verticaux à droite de la ligne **ittraining** et de choisir **Reject**. Cliquez ensuite sur le bouton **Approve** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-11-16_15-46-19.png?800 |}} 
 + 
 +Vous obtiendrez : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-11-16_15-46-45.png?800 |}} 
 + 
 +Cliquez sur **Namespaces** dans le menu de gauche : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-11-16_15-48-26.png?800 |}} 
 + 
 +Dans le champs **Filter by keywords**, saisissez le mot **ittraining** puis cliquez sur l'**icône de la loupe** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-11-16_15-48-58.png?800 |}} 
 + 
 +Cliquez sur le lien **View collections** pour consulter la liste des **Collections** dans le **Namespace** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-11-16_15-49-25.png?800 |}} 
 + 
 +Constatez la présence de la Collection **ittraining** : 
 + 
 +{{ :elearning:workbooks:centos:8:lcf900:capture_d_ecran_du_2023-11-16_15-50-08.png?800 |}}
  
 ----- -----
  
-Copyright © 2022 Hugh Norris.+Copyright © 2024 Hugh Norris
Menu