Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| elearning:workbooks:centos:8:lcf900:l706 [2023/10/23 14:35] – admin | elearning:workbooks:centos:8:lcf900:l706 [2024/06/10 11:46] (Version actuelle) – admin | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| ~~PDF: | ~~PDF: | ||
| - | Version : **2023.01** | + | Version : **2024.01** |
| Dernière mise-à-jour : ~~LASTMOD~~ | Dernière mise-à-jour : ~~LASTMOD~~ | ||
| Ligne 22: | Ligne 22: | ||
| * 3.1 - Configurer Ansible® Automation Hub | * 3.1 - Configurer Ansible® Automation Hub | ||
| * 3.2 - Configurer Ansible® Automation Controller | * 3.2 - Configurer Ansible® Automation Controller | ||
| + | * LAB #4 - Sauvegarder et Restaurer la Plateforme Ansible® Automation | ||
| + | * 4.1 - Sauvegarder l' | ||
| + | * 4.2 - Sauvegarder l' | ||
| + | * 4.3 - Restaurer l' | ||
| + | * LAB #5 - Utilisation de l' | ||
| + | * 5.1 - Créer un Job Simple | ||
| + | * 5.2 - Créer un Projet | ||
| + | * 5.3 - Créer un Inventory | ||
| + | * 5.4 - Créer des Informations d' | ||
| + | * 5.5 - Créer un Gabarit | ||
| + | * 5.6 - Exécuter un Job | ||
| + | * LAB #6 - Utilisation de l' | ||
| + | * 6.1 - Créer une Collection | ||
| + | * 6.1 - Téléverser une Collection | ||
| =====LAB#1 - Ansible® Automation Controller===== | =====LAB#1 - Ansible® Automation Controller===== | ||
| Ligne 27: | Ligne 41: | ||
| ====1.1 - Préparation==== | ====1.1 - Préparation==== | ||
| - | Avant de commencer, ouvrez un compte développeur chez **[[https:// | + | Avant de commencer, ouvrez un compte développeur chez **[[https:// |
| <WRAP center round important 50%> | <WRAP center round important 50%> | ||
| Ligne 39: | Ligne 53: | ||
| </ | </ | ||
| - | Connectez-vous ensuite à votre VM **RedHat_10.0.2.101_SSH** | + | Connectez-vous ensuite à votre VM **RedHat_10.0.2.101_SSH**. |
| Enregistrez la VM dans **votre** compte Red Hat : | Enregistrez la VM dans **votre** compte Red Hat : | ||
| Ligne 53: | Ligne 67: | ||
| The system has been registered with ID: a85a9fe3-334d-4b0c-9a98-f408e7d3a1e7 | The system has been registered with ID: a85a9fe3-334d-4b0c-9a98-f408e7d3a1e7 | ||
| The registered system name is: redhat9.ittraining.loc | The registered system name is: redhat9.ittraining.loc | ||
| + | </ | ||
| + | |||
| + | Configurez SELinux en mode permissive : | ||
| + | |||
| + | < | ||
| + | [root@redhat9 ~]# setenforce permissive | ||
| </ | </ | ||
| Ligne 86: | Ligne 106: | ||
| </ | </ | ||
| - | Modifiez le fichier **/ | + | Modifiez le fichier **/ |
| - | + | ||
| - | < | + | |
| - | [root@redhat9 ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# | + | |
| - | [root@redhat9 ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# | + | |
| - | 127.0.0.1 | + | |
| - | ::1 | + | |
| - | redhat9.ittraining.loc | + | |
| - | autohub.ittraining.loc | + | |
| - | </ | + | |
| < | < | ||
| Ligne 269: | Ligne 280: | ||
| [root@redhat9 ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# | [root@redhat9 ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# | ||
| ... | ... | ||
| - | PLAY [Post-install cleanup] **************************************************** | ||
| - | |||
| - | TASK [Remove stale packages] *************************************************** | ||
| - | ok: [redhat9.ittraining.loc] => {" | ||
| - | |||
| PLAY RECAP ********************************************************************* | PLAY RECAP ********************************************************************* | ||
| localhost | localhost | ||
| Ligne 281: | Ligne 287: | ||
| ====1.3 - Consultation==== | ====1.3 - Consultation==== | ||
| - | Connectez-vous à votre VM **Debian_10.0.2.46_VNC** | + | Connectez-vous à votre VM **Debian_10.0.2.46_VNC** : |
| - | {{ : | + | {{ : |
| - | Ouvrez un navigateur Web et naviguez à **https:// | + | Ouvrez un navigateur Web et naviguez à **https:// |
| - | {{ : | + | {{ : |
| Acceptez le certificat auto-signé : | Acceptez le certificat auto-signé : | ||
| - | {{ : | + | {{ : |
| Connectez-vous à votre Ansible® Automation Controller en utilisant le compte **admin** et le mot de passe **fenestros** : | Connectez-vous à votre Ansible® Automation Controller en utilisant le compte **admin** et le mot de passe **fenestros** : | ||
| - | {{ : | + | {{ : |
| Cliquez sur le bouton **Username/ | Cliquez sur le bouton **Username/ | ||
| - | {{ : | + | {{ : |
| Vous obtiendrez : | Vous obtiendrez : | ||
| - | {{ : | + | {{ : |
| - | =====LAB #2 - Automation Hub===== | + | =====LAB #2 - Ansible® |
| ====2.1 - Préparation==== | ====2.1 - Préparation==== | ||
| - | Connectez-vous maintenant à votre VM **AutoHub_10.0.2.102_SSH** ou **AutoHub_10.0.3.102_SSH** selon votre numéro de stagiaire. | + | Connectez-vous maintenant à votre VM **autohub.ittraining.loc** : |
| + | |||
| + | < | ||
| + | [root@redhat9 ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# | ||
| + | </ | ||
| Enregistrez la VM dans **votre** compte Red Hat : | Enregistrez la VM dans **votre** compte Red Hat : | ||
| Ligne 320: | Ligne 330: | ||
| The system has been registered with ID: a85a9fe3-334d-4b0c-9a98-f408e7d3a1e7 | The system has been registered with ID: a85a9fe3-334d-4b0c-9a98-f408e7d3a1e7 | ||
| The registered system name is: autohub.ittraining.loc | The registered system name is: autohub.ittraining.loc | ||
| + | </ | ||
| + | |||
| + | Configurez SELinux en mode permissive : | ||
| + | |||
| + | < | ||
| + | [root@autohub ~]# setenforce permissive | ||
| </ | </ | ||
| Ligne 341: | Ligne 357: | ||
| ::1 | ::1 | ||
| 10.0.2.102 | 10.0.2.102 | ||
| - | </ | ||
| - | |||
| - | ou | ||
| - | |||
| - | < | ||
| - | [root@autohub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# | ||
| - | [root@autohub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# | ||
| - | 127.0.0.1 | ||
| - | ::1 | ||
| - | 10.0.3.102 | ||
| </ | </ | ||
| Ligne 456: | Ligne 462: | ||
| < | < | ||
| - | [root@redhat9 | + | [root@autohub |
| ... | ... | ||
| - | TASK [Remove stale packages] | + | PLAY RECAP ********************************************************************* |
| - | changed: [autohub.ittraining.loc] => {"changed": true, " | + | autohub.ittraining.loc |
| + | localhost | ||
| + | [error] Oops! An error occurred while running setup. | ||
| + | [warn] / | ||
| + | [warn] Provided path does not exist or is not accessible. Setup log saved to ./ | ||
| + | </ | ||
| + | |||
| + | En cas d' | ||
| + | |||
| + | < | ||
| + | [root@autohub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# | ||
| + | ... | ||
| PLAY RECAP ********************************************************************* | PLAY RECAP ********************************************************************* | ||
| autohub.ittraining.loc | autohub.ittraining.loc | ||
| Ligne 472: | Ligne 489: | ||
| ====2.3 - Consultation==== | ====2.3 - Consultation==== | ||
| - | Connectez-vous à votre VM **Debian_10.0.2.46_VNC** | + | Connectez-vous à votre VM **Debian_10.0.2.46_VNC** : |
| - | {{ : | + | {{ : |
| - | Ouvrez un navigateur Web et naviguez à **https:// | + | Ouvrez un navigateur Web et naviguez à **https:// |
| - | {{ : | + | {{ : |
| Acceptez le certificat auto-signé : | Acceptez le certificat auto-signé : | ||
| - | {{ : | + | {{ : |
| Connectez-vous à votre Ansible® Automation Hub en utilisant le compte **admin** et le mot de passe **fenestros** : | Connectez-vous à votre Ansible® Automation Hub en utilisant le compte **admin** et le mot de passe **fenestros** : | ||
| - | {{ : | + | {{ : |
| Vous obtiendrez : | Vous obtiendrez : | ||
| - | {{ : | + | {{ : |
| =====LAB #3 - Connecter l' | =====LAB #3 - Connecter l' | ||
| Ligne 498: | Ligne 515: | ||
| Dans l' | Dans l' | ||
| - | {{ : | + | {{ : |
| Copiez le token ainsi généré : | Copiez le token ainsi généré : | ||
| - | {{ : | + | {{ : |
| Collez ce token dans un bloc-note (mousepad) : | Collez ce token dans un bloc-note (mousepad) : | ||
| - | {{ : | + | {{ : |
| ====3.2 - Configurer Ansible® Automation Controller==== | ====3.2 - Configurer Ansible® Automation Controller==== | ||
| Ligne 512: | Ligne 529: | ||
| Ouvrez l' | Ouvrez l' | ||
| - | {{ : | + | {{ : |
| Naviguez à **Resources > Credentials** et cliquez sur le bouton **Add** : | Naviguez à **Resources > Credentials** et cliquez sur le bouton **Add** : | ||
| - | {{ : | + | {{ : |
| Renseignez les champs **Name**, **Description** et **Galaxy Server URL**. Choisissez **Galaxy/ | Renseignez les champs **Name**, **Description** et **Galaxy Server URL**. Choisissez **Galaxy/ | ||
| - | {{ : | + | {{ : |
| Cliquez sur la loupe à gauche du champs **Organization** : | Cliquez sur la loupe à gauche du champs **Organization** : | ||
| - | {{ : | + | {{ : |
| Cochez l' | Cochez l' | ||
| - | {{ : | + | {{ : |
| Validez en cliquant sur le bouton **Save** : | Validez en cliquant sur le bouton **Save** : | ||
| - | {{ : | + | {{ : |
| Vous obtiendrez : | Vous obtiendrez : | ||
| - | {{ : | + | {{ : |
| Cliquez sur **Settings > Jobs settings** : | Cliquez sur **Settings > Jobs settings** : | ||
| - | {{ : | + | {{ : |
| Vous obtiendrez : | Vous obtiendrez : | ||
| - | {{ : | + | {{ : |
| Descendez la page et cliquez sur le bouton **Edit** : | Descendez la page et cliquez sur le bouton **Edit** : | ||
| - | {{ : | + | {{ : |
| Activez l' | Activez l' | ||
| - | {{ : | + | {{ : |
| Descendez en bas de la page et cliquez sur le bouton **Save** : | Descendez en bas de la page et cliquez sur le bouton **Save** : | ||
| - | {{ : | + | {{ : |
| Naviguez à **Organizations** et cliquez sur l' | Naviguez à **Organizations** et cliquez sur l' | ||
| - | {{ : | + | {{ : |
| Dans le champs **Galaxy Credentials**, | Dans le champs **Galaxy Credentials**, | ||
| - | {{ : | + | {{ : |
| Cliquez sur la loupe à gauche du champs **Galaxy Credentials** : | Cliquez sur la loupe à gauche du champs **Galaxy Credentials** : | ||
| - | {{ : | + | {{ : |
| Vous obtiendrez : | Vous obtiendrez : | ||
| - | {{ : | + | {{ : |
| Cochez **Autohub** PUIS **Ansible Galaxy** puis cliquez sur le bouton **Select** : | Cochez **Autohub** PUIS **Ansible Galaxy** puis cliquez sur le bouton **Select** : | ||
| - | {{ : | + | {{ : |
| Cliquez ensuite sur le bouton **Save** : | Cliquez ensuite sur le bouton **Save** : | ||
| - | {{ : | + | {{ : |
| Vous obtiendrez : | Vous obtiendrez : | ||
| - | {{ : | + | {{ : |
| <WRAP center round tip 50%> | <WRAP center round tip 50%> | ||
| Ligne 590: | Ligne 607: | ||
| </ | </ | ||
| - | < | + | =====LAB #4 - Sauvegarder et Restaurer la Plateforme Ansible® Automation===== |
| - | </ | + | ====4.1 - Sauvegarder l' |
| - | < | + | Revenez dans votre Ansible® Automation Controller. |
| - | </ | + | La sauvegarde de l' |
| < | < | ||
| + | [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]# | ||
| + | ... | ||
| + | PLAY RECAP ********************************************************************* | ||
| + | localhost | ||
| + | redhat9.ittraining.loc | ||
| + | The setup process completed successfully. | ||
| + | Setup log saved to / | ||
| </ | </ | ||
| - | < | + | A l' |
| + | < | ||
| + | [root@redhat9 ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# | ||
| + | total 108 | ||
| + | -rw-------. 1 root root 74610 Oct 24 10:43 automation-platform-backup-2023-10-24-10: | ||
| + | lrwxrwxrwx. 1 root root 117 Oct 24 10:43 automation-platform-backup-latest.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 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 | ||
| </ | </ | ||
| - | < | + | Dans ce cas, la taille de l' |
| + | < | ||
| + | [root@redhat9 ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# | ||
| + | 76K | ||
| + | 0 | ||
| </ | </ | ||
| - | < | + | ====4.2 - Sauvegarder l' |
| - | </ | + | Connectez-vous maintenant à votre VM **autohub.ittraining.loc** : |
| < | < | ||
| + | [root@redhat9 ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# | ||
| </ | </ | ||
| + | |||
| + | La sauvegarde de l' | ||
| < | < | ||
| + | [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]# | ||
| + | ... | ||
| + | PLAY RECAP ********************************************************************* | ||
| + | autohub.ittraining.loc | ||
| + | localhost | ||
| + | The setup process completed successfully. | ||
| + | [warn] / | ||
| + | [warn] Provided path does not exist or is not accessible. Setup log saved to ./ | ||
| </ | </ | ||
| + | |||
| + | A l' | ||
| < | < | ||
| + | [root@autohub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# | ||
| + | total 612124 | ||
| + | -rw-------. 1 root root 621857468 Oct 24 11:09 automation-platform-backup-2023-10-24-11: | ||
| + | lrwxrwxrwx. 1 root root 117 Oct 24 11:09 automation-platform-backup-latest.tar.gz -> / | ||
| + | -rw-r-----. 1 root root 116738 Oct 24 11:09 backup.log | ||
| + | drwxr-xr-x. 5 root root 55 Oct 13 17:00 bundle | ||
| + | -rw-r--r--. 1 root root 1751 Oct 23 12:28 certified_collection_seed_2023-10-23-12-13-33.log | ||
| + | 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 8962 Oct 23 11:23 inventory | ||
| + | -rw-r--r--. 1 root root 530 Oct 13 17:11 README.md | ||
| + | -rw-r-----. 1 root root | ||
| + | -rwxr-xr-x. 1 root root 14780 Oct 13 16:56 setup.sh | ||
| + | -rw-r--r--. 1 root root 605 Oct 23 12:31 validated_collection_seed_2023-10-23-12-28-02.log | ||
| </ | </ | ||
| + | |||
| + | Dans ce cas, la taille de l' | ||
| < | < | ||
| + | [root@autohub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# | ||
| + | 594M automation-platform-backup-2023-10-24-11: | ||
| + | 0 | ||
| </ | </ | ||
| - | < | + | ====4.3 - Restaurer l' |
| - | </ | + | Copiez le fichier **automation-platform-backup-2023-10-24-11: |
| < | < | ||
| + | [root@autohub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# | ||
| </ | </ | ||
| + | |||
| + | Copiez le fichier **automation-platform-backup.tar.gz** vers votre VM **backuphub** selon votre numéro de stagiaire : | ||
| < | < | ||
| + | [root@autohub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# | ||
| + | The authenticity of host ' | ||
| + | ED25519 key fingerprint is SHA256: | ||
| + | This key is not known by any other names | ||
| + | Are you sure you want to continue connecting (yes/ | ||
| + | Warning: Permanently added ' | ||
| + | trainee@10.0.2.103' | ||
| + | automation-platform-backup.tar.gz | ||
| </ | </ | ||
| - | < | + | Copiez ensuite le fichier **inventory** vers votre VM **backuphub** selon votre numéro de stagiaire : |
| + | < | ||
| + | [root@autohub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# | ||
| + | trainee@10.0.2.103' | ||
| + | inventory | ||
| </ | </ | ||
| - | < | + | Connectez-vous maintenant à votre VM **backuphub** selon votre numéro de stagiaire : |
| + | < | ||
| + | [root@autohub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# | ||
| + | trainee@10.0.2.103' | ||
| + | Register this system with Red Hat Insights: insights-client --register | ||
| + | Create an account or view all your systems at https:// | ||
| + | Last login: Tue Oct 24 13:02:01 2023 from 10.0.2.1 | ||
| + | [trainee@backuphub ~]$ su - | ||
| + | Password: fenestros | ||
| + | [root@backuphub ~]# | ||
| </ | </ | ||
| - | < | + | Enregistrez la VM dans **votre** compte Red Hat : |
| + | < | ||
| + | [root@backuphub ~]# subscription-manager register | ||
| + | Registering to: subscription.rhsm.redhat.com: | ||
| + | Username: < | ||
| + | Password: < | ||
| + | The system has been registered with ID: a52fe25b-0bfd-4c60-8898-68de681c9fda | ||
| + | The registered system name is: backuphub.ittraining.loc | ||
| </ | </ | ||
| - | < | + | Configurez SELinux en mode permissive : |
| + | < | ||
| + | [root@backuphub ~]# setenforce permissive | ||
| </ | </ | ||
| + | |||
| + | 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éé : | ||
| < | < | ||
| + | [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@autohub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# | ||
| + | bundle | ||
| </ | </ | ||
| + | |||
| + | Installez le paquet **ansible-core** : | ||
| < | < | ||
| + | [root@backuphub ~]# dnf install ansible-core | ||
| </ | </ | ||
| + | |||
| + | Copiez le fichier **/ | ||
| < | < | ||
| + | [root@backuphub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# | ||
| </ | </ | ||
| - | < | + | Ajoutez un lien symbolique vers le fichier **automation-platform-backup.tar.gz** : |
| + | < | ||
| + | [root@backuphub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# | ||
| + | [root@backuphub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# | ||
| + | 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> | + | <WRAP center round important 50%> |
| + | **Important** : Le processus de restauration recherche le fichier identifié par le lien symbolique **automation-platform-backup-latest.tar.gz**. | ||
| + | </WRAP> | ||
| - | </code> | + | Copiez le fichier **/home/ |
| < | < | ||
| + | [root@backuphub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# | ||
| + | cp: overwrite ' | ||
| </ | </ | ||
| - | < | + | Modifiez le nom d' |
| + | < | ||
| + | [root@backuphub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# | ||
| </ | </ | ||
| - | < | + | Modifiez le fichier **/ |
| + | < | ||
| + | [root@backuphub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# | ||
| + | [root@backuphub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# | ||
| + | 127.0.0.1 | ||
| + | ::1 | ||
| + | 10.0.2.103 | ||
| </ | </ | ||
| + | |||
| + | Installez maintenant un nouvel Ansible® Automation Hub : | ||
| < | < | ||
| + | [root@backuphub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# | ||
| + | ... | ||
| + | PLAY RECAP ********************************************************************* | ||
| + | autohub.ittraining.loc | ||
| + | localhost | ||
| + | [error] Oops! An error occurred while running setup. | ||
| + | [warn] / | ||
| + | [warn] Provided path does not exist or is not accessible. Setup log saved to ./ | ||
| </ | </ | ||
| + | |||
| + | En cas d' | ||
| < | < | ||
| + | [root@backuphub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# | ||
| + | ... | ||
| + | PLAY RECAP ********************************************************************* | ||
| + | autohub.ittraining.loc | ||
| + | localhost | ||
| + | The setup process completed successfully. | ||
| + | [warn] / | ||
| + | [warn] Provided path does not exist or is not accessible. Setup log saved to ./ | ||
| </ | </ | ||
| + | |||
| + | Dernièrement, | ||
| < | < | ||
| + | [root@backuphub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# | ||
| + | ... | ||
| + | PLAY RECAP ********************************************************************* | ||
| + | autohub.ittraining.loc | ||
| + | The setup process completed successfully. | ||
| + | [warn] / | ||
| + | [warn] Provided path does not exist or is not accessible. Setup log saved to ./ | ||
| </ | </ | ||
| - | < | + | =====LAB #5 - Utilisation de l' |
| - | </ | + | ====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!** : |
| < | < | ||
| + | [root@redhat9 ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# | ||
| + | [root@redhat9 ~]# vi hello-world.yml | ||
| + | |||
| + | [root@redhat9 ~]# cat hello-world.yml | ||
| + | --- | ||
| + | - hosts: all | ||
| + | tasks: | ||
| + | - name: Hello World | ||
| + | debug: | ||
| + | msg: Hello World! | ||
| </ | </ | ||
| + | |||
| + | Vérifiez la syntaxe de ce playbook : | ||
| < | < | ||
| + | [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 ' | ||
| + | playbook: hello-world.yml | ||
| </ | </ | ||
| - | < | + | Notez l' |
| + | < | ||
| + | [root@redhat9 ~]# vi inventory | ||
| + | [root@redhat9 ~]# cat inventory | ||
| + | [Test] | ||
| + | localhost ansible_connection=local | ||
| </ | </ | ||
| + | |||
| + | Vérifiez de nouveau la syntaxe de ce playbook : | ||
| < | < | ||
| + | [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 ' | ||
| + | playbook: hello-world.yml | ||
| </ | </ | ||
| + | |||
| + | Notez l' | ||
| < | < | ||
| + | [root@redhat9 ~]# ls -l / | ||
| + | -rw-r--r--. 1 root root 1018 Jun 5 17:30 / | ||
| + | [root@redhat9 ~]# cat / | ||
| + | # This is the default ansible ' | ||
| + | # | ||
| + | # It should live in / | ||
| + | # | ||
| + | # - Comments begin with the '#' | ||
| + | # - 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] |
| + | ## 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: |
| - | </ | + | # Ex 3: A collection of database servers in the ' |
| - | < | + | ## [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: |
| </ | </ | ||
| + | |||
| + | Testez le playbook en indiquant le fichier inventory créé au dessus : | ||
| < | < | ||
| + | [root@redhat9 ~]# ansible-playbook -i inventory hello-world.yml | ||
| - | </ | + | PLAY [all] *************************************************************************** |
| - | < | + | TASK [Gathering Facts] *************************************************************** |
| + | ok: [localhost] | ||
| + | TASK [Hello World] ******************************************************************* | ||
| + | ok: [localhost] => { | ||
| + | " | ||
| + | } | ||
| + | |||
| + | PLAY RECAP *************************************************************************** | ||
| + | localhost | ||
| </ | </ | ||
| - | < | + | ====5.2 - Créer un Projet==== |
| - | </code> | + | 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/ |
| < | < | ||
| + | [root@redhat9 ~]# mkdir / | ||
| + | [root@redhat9 ~]# cp hello-world.yml / | ||
| </ | </ | ||
| - | < | + | Connectez-vous à votre **VM Debian_10.0.2.46_VNC**. Ouvrez un navigateur Web et naviguez à **https:// |
| - | </ | + | {{ : |
| - | < | + | Cliquez sur **Projects** puis sur le bouton **Add** : |
| - | </ | + | {{ : |
| - | < | + | Indiquez **Test Project** dans **Name**, **My test Project** dans **Description**, |
| - | </ | + | {{ : |
| - | < | + | Vérifiez les informations de votre projet : |
| - | </ | + | {{ : |
| - | < | + | ====5.3 - Créer un Inventory==== |
| - | </ | + | Cliquez ensuite sur **Inventories** : |
| - | < | + | {{ : |
| - | </ | + | Cliquez sur le lien **Demo Inventory** : |
| - | < | + | {{ : |
| - | </ | + | Cliquez sur le lien **Hosts** et cochez **localhost** : |
| - | < | + | {{ : |
| - | </ | + | ====5.4 - Créer des Informations d' |
| - | < | + | Cliquez sur **Credentials** : |
| - | </ | + | {{ : |
| - | < | + | Éditez **Demo Credential** en indiquant **trainee** en tant que **Username** et **trainee** en tant que **Password** : |
| - | </ | + | {{ : |
| - | < | + | Cliquez sur le bouton **Save** : |
| - | </ | + | {{ : |
| - | < | + | Vous obtiendrez : |
| - | </ | + | {{ : |
| - | < | + | ====5.5 - Créer un Gabarit==== |
| - | </ | + | Cliquez sur **Templates** puis cliquez sur **Demo Job Template** : |
| - | < | + | {{ : |
| - | </ | + | Cliquez sur la loupe dans le champs **Project** : |
| - | < | + | {{ : |
| - | </ | + | Vous obtiendrez : |
| - | < | + | {{ : |
| - | </ | + | Cochez **Test Project** puis cliquez sur le bouton **Select** : |
| - | < | + | {{ : |
| - | </ | + | Vous verrez le Playbook **hello-world.yml** apparaître dans le champs **Playbook** : |
| - | < | + | {{ : |
| - | </ | + | Cliquez sur le bouton **Save** : |
| - | < | + | {{ : |
| - | </ | + | Vérifiez votre Template puis cliquez sur le lien **Templates** : |
| - | < | + | {{ : |
| - | </ | + | ====5.6 - Exécuter un Job==== |
| - | < | + | Cliquez sur l' |
| - | </ | + | {{ : |
| - | < | + | Cliquez sur **Jobs** : |
| - | </ | + | {{ : |
| - | < | + | Cliquez sur **Demo Job Template** et constatez la réussite de l' |
| - | </ | + | {{ : |
| - | < | + | =====LAB #6 - Utilisation de l' |
| - | </ | + | ====6.1 - Créer une Collection==== |
| + | |||
| + | Connectez-vous ensuite à votre VM **autohub.ittraining.loc** : | ||
| < | < | ||
| + | [root@redhat9 ~]# ssh -l trainee 10.0.2.102 | ||
| </ | </ | ||
| + | |||
| + | Créez un répertoire appelé **collection** et placez-vous dedans : | ||
| < | < | ||
| + | [trainee@autohub ~]$ mkdir collection | ||
| + | [trainee@autohub ~]$ cd collection | ||
| </ | </ | ||
| - | < | + | Créez une **Collection** vide appelée **ittraining** dans un **Namespace** appelé **ittraining** avec la commande **ansible-galaxy** : |
| + | < | ||
| + | [trainee@autohub collection]$ ansible-galaxy collection init ittraining.ittraining | ||
| + | - Collection ittraining.ittraining was created successfully | ||
| </ | </ | ||
| + | |||
| + | Consultez l' | ||
| < | < | ||
| + | [trainee@autohub collection]$ tree | ||
| + | . | ||
| + | └── ittraining | ||
| + | └── ittraining | ||
| + | ├── docs | ||
| + | ├── galaxy.yml | ||
| + | ├── meta | ||
| + | │ | ||
| + | ├── plugins | ||
| + | │ | ||
| + | ├── README.md | ||
| + | └── roles | ||
| + | 6 directories, | ||
| </ | </ | ||
| + | |||
| + | Les informations concernant la Collection sont stockées dans le fichier **~/ | ||
| < | < | ||
| + | [trainee@autohub collection]$ cat ittraining/ | ||
| + | ### REQUIRED | ||
| + | # The namespace of the collection. This can be a company/ | ||
| + | # 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 ' |
| + | 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 | ||
| - | <code> | + | # A list of the collection' |
| + | # @nicks: | ||
| + | authors: | ||
| + | - your name < | ||
| - | </ | ||
| - | < | + | ### OPTIONAL but strongly recommended |
| + | # A short summary description of the collection | ||
| + | description: | ||
| - | </code> | + | # Either a single license or a list of licenses for content inside of a collection. Ansible Galaxy currently only |
| + | # accepts L(SPDX, | ||
| + | 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_file: | ||
| - | </code> | + | # A list of tags you want to associate with the collection for indexing/searching. A tag name has the same character |
| + | # requirements as ' | ||
| + | tags: [] | ||
| - | < | + | # Collections that this collection requires to be installed for it to be usable. The key of the dict is the |
| + | # collection label ' | ||
| + | # L(specifiers, | ||
| + | # range specifiers can be set and are separated by ',' | ||
| + | dependencies: | ||
| - | </code> | + | # The URL of the originating SCM repository |
| + | repository: http:// | ||
| - | < | + | # The URL to any online docs |
| + | documentation: | ||
| - | </code> | + | # The URL to the homepage of the collection/project |
| + | homepage: http:// | ||
| - | < | + | # The URL to the collection issue tracker |
| + | issues: http:// | ||
| + | # 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 ' | ||
| + | # and ' | ||
| + | build_ignore: | ||
| + | |||
| + | # A dict controlling use of manifest directives used in building the collection artifact. The key ' | ||
| + | # list of MANIFEST.in style | ||
| + | # L(directives, | ||
| + | # ' | ||
| + | # with ' | ||
| + | # manifest: null | ||
| </ | </ | ||
| + | |||
| + | Éditez la ligne **requires-ansible** dans le fichier **~/ | ||
| < | < | ||
| + | [trainee@autohub collection]$ vi ittraining/ | ||
| - | </code> | + | [trainee@autohub collection]$ cat ittraining/ittraining/ |
| + | --- | ||
| + | # Collections must specify a minimum required ansible version to upload | ||
| + | # to galaxy | ||
| + | requires_ansible: | ||
| - | < | + | # Content that Ansible needs to load from another location or that has |
| + | # been deprecated/ | ||
| + | # plugin_routing: | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # See the porting guide on how to update your playbook to | ||
| + | # use ns.col.another_plugin instead. | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # See the porting guide on how to update your playbook to | ||
| + | # use ns.col.another_plugin instead. | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # vars: | ||
| + | # Python import statements that Ansible needs to load from another location | ||
| + | # import_redirection: | ||
| + | # | ||
| + | # | ||
| + | |||
| + | # Groups of actions/ | ||
| + | # action_groups: | ||
| + | # | ||
| + | # - module1 | ||
| + | # - module2 | ||
| </ | </ | ||
| - | < | + | Placez-vous dans le répertoire **~/collections/ |
| - | + | ||
| - | </code> | + | |
| < | < | ||
| + | [trainee@autohub collection]$ cd ittraining/ | ||
| + | [trainee@autohub ittraining]$ ls | ||
| + | docs galaxy.yml | ||
| </ | </ | ||
| - | < | + | Construisez la Collection **ittraining-ittraining-1.0.0.tar.gz** avec la commande **ansible-galaxy collection build** : |
| - | + | ||
| - | </ | + | |
| < | < | ||
| + | [trainee@autohub ittraining]$ ansible-galaxy collection build | ||
| + | Created collection for ittraining.ittraining at / | ||
| </ | </ | ||
| - | < | + | ====6.2 - Téléverser une Collection==== |
| - | </code> | + | Connectez-vous à votre **VM Debian_10.0.2.46_VNC**. Ouvrez un navigateur Web et naviguez à **https:// |
| - | < | + | {{ : |
| - | </ | + | Cliquez ensuite sur **Namespaces** dans le menu de gauche puis cliquez sur le bouton **Create** : |
| - | < | + | {{ : |
| - | </ | + | Renseignez le nom **ittraining** et cliquez sur le bouton **Create** : |
| - | < | + | {{ : |
| - | </ | + | Notez que pour l' |
| - | < | + | {{ : |
| - | </ | + | Dans la fenêtre **New collection**, |
| - | < | + | {{ : |
| - | </code> | + | <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** : |
| - | </ | + | {{ : |
| - | < | + | Cliquez ensuite sur le bouton **Upload** : |
| - | </ | + | {{ : |
| - | < | + | A l'issu de quelques secondes, la **Collection** est téléversée : |
| - | </ | + | {{ : |
| - | <code> | + | <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 : |
| - | < | + | {{ : |
| - | </ | + | Cliquez sur **Repositories** : |
| - | < | + | {{ : |
| - | </ | + | Descendez en bas de la liste des **Repositories** et cliquez sur **staging** : |
| - | < | + | {{ : |
| - | </ | + | Vous obtiendrez : |
| - | < | + | {{ : |
| - | </ | + | Cliquez sur l' |
| - | < | + | {{ : |
| - | </ | + | Cliquez ensuite sur l'item **Approval** dans le menu de gauche : |
| - | < | + | {{ : |
| - | </code> | + | <WRAP center round important 50%> |
| + | **Important** : Notez que l'item **Approvals** est présent parce que vous êtes connecté en tant qu' | ||
| + | </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** : |
| - | </ | + | {{ : |
| - | < | + | Vous obtiendrez : |
| - | </ | + | {{ : |
| - | < | + | Cliquez sur **Namespaces** dans le menu de gauche : |
| - | </ | + | {{ : |
| - | < | + | Dans le champs **Filter by keywords**, saisissez le mot **ittraining** puis cliquez sur l' |
| - | </ | + | {{ : |
| - | < | + | Cliquez sur le lien **View collections** pour consulter la liste des **Collections** dans le **Namespace** : |
| - | </ | + | {{ : |
| - | < | + | Constatez la présence de la Collection **ittraining** : |
| - | </ | + | {{ : |
| ----- | ----- | ||
| - | Copyright © 2023 Hugh Norris | + | Copyright © 2024 Hugh Norris |