Différences
Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédente | ||
elearning:workbooks:centos:8:lcf900:l706 [2022/05/17 08:07] – created admin | elearning:workbooks:centos:8:lcf900:l706 [2024/06/10 11:46] (Version actuelle) – admin | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
~~PDF: | ~~PDF: | ||
- | Version | + | Version |
Dernière mise-à-jour : ~~LASTMOD~~ | Dernière mise-à-jour : ~~LASTMOD~~ | ||
- | ======DOF506 | + | ======LDF906 |
=====Contenu du Module===== | =====Contenu du Module===== | ||
- | * **DOF506 | + | * **LDF906 |
* 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.3 - Consultation |
- | * Erreur | + | * LAB #2 - Ansible® Automation Hub |
- | * Erreur | + | * 2.1 - Préparation |
- | * Erreurs | + | * 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 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 - Automatiser avec Ansible===== | + | =====LAB#1 - Ansible® Automation Controller===== |
- | Connectez-vous à la machine virtuelle | + | ====1.1 - Préparation==== |
+ | |||
+ | Avant de commencer, ouvrez un compte développeur chez **[[https:// | ||
+ | |||
+ | <WRAP center round important 50%> | ||
+ | **Important** : Notez vos coordonnées de connexion au compte Red Hat. | ||
+ | </ | ||
+ | |||
+ | Démarrez votre essai de **[[https:// | ||
+ | |||
+ | <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é. | ||
+ | </ | ||
+ | |||
+ | Connectez-vous | ||
+ | |||
+ | Enregistrez | ||
< | < | ||
- | trainee@traineeXX:~$ ssh -l trainee centos7 | + | [trainee@redhat9 |
+ | Password: fenestros | ||
+ | |||
+ | [root@redhat9 ~]# 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: redhat9.ittraining.loc | ||
</ | </ | ||
- | ====1.1 - Instructions ==== | + | Configurez SELinux en mode permissive : |
- | Il vous est demandé d' | + | < |
+ | [root@redhat9 ~]# setenforce permissive | ||
+ | </ | ||
- | * l' | + | Désarchivez |
- | * la mise à jour éventuelle de firewalld, | + | |
- | * la création d'une règle dans firewalld pour le trafic vers le serveur vsfptd, | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | * mot de passe : tata | + | |
- | Installez donc Ansible à partir des dépôts | + | < |
+ | [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]# | ||
+ | bundle | ||
+ | </ | ||
+ | |||
+ | Consultez le fichier **README.md** | ||
< | < | ||
- | [trainee@centos7 ~]$ su - | + | [root@redhat9 ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# |
- | Mot de passe : fenestros | + | Red Hat Ansible Automation Platform Deployment |
- | Dernière connexion : jeudi 5 septembre 2019 à 18:28:51 CEST sur pts/0 | + | ============================================== |
- | [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, | ||
+ | |||
+ | - Install Guide -- https:// | ||
</ | </ | ||
- | Vérifiez ensuite la présence des exécutables | + | <WRAP center round important 50%> |
+ | **Important** : Notez l'URL du **[[https:// | ||
+ | </ | ||
+ | |||
+ | Modifiez le fichier **/ | ||
< | < | ||
- | [root@centos7 ~]# which ansible | + | [root@redhat9 ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# vi /etc/hosts |
- | /bin/ansible | + | [root@redhat9 |
- | [root@centos7 ~]# which ansible-playbook | + | 127.0.0.1 |
- | /bin/ansible-playbook | + | ::1 |
+ | redhat9.ittraining.loc | ||
+ | autohub.ittraining.loc | ||
</ | </ | ||
- | Afin de vous aider, on vous fournit deux fichiers | + | Installez ensuite le paquet **ansible-core** |
< | < | ||
- | [root@centos7 ~]# cat vsftpd.yml | + | [root@redhat9 ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# |
- | --- | + | Updating Subscription Management repositories. |
- | - name: ftp server | + | 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. |
- | | + | ================================================================================================================================================================================================================== |
- | - users.yml | + | |
- | tasks: | + | ================================================================================================================================================================================================================== |
- | - name: latest vsftpd version | + | Installing: |
- | yum: | + | ansible-core |
- | name: vsftpd | + | Installing dependencies: |
- | state: latest | + | git-core |
- | - name: latest firewalld version | + | |
- | name: firewalld | + | |
- | state: latest | + | |
- | - name: vsftpd | + | |
- | | + | |
- | name vsftpd | + | |
- | enabled: true | + | |
- | state: started | + | |
- | - name: firewalld | + | |
- | | + | |
- | name: firewalld | + | |
- | | + | |
- | state: started | + | |
- | - name: firewalld allows ftp | + | |
- | | + | Transaction Summary |
- | | + | ================================================================================================================================================================================================================== |
- | | + | Install |
- | state: enabled | + | |
- | - name: Create_FTP_users | + | Total download size: 22 M |
- | user: | + | 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 00:07 | ||
+ | Red Hat Enterprise Linux 9 for x86_64 - AppStream (RPMs) | ||
+ | Importing GPG key 0xFD431D51: | ||
+ | Userid | ||
+ | Fingerprint: 567E 347A D004 4ADE 55BA 8A5F 199E 2F91 FD43 1D51 | ||
+ | From : / | ||
+ | Is this ok [y/N]: y | ||
+ | Key imported successfully | ||
+ | Importing GPG key 0x5A6340B3: | ||
+ | Userid | ||
+ | Fingerprint: 7E46 2425 8C40 6535 D56D 6F13 5054 E4A4 5A63 40B3 | ||
+ | | ||
+ | Is this ok [y/N]: y | ||
</ | </ | ||
+ | |||
+ | ====1.2 - Installation=== | ||
+ | |||
+ | Éditez maintenant le fichier **inventory** : | ||
< | < | ||
- | [root@centos7 ~]# ansible-vault view secrets.yml | + | [root@redhat9 |
- | Vault password: fenestros | + | |
- | ftp_users: | + | |
- | - { username: mike, password: toto } | + | |
- | - { username: bob, password: tata } | + | |
</ | </ | ||
- | Lors de l'exécution | + | < |
+ | ... | ||
+ | [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='fenestros' | ||
+ | |||
+ | 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 | ||
< | < | ||
- | [root@centos7 ~]# ansible-playbook vsftpd.yml | + | [root@redhat9 |
- | | + | ... |
+ | PLAY RECAP ********************************************************************* | ||
+ | localhost | ||
+ | redhat9.ittraining.loc | ||
+ | </ | ||
- | | + | ====1.3 - Consultation==== |
- | ERROR! Syntax Error while loading YAML. | + | Connectez-vous à votre VM **Debian_10.0.2.46_VNC** : |
+ | {{ : | ||
- | 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: |
- | | + | Acceptez le certificat auto-signé |
- | name: firewalld | + | |
- | ^ here | + | |
- | exception type: <class 'yaml.scanner.ScannerError'> | + | {{ :elearning: |
- | exception: mapping 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** : |
+ | |||
+ | {{ : | ||
+ | |||
+ | Cliquez sur le bouton **Username/ | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Vous obtiendrez : | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | =====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]# | ||
</ | </ | ||
- | A vous de jouer ! | + | Enregistrez la VM dans **votre** compte Red Hat : |
- | [isauth account,@admin] | + | < |
+ | [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 | ||
+ | </ | ||
- | ====1.2 - Corrigés==== | + | Configurez SELinux en mode permissive : |
- | ===Erreur | + | < |
+ | [root@autohub ~]# setenforce permissive | ||
+ | </ | ||
- | Éditez | + | Désarchivez |
< | < | ||
- | [root@centos7 | + | [root@autohub |
- | [root@centos7 | + | |
- | --- | + | [root@autohub |
- | - name: ftp server install | + | |
- | hosts: localhost | + | [root@autohub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# |
- | gather_facts: | + | bundle |
- | become: yes | + | |
- | vars_files: | + | |
- | | + | |
- | tasks: | + | |
- | | + | |
- | yum: | + | |
- | name: vsftpd | + | |
- | state: latest | + | |
- | | + | |
- | | + | |
- | name: firewalld | + | |
- | state: latest | + | |
- | | + | |
- | service: | + | |
- | name vsftpd | + | |
- | enabled: true | + | |
- | state: started | + | |
- | | + | |
- | service: | + | |
- | name: firewalld | + | |
- | enabled: true | + | |
- | state: started | + | |
- | | + | |
- | firewalld: | + | |
- | permanent: yes | + | |
- | immediate: yes | + | |
- | state: enabled | + | |
- | | + | |
- | | + | |
- | password: "{{ item.password | password_hash(sha512) }}" | + | |
- | with_items: "{{ ftp_users }}" | + | |
</ | </ | ||
- | Relancez la commande | + | Modifiez le fichier |
< | < | ||
- | [root@centos7 ~]# ansible-playbook vsftpd.yml | + | [root@autohub |
- | [WARNING]: provided | + | [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 |
- | | + | ::1 localhost |
+ | 10.0.2.102 | ||
+ | </ | ||
- | The error appears to be in '/root/vsftpd.yml': line 20, column | + | Installez ensuite le paquet **ansible-core** : |
- | be elsewhere in the file depending on the exact syntax problem. | + | |
+ | < | ||
+ | [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: | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | sshpass | ||
- | The offending line appears to be: | + | Transaction Summary |
+ | ================================================================================================================================================================================================================== | ||
+ | Install | ||
- | name vsftpd | + | Total download size: 22 M |
- | | + | Installed size: 88 M |
- | ^ here | + | 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 | ||
</ | </ | ||
- | ===Erreur #2=== | + | ====2.2 - Installation==== |
- | Editez | + | Éditez maintenant |
< | < | ||
- | [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: | + | |
- | become: yes | + | |
- | vars_files: | + | |
- | | + | |
- | tasks: | + | |
- | | + | |
- | yum: | + | |
- | name: vsftpd | + | |
- | state: latest | + | |
- | | + | |
- | 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 }}" | + | |
</ | </ | ||
- | Relancez la commande | + | < |
+ | ... | ||
+ | [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' | ||
< | < | ||
- | [WARNING]: provided hosts list is empty, only localhost | + | [root@autohub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# ./ |
- | ERROR! vars 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 |
+ | localhost | ||
+ | |||
+ | [error] Oops! An error occurred while running setup. | ||
+ | [warn] / | ||
+ | [warn] Provided path does not exist or is not accessible. Setup log saved to ./ | ||
</ | </ | ||
- | ===Erreur #3=== | + | En cas d' |
- | Créez | + | < |
+ | [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 | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Connectez-vous à votre Ansible® Automation Hub en utilisant le compte | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Vous obtiendrez : | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | =====LAB #3 - Connecter l' | ||
+ | |||
+ | ====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@centos7 | + | [root@redhat9 |
- | [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, password: toto } | + | PLAY RECAP ********************************************************************* |
- | | + | localhost |
+ | redhat9.ittraining.loc | ||
+ | |||
+ | The setup process completed successfully. | ||
+ | Setup log saved to / | ||
</ | </ | ||
- | Relancez | + | A l' |
< | < | ||
- | [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 available. Note that the implicit localhost does not match ' | + | -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 -> /root/ansible-automation-platform-setup-bundle-2.4-2.2-x86_64/ | ||
+ | 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 | ||
+ | </ | ||
- | PLAY [ftp server install] *********************************************************************************************************************************************** | + | Dans ce cas, la taille de l' |
- | TASK [latest vsftpd version] ******************************************************************************************************************************************** | + | < |
- | changed: [localhost] | + | [root@redhat9 ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# du -hs automation-platform-backup-* |
+ | 76K | ||
+ | 0 | ||
+ | </ | ||
- | TASK [latest firewalld version] ***************************************************************************************************************************************** | + | ====4.2 - Sauvegarder l' |
- | changed: [localhost] | + | |
- | TASK [vsftpd] | + | Connectez-vous maintenant à votre VM **autohub.ittraining.loc** : |
- | changed: [localhost] | + | |
- | TASK [firewalld] ******************************************************************************************************************************************************** | + | < |
- | ok: [localhost] | + | [root@redhat9 ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# ssh -l trainee 10.0.2.102 |
+ | </ | ||
- | TASK [firewalld allows ftp] ********************************************************************************************************************************************* | + | La sauvegarde de l' |
- | ok: [localhost] | + | |
- | TASK [Create_FTP_users] ************************************************************************************************************************************************* | + | < |
- | fatal: [localhost]: FAILED! | + | [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 | ||
- | PLAY RECAP ************************************************************************************************************************************************************** | + | The setup process completed successfully. |
- | localhost | + | [warn] / |
+ | [warn] Provided path does not exist or is not accessible. Setup log saved to ./ | ||
</ | </ | ||
- | ===Erreurs 4, 5 et 6=== | + | A l' |
< | < | ||
- | [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-------. |
- | - name: ftp server install | + | lrwxrwxrwx. 1 root root 117 Oct 24 11:09 automation-platform-backup-latest.tar.gz -> / |
- | hosts: localhost | + | -rw-r-----. 1 root root 116738 Oct 24 11:09 backup.log |
- | gather_facts: | + | 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 |
- | | + | 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 |
- | | + | -rw-r--r--. 1 root root 530 Oct 13 17:11 README.md |
- | yum: | + | -rw-r-----. 1 root root |
- | name: vsftpd | + | -rwxr-xr-x. 1 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 |
- | | + | |
- | yum: <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | + | |
- | name: firewalld | + | |
- | | + | |
- | - name: vsftpd | + | |
- | service: | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | service: | + | |
- | name: firewalld | + | |
- | enabled: true | + | |
- | state: started | + | |
- | | + | |
- | | + | |
- | permanent: yes | + | |
- | immediate: yes | + | |
- | state: enabled | + | |
- | | + | |
- | | + | |
- | name: "{{ item.username }}" | + | |
- | password: "{{ item.password | password_hash(' | + | |
- | | + | |
</ | </ | ||
- | Relancez | + | Dans ce cas, la taille de l' |
< | < | ||
- | [root@centos7 ~]# ansible-playbook vsftpd.yml | + | [root@autohub |
- | [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match ' | + | 594M automation-platform-backup-2023-10-24-11:07:36.tar.gz |
+ | 0 | ||
+ | </ | ||
- | PLAY [ftp server install] *********************************************************************************************************************************************** | + | ====4.3 - Restaurer l' |
- | TASK [latest vsftpd version] ******************************************************************************************************************************************** | + | Copiez le fichier |
- | ok: [localhost] | + | |
- | TASK [latest firewalld version] ***************************************************************************************************************************************** | + | < |
- | ok: [localhost] | + | [root@autohub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# cp automation-platform-backup-2023-10-24-11\: |
+ | </ | ||
- | TASK [vsftpd] | + | Copiez le fichier |
- | ok: [localhost] | + | |
- | TASK [firewalld] ******************************************************************************************************************************************************** | + | < |
- | 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:/ |
+ | The authenticity of host ' | ||
+ | ED25519 key fingerprint is SHA256:k/ | ||
+ | This key is not known by any other names | ||
+ | Are you sure you want to continue connecting (yes/no/[fingerprint])? yes | ||
+ | Warning: Permanently added ' | ||
+ | trainee@10.0.2.103' | ||
+ | automation-platform-backup.tar.gz | ||
+ | </ | ||
- | TASK [firewalld allows ftp] ********************************************************************************************************************************************* | + | Copiez ensuite le fichier |
- | ok: [localhost] | + | |
- | TASK [Create_FTP_users] ************************************************************************************************************************************************* | + | < |
- | changed: | + | [root@autohub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# scp inventory trainee@10.0.2.103:/ |
- | changed: [localhost] => (item={u' | + | trainee@10.0.2.103's password: |
+ | inventory | ||
+ | </code> | ||
- | PLAY RECAP ************************************************************************************************************************************************************** | + | Connectez-vous maintenant à votre VM **backuphub** selon votre numéro de stagiaire : |
- | localhost | + | |
+ | < | ||
+ | [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 ~]# | ||
</ | </ | ||
- | Crypter le fichier users.yml | + | Enregistrez la VM dans **votre** compte Red Hat : |
< | < | ||
- | [root@centos7 | + | [root@backuphub |
- | New Vault password: fenestros | + | Registering to: subscription.rhsm.redhat.com: |
- | Confirm New Vault password: | + | Username: < |
- | Encryption successful | + | Password: <password> |
+ | The system has been registered with ID: a52fe25b-0bfd-4c60-8898-68de681c9fda | ||
+ | The registered system name is: backuphub.ittraining.loc | ||
</ | </ | ||
- | Consultez le fichier users.yml | + | Configurez SELinux en mode permissive |
< | < | ||
- | [root@centos7 | + | [root@backuphub |
- | Vault password: | + | </ |
- | ftp_users: | + | |
- | | + | 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@centos7 ~]# cat users.yml | + | [root@autohub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# ls |
- | $ANSIBLE_VAULT; | + | bundle |
- | 30323061313265353234666230373765333865663061626362646332376639356463623238343166 | + | |
- | 3635356261383732373633626230353837393735393933390a323561663963666262343835363166 | + | |
- | 61306137383463303138656131626236633935383031323864396164366139323265653732663834 | + | |
- | 6130656163356661360a663635333537373961616230353766666130633537323065663161393939 | + | |
- | 65353936613539303631373530643536616335356461323735646165616136303839636166663232 | + | |
- | 38616133393235636632646461346430373966306463636662333431373936633837616336326461 | + | |
- | 38633139616339343865626630333531366138313761663330346231333131346535663761396233 | + | |
- | 35353036373530323636636335336539616433373461653866316138306632323038626266623264 | + | |
- | 6634 | + | |
</ | </ | ||
- | Exécutez | + | Installez |
< | < | ||
- | [root@centos7 | + | [root@backuphub |
- | Vault password: fenestros | + | </ |
- | [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match ' | + | |
- | PLAY [ftp server install] ************************************************************************************************************************************************* | + | Copiez le fichier |
- | TASK [latest vsftpd version] ********************************************************************************************************************************************** | + | < |
- | ok: [localhost] | + | [root@backuphub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# cp / |
+ | </ | ||
- | TASK [latest firewalld version] | + | Ajoutez un lien symbolique vers le fichier |
- | ok: [localhost] | + | |
- | TASK [vsftpd] ************************************************************************************************************************************************************* | + | < |
- | 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 | ||
+ | </ | ||
- | TASK [firewalld] ********************************************************************************************************************************************************** | + | <WRAP center round important 50%> |
- | ok: [localhost] | + | **Important** : Le processus de restauration recherche le fichier identifié par le lien symbolique |
+ | </ | ||
- | TASK [firewalld allows ftp] *********************************************************************************************************************************************** | + | Copiez le fichier |
- | ok: [localhost] | + | |
- | TASK [Create_FTP_users] *************************************************************************************************************************************************** | + | < |
- | changed: [localhost] => (item={u'username': u' | + | [root@backuphub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# cp / |
- | changed: [localhost] => (item={u' | + | cp: overwrite |
+ | </code> | ||
- | PLAY RECAP **************************************************************************************************************************************************************** | + | Modifiez le nom d' |
- | localhost | + | |
+ | < | ||
+ | [root@backuphub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# | ||
</ | </ | ||
- | Notez que malgré | + | Modifiez |
+ | < | ||
+ | [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@centos7 ~]# vi vsftpd.yml | + | [root@backuphub ansible-automation-platform-setup-bundle-2.4-2.2-x86_64]# ./setup.sh |
- | [root@centos7 ~]# cat vsftpd.yml | + | |
... | ... | ||
- | | + | PLAY RECAP ********************************************************************* |
- | user: | + | autohub.ittraining.loc |
- | name: "{{ item.username }}" # pas d' | + | localhost |
- | | + | |
- | | + | [error] Oops! An error occurred while running setup. |
- | no_log: True | + | [warn] / |
+ | [warn] Provided path does not exist or is not accessible. Setup log saved to ./ | ||
</ | </ | ||
- | 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 |
< | < | ||
- | [root@centos7 ~]# ansible-playbook vsftpd.yml | + | [root@backuphub |
- | Vault password: fenestros | + | |
- | [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match ' | + | |
... | ... | ||
- | TASK [Create_FTP_users] *************************************************************************************************************************************************** | + | PLAY RECAP ********************************************************************* |
- | changed: [localhost] | + | autohub.ittraining.loc |
- | changed: [localhost] | + | localhost |
- | PLAY RECAP **************************************************************************************************************************************************************** | + | The setup process completed successfully. |
- | localhost | + | [warn] / |
+ | [warn] Provided path does not exist or is not accessible. Setup log saved to ./ | ||
</ | </ | ||
- | [/isauth] | + | 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 de la Collection **ittraining** : | ||
+ | |||
+ | {{ : | ||
----- | ----- | ||
- | Copyright © 2022 Hugh Norris. | + | Copyright © 2024 Hugh Norris |