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/03 07:04] – 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 9: | Ligne 9: | ||
=====Contenu du Module===== | =====Contenu du Module===== | ||
- | * **LCF805 | + | * **LDF906 |
* Contenu du Module | * Contenu du Module | ||
- | * Support de Cours | + | * LAB #1 - Ansible® Automation Controller |
- | * Rappel du Programme de la Formation | + | * 1.1 - Préparation |
- | * Validation | + | * 1.2 - Installation |
- | * Évaluation | + | * 1.3 - Consultation |
+ | * LAB #2 - Ansible® Automation Hub | ||
+ | * 2.1 - Préparation | ||
+ | * 2.2 - Installation | ||
+ | * 2.3 - Consultation | ||
+ | * LAB #3 - Connecter l' | ||
+ | * 3.1 - Configurer Ansible® Automation Hub | ||
+ | * 3.2 - Configurer Ansible® Automation Controller | ||
+ | * LAB #4 - Sauvegarder et Restaurer | ||
+ | * 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 | ||
+ | * 5.5 - Créer un Gabarit | ||
+ | * 5.6 - Exécuter un Job | ||
+ | * LAB #6 - Utilisation | ||
+ | * 6.1 - Créer une Collection | ||
+ | * 6.1 - Téléverser une Collection | ||
- | =====Support de Cours===== | + | =====LAB#1 - Ansible® Automation Controller===== |
- | L' | + | ====1.1 - Préparation==== |
- | L' | + | Avant de commencer, ouvrez un compte développeur chez **[[https:// |
- | * de mesurer le niveau du stagiaire avant la formation et celui atteint en fin de formation grâce aux tests de validations des acquis, | + | <WRAP center round important 50%> |
- | * de suivre du travail de chaque participant en termes de temps passé dans chaque module grâce à un reporting détaillé. | + | **Important** : Notez vos coordonnées |
+ | </ | ||
- | L' | + | Démarrez votre essai de **[[https:// |
- | * de télécharger des supports de cours et des LABS au format PDF le dernier jour de la formation, | + | <WRAP center round important 50%> |
- | * de refaire les LABS en mode autonome en cas de missions décalées en relation avec le contenu de la formation initiale, | + | **Important** : Vous n'avez **PAS** besoin |
- | | + | </ |
- | | + | |
- | * d' | + | |
- | =====Rappel du Programme de la Formation===== | + | Connectez-vous ensuite à votre VM **RedHat_10.0.2.101_SSH**. |
- | * **LCF800 - Présentation de la Formation**. | + | Enregistrez |
- | * Prérequis | + | |
- | * Matériel | + | |
- | * Logiciels | + | |
- | * Internet | + | |
- | * Programme de la Formation | + | |
- | | + | |
- | | + | |
- | * **LCF801 - Installation d' | + | < |
- | * Qu'est-ce Ansible ? | + | [trainee@redhat9 ~]$ su - |
- | * Installation d' | + | Password: fenestros |
- | * LAB #1 - Configuration de ssh et de sudo | + | |
- | * 1.1 - ssh | + | |
- | * 1.2 - sudo | + | |
- | * **LCF802 - Les Commandes ansible, ansible-playbook et ansible-galaxy**. | + | [root@redhat9 ~]# subscription-manager register |
- | * LAB #1 - Débuter avec Ansible | + | Registering to: subscription.rhsm.redhat.com: |
- | * 1.1 - La Commande ansible | + | Username: < |
- | * LAB #2 - La Commande ansible-playbook | + | Password: < |
- | * 2.1 - Playbook Files | + | The system has been registered with ID: a85a9fe3-334d-4b0c-9a98-f408e7d3a1e7 |
- | * 2.2 - Tasks | + | The registered system name is: redhat9.ittraining.loc |
- | * 2.3 - Handlers | + | </ |
- | * 2.4 - Modules | + | |
- | * 2.4.1 - Modules pour des Paquets | + | |
- | * 2.4.2 - Modules pour des Fichiers | + | |
- | * 2.4.3 - Modules pour le Système | + | |
- | * 2.5 - Inventory Files | + | |
- | * 2.6 - Privilèges | + | |
- | * 2.6.1 - Création de Groupes | + | |
- | * LAB #3 - La Commande ansible-galaxy | + | |
- | * 3.1 - Utiliser des Rôles avec un Play Book | + | |
- | * 3.2 - Ansible Galaxy | + | |
- | * **LCF803 - Rôles, Gabarits, Variables et Facts** | + | Configurez SELinux en mode permissive : |
- | * LAB #1 - Dépendances de Rôles | + | |
- | * LAB #2 - Utilisation des Gabarits | + | |
- | * 2.1 - Variables | + | |
- | * 2.2 - Gabarits Conditionnels | + | |
- | * 2.3 - Boucles | + | |
- | * 2.4 - Macros | + | |
- | * 2.5 - Filtres | + | |
- | * 2.5.1 - Default | + | |
- | * 2.5.2 - Join | + | |
- | * 2.5.3 - Map | + | |
- | * 2.6 - Gabarits Parent - Enfants | + | |
- | * 2.6.1 - Le Gabarit Parent | + | |
- | * 2.6.2 - Le Gabarit Enfant | + | |
- | * LAB #3 - Gestion de la Hiérarchie des Variables | + | |
- | * LAB #4 - Utilisation des Facts d' | + | |
- | * LAB #5 - La Commande ansible-vault | + | |
- | * 5.1 - Crypter le Fichier | + | |
- | * 5.2 - Editer le Fichier | + | |
- | * 5.3 - Décrypter le Fichier | + | |
- | * 5.4 - Utilisation de Mots de Passe Aléatoires | + | |
- | * LAB #6 - Ansible par la Pratique | + | |
- | * 6.1 - Instructions | + | |
- | * 6.2 - Corrigés | + | |
- | * **LCF804 - Utilisation d' | + | < |
- | * LAB #1 - Ansible et Docker | + | [root@redhat9 ~]# setenforce permissive |
- | * 1.1 - Présentation de Docker | + | </ |
- | * 1.2 - Installer Docker | + | |
- | * 1.3 - La Connexion à Docker | + | |
- | * LAB #2 - Préparer Windows 10 | + | |
- | * 2.1 - Mettre à Jour PowerShell et .NET | + | |
- | * 2.2 - Configurer WinRM | + | |
- | * 2.3 - Consulter les Informations sur WinRM | + | |
- | * 2.4 - Créer un Utilisateur Local pour Ansible | + | |
- | * LAB #3 - Préparer le Contrôleur Ansible | + | |
- | * 3.1 - Installer pywinrm | + | |
- | * 3.2 - Tester la Configuration | + | |
- | * LAB #4 - Travailler avec Ansible et Windows | + | |
- | * 4.1 - Obtenir les Informations sur Windows10 | + | |
- | * 4.2 - Exécuter une Commande | + | |
- | * 4.3 - Exécuter un script PowerShell | + | |
- | * 4.4 - Installer un Logiciel avec Chocolatey | + | |
- | * 4.5 - Créer un Utilisateur Local | + | |
- | | + | Désarchivez le fichier |
- | | + | |
- | | + | |
- | * Validation des acquis globale | + | |
- | * Évaluation de la Formation | + | |
- | =====Évaluation de la Formation===== | + | < |
+ | [root@redhat9 ~]# tar xvf ansible-automation-platform-setup-bundle-2.4-2.2-x86_64.tar.gz | ||
- | Afin de valider | + | [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]# | ||
+ | bundle | ||
+ | </ | ||
+ | |||
+ | Consultez le fichier **README.md** : | ||
+ | |||
+ | < | ||
+ | [root@redhat9 ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# | ||
+ | Red Hat Ansible Automation Platform Deployment | ||
+ | ============================================== | ||
+ | |||
+ | 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, | ||
+ | |||
+ | - Install Guide -- https:// | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 50%> | ||
+ | **Important** : Notez l'URL du **[[https:// | ||
+ | </ | ||
+ | |||
+ | 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 | ||
+ | </ | ||
+ | |||
+ | Installez ensuite le paquet **ansible-core** : | ||
+ | |||
+ | < | ||
+ | [root@redhat9 ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# | ||
+ | Updating Subscription Management repositories. | ||
+ | Red Hat Enterprise Linux 9 for x86_64 - BaseOS (RPMs) | ||
+ | Red Hat Enterprise Linux 9 for x86_64 - AppStream (RPMs) | ||
+ | Last metadata expiration check: 0:00:03 ago on Fri 20 Oct 2023 12:21:53 PM CEST. | ||
+ | Dependencies resolved. | ||
+ | ================================================================================================================================================================================================================== | ||
+ | | ||
+ | ================================================================================================================================================================================================================== | ||
+ | Installing: | ||
+ | | ||
+ | Installing dependencies: | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | Transaction Summary | ||
+ | ================================================================================================================================================================================================================== | ||
+ | Install | ||
+ | |||
+ | Total download size: 22 M | ||
+ | Installed size: 88 M | ||
+ | Is this ok [y/N]: y | ||
+ | Downloading Packages: | ||
+ | (1/15): sshpass-1.09-4.el9.x86_64.rpm | ||
+ | (2/15): libnsl2-2.0.0-1.el9.x86_64.rpm | ||
+ | (3/15): python3.11-six-1.16.0-1.el9.noarch.rpm | ||
+ | (4/15): python3.11-pycparser-2.20-1.el9.noarch.rpm | ||
+ | (5/15): python3.11-setuptools-wheel-65.5.1-2.el9.noarch.rpm | ||
+ | (6/15): python3.11-cffi-1.15.1-1.el9.x86_64.rpm | ||
+ | (7/15): python3.11-pyyaml-6.0-1.el9.x86_64.rpm | ||
+ | (8/15): python3.11-cryptography-37.0.2-5.el9.x86_64.rpm | ||
+ | (9/15): mpdecimal-2.5.1-3.el9.x86_64.rpm | ||
+ | (10/15): git-core-2.39.3-1.el9_2.x86_64.rpm | ||
+ | (11/15): python3.11-ply-3.11-1.el9.noarch.rpm | ||
+ | (12/15): python3.11-pip-wheel-22.3.1-2.el9.noarch.rpm | ||
+ | (13/15): ansible-core-2.14.2-5.el9_2.x86_64.rpm | ||
+ | (14/15): python3.11-3.11.2-2.el9_2.2.x86_64.rpm | ||
+ | (15/15): python3.11-libs-3.11.2-2.el9_2.2.x86_64.rpm | ||
+ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ||
+ | Total 3.1 MB/s | 22 MB | ||
+ | Red Hat Enterprise Linux 9 for x86_64 - AppStream (RPMs) | ||
+ | Importing GPG key 0xFD431D51: | ||
+ | | ||
+ | | ||
+ | | ||
+ | Is this ok [y/N]: y | ||
+ | Key imported successfully | ||
+ | Importing GPG key 0x5A6340B3: | ||
+ | | ||
+ | | ||
+ | | ||
+ | Is this ok [y/N]: y | ||
+ | </ | ||
+ | |||
+ | ====1.2 - Installation=== | ||
+ | |||
+ | Éditez maintenant le fichier **inventory** : | ||
+ | |||
+ | < | ||
+ | [root@redhat9 ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | ... | ||
+ | [automationcontroller] | ||
+ | redhat9.ittraining.loc ansible_connection=local node_type=hybrid | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 50%> | ||
+ | **Important** : Cette section configure une installation d'un seul noeud ayant une base de données interne. | ||
+ | </ | ||
+ | |||
+ | Configurez ensuite le mot de passe **fenestros** aux endroits indiqués : | ||
+ | |||
+ | < | ||
+ | ... | ||
+ | [all: | ||
+ | admin_password=' | ||
+ | |||
+ | pg_host='' | ||
+ | pg_port=5432 | ||
+ | |||
+ | pg_database=' | ||
+ | pg_username=' | ||
+ | pg_password=' | ||
+ | pg_sslmode=' | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | ... | ||
+ | registry_url=' | ||
+ | registry_username=' | ||
+ | registry_password=' | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | Cette section configure une installation d'un seul noeud ayant une base de données interne. | ||
+ | |||
+ | <WRAP center round todo 50%> | ||
+ | **A faire** : **Remplacez** ' | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | ... | ||
+ | automationhub_admin_password=' | ||
+ | |||
+ | automationhub_pg_host='' | ||
+ | automationhub_pg_port=5432 | ||
+ | |||
+ | automationhub_pg_database=' | ||
+ | automationhub_pg_username=' | ||
+ | automationhub_pg_password=' | ||
+ | automationhub_pg_sslmode=' | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | ... | ||
+ | automationedacontroller_admin_password=' | ||
+ | |||
+ | automationedacontroller_pg_host='' | ||
+ | automationedacontroller_pg_port=5432 | ||
+ | |||
+ | automationedacontroller_pg_database=' | ||
+ | automationedacontroller_pg_username=' | ||
+ | automationedacontroller_pg_password=' | ||
+ | automationedacontroller_pg_sslmode=' | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | ... | ||
+ | # The default install will deploy SSO with sso_use_https=True | ||
+ | # Keystore password is required for https enabled SSO | ||
+ | sso_keystore_password=' | ||
+ | |||
+ | # Single-Sign-On configuration | ||
+ | sso_console_admin_password=' | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | Exécutez le script d' | ||
+ | |||
+ | < | ||
+ | [root@redhat9 ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# | ||
+ | ... | ||
+ | PLAY RECAP ********************************************************************* | ||
+ | localhost | ||
+ | redhat9.ittraining.loc | ||
+ | </ | ||
+ | |||
+ | ====1.3 - Consultation==== | ||
+ | |||
+ | Connectez-vous à votre VM **Debian_10.0.2.46_VNC** : | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Ouvrez un navigateur Web et naviguez à **https:// | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Acceptez le certificat auto-signé : | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Connectez-vous à votre Ansible® Automation Controller en utilisant le compte **admin** et le mot de passe **fenestros** : | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Cliquez sur le bouton **Username/ | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Vous obtiendrez : | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | =====LAB #2 - Ansible® Automation Hub===== | ||
+ | |||
+ | ====2.1 - Préparation==== | ||
+ | |||
+ | 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 : | ||
+ | |||
+ | < | ||
+ | [root@autohub ~]# subscription-manager register | ||
+ | Registering to: subscription.rhsm.redhat.com: | ||
+ | Username: < | ||
+ | Password: < | ||
+ | The system has been registered with ID: a85a9fe3-334d-4b0c-9a98-f408e7d3a1e7 | ||
+ | The registered system name is: autohub.ittraining.loc | ||
+ | </ | ||
+ | |||
+ | Configurez SELinux en mode permissive : | ||
+ | |||
+ | < | ||
+ | [root@autohub ~]# 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@autohub ~]# tar xvf ansible-automation-platform-setup-bundle-2.4-2.2-x86_64.tar.gz | ||
+ | |||
+ | [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]# | ||
+ | bundle | ||
+ | </ | ||
+ | |||
+ | Modifiez le fichier **/ | ||
+ | |||
+ | < | ||
+ | [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.2.102 | ||
+ | </ | ||
+ | |||
+ | Installez ensuite le paquet **ansible-core** : | ||
+ | |||
+ | < | ||
+ | [root@autohub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# | ||
+ | Updating Subscription Management repositories. | ||
+ | Red Hat Enterprise Linux 9 for x86_64 - BaseOS (RPMs) | ||
+ | Red Hat Enterprise Linux 9 for x86_64 - AppStream (RPMs) | ||
+ | Dependencies resolved. | ||
+ | ================================================================================================================================================================================================================== | ||
+ | | ||
+ | ================================================================================================================================================================================================================== | ||
+ | Installing: | ||
+ | | ||
+ | Installing dependencies: | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | Transaction Summary | ||
+ | ================================================================================================================================================================================================================== | ||
+ | Install | ||
+ | |||
+ | Total download size: 22 M | ||
+ | Installed size: 88 M | ||
+ | Is this ok [y/N]: y | ||
+ | Downloading Packages: | ||
+ | (1/15): sshpass-1.09-4.el9.x86_64.rpm | ||
+ | (2/15): libnsl2-2.0.0-1.el9.x86_64.rpm | ||
+ | (3/15): python3.11-six-1.16.0-1.el9.noarch.rpm | ||
+ | (4/15): python3.11-pycparser-2.20-1.el9.noarch.rpm | ||
+ | (5/15): python3.11-setuptools-wheel-65.5.1-2.el9.noarch.rpm | ||
+ | (6/15): python3.11-cffi-1.15.1-1.el9.x86_64.rpm | ||
+ | (7/15): python3.11-pyyaml-6.0-1.el9.x86_64.rpm | ||
+ | (8/15): python3.11-cryptography-37.0.2-5.el9.x86_64.rpm | ||
+ | (9/15): mpdecimal-2.5.1-3.el9.x86_64.rpm | ||
+ | (10/15): git-core-2.39.3-1.el9_2.x86_64.rpm | ||
+ | (11/15): python3.11-ply-3.11-1.el9.noarch.rpm | ||
+ | (12/15): python3.11-pip-wheel-22.3.1-2.el9.noarch.rpm | ||
+ | (13/15): ansible-core-2.14.2-5.el9_2.x86_64.rpm | ||
+ | (14/15): python3.11-3.11.2-2.el9_2.2.x86_64.rpm | ||
+ | (15/15): python3.11-libs-3.11.2-2.el9_2.2.x86_64.rpm | ||
+ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ||
+ | Total 3.1 MB/s | 22 MB | ||
+ | Red Hat Enterprise Linux 9 for x86_64 - AppStream (RPMs) | ||
+ | Importing GPG key 0xFD431D51: | ||
+ | | ||
+ | | ||
+ | | ||
+ | Is this ok [y/N]: y | ||
+ | Key imported successfully | ||
+ | Importing GPG key 0x5A6340B3: | ||
+ | | ||
+ | | ||
+ | | ||
+ | Is this ok [y/N]: y | ||
+ | </ | ||
+ | |||
+ | ====2.2 - Installation==== | ||
+ | |||
+ | Éditez maintenant le fichier **inventory** : | ||
+ | |||
+ | < | ||
+ | [root@autohub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | ... | ||
+ | [automationhub] | ||
+ | autohub.ittraining.loc ansible_connection=local | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | ... | ||
+ | # Automation Hub Configuration | ||
+ | # | ||
+ | |||
+ | automationhub_admin_password=' | ||
+ | |||
+ | automationhub_pg_host='' | ||
+ | automationhub_pg_port=5432 | ||
+ | |||
+ | automationhub_pg_database=' | ||
+ | automationhub_pg_username=' | ||
+ | automationhub_pg_password=' | ||
+ | automationhub_pg_sslmode=' | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | Exécutez le script d' | ||
+ | |||
+ | < | ||
+ | [root@autohub 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@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 ./ | ||
+ | </ | ||
+ | |||
+ | ====2.3 - Consultation==== | ||
+ | |||
+ | Connectez-vous à votre VM **Debian_10.0.2.46_VNC** : | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Ouvrez un navigateur Web et naviguez à **https:// | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Acceptez le certificat auto-signé : | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Connectez-vous à votre Ansible® Automation Hub en utilisant le compte **admin** et le mot de passe **fenestros** : | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Vous obtiendrez : | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | =====LAB #3 - Connecter | ||
+ | |||
+ | ====3.1 - Configurer Ansible® Automation Hub==== | ||
+ | |||
+ | Dans l' | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Copiez le token ainsi généré : | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Collez ce token dans un bloc-note (mousepad) : | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | ====3.2 - Configurer Ansible® Automation Controller==== | ||
+ | |||
+ | Ouvrez l' | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Naviguez à **Resources > Credentials** et cliquez sur le bouton **Add** : | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Renseignez les champs **Name**, **Description** et **Galaxy Server URL**. Choisissez **Galaxy/ | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Cliquez sur la loupe à gauche du champs **Organization** : | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Cochez l' | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Validez en cliquant sur le bouton **Save** : | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Vous obtiendrez : | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Cliquez sur **Settings > Jobs settings** : | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Vous obtiendrez : | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Descendez la page et cliquez sur le bouton **Edit** : | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Activez l' | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Descendez en bas de la page et cliquez sur le bouton **Save** : | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Naviguez à **Organizations** et cliquez sur l' | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Dans le champs **Galaxy Credentials**, | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Cliquez sur la loupe à gauche du champs **Galaxy Credentials** : | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Vous obtiendrez : | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Cochez **Autohub** PUIS **Ansible Galaxy** puis cliquez sur le bouton **Select** : | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Cliquez ensuite sur le bouton **Save** : | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Vous obtiendrez : | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | <WRAP center round tip 50%> | ||
+ | **Good News** : Votre Ansible® Automation Hub et votre Ansible® Automation Controller sont maintenant connectés. | ||
+ | </ | ||
+ | |||
+ | =====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 | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 50%> | ||
+ | **Important** : Le processus de restauration recherche le fichier identifié par le lien symbolique **automation-platform-backup-latest.tar.gz**. | ||
+ | </ | ||
+ | |||
+ | Copiez le fichier **/ | ||
+ | |||
+ | < | ||
+ | [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==== | ||
+ | |||
+ | 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 **/ | ||
+ | |||
+ | < | ||
+ | [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 | ||
+ | |||
+ | # A list of the collection' | ||
+ | # @nicks: | ||
+ | authors: | ||
+ | - your name < | ||
+ | |||
+ | |||
+ | ### OPTIONAL but strongly recommended | ||
+ | # A short summary description of the collection | ||
+ | description: | ||
+ | |||
+ | # 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: | ||
+ | |||
+ | # A list of tags you want to associate with the collection for indexing/ | ||
+ | # 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: | ||
+ | |||
+ | # The URL of the originating SCM repository | ||
+ | repository: http:// | ||
+ | |||
+ | # The URL to any online docs | ||
+ | documentation: | ||
+ | |||
+ | # The URL to the homepage of the collection/ | ||
+ | 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/ | ||
+ | |||
+ | [trainee@autohub collection]$ cat 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. | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | |||
+ | # 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 **~/ | ||
+ | |||
+ | < | ||
+ | [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==== | ||
+ | |||
+ | 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**, | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | <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. | ||
+ | </ | ||
+ | |||
+ | 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 : | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | <WRAP center round important 50%> | ||
+ | **Important** : Notez la ligne **Approval status: waiting for approval**. | ||
+ | </ | ||
+ | |||
+ | 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 : | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | <WRAP center round important 50%> | ||
+ | **Important** : Notez que l'item **Approvals** est présent parce que vous êtes connecté en tant qu' | ||
+ | </ | ||
+ | |||
+ | 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 | ||
+ | |||
+ | {{ : | ||
----- | ----- | ||
- | Copyright © 2022 Hugh Norris | + | Copyright © 2024 Hugh Norris |