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:debian:6:avance:l130:part6 [2020/05/27 17:07] – admin | elearning:workbooks:debian:6:avance:l130:part6 [2023/08/25 01:32] (Version actuelle) – admin | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| ~~PDF: | ~~PDF: | ||
| - | Version | + | Version |
| Dernière mise-à-jour : ~~LASTMOD~~ | Dernière mise-à-jour : ~~LASTMOD~~ | ||
| - | ======DOF506 | + | ======LCF805 |
| =====Contenu du Module===== | =====Contenu du Module===== | ||
| - | * **DOF506 | + | * **LCF805 |
| - | * Ansible par la Pratique | + | * Contenu du Module |
| - | * LAB #17 - Automatiser avec Ansible | + | * Rappel |
| - | | + | * Validation des acquis globale |
| - | * la mise à jour éventuelle de firewalld | + | * Évaluation |
| - | * la création d'une règle dans firewalld pour le trafic vers le serveur vsfptd | + | |
| - | * la création sécurisée | + | |
| - | =====Arrêter les Machines Virtuelles non Indisponsables===== | + | =====Rappel du Programme de la Formation===== |
| - | ====Formations en FFP==== | + | * **LCF800 - Présentation de la Formation**. |
| + | * Prérequis | ||
| + | * Matériel | ||
| + | * Logiciels | ||
| + | * Internet | ||
| + | * Programme de la Formation | ||
| + | * Validation des Prérequis | ||
| - | Utilisez l' | + | |
| + | | ||
| + | | ||
| + | | ||
| + | * 1.1 - ssh | ||
| + | | ||
| - | Restaurez ensuite les machines virtuelles | + | |
| + | * LAB #1 - Débuter avec Ansible | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | * 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 | ||
| - | Dernièrement, supprimez la règle | + | * **LCF803 - Rôles, Gabarits, Variables et Facts** |
| + | * LAB #1 - Dépendances | ||
| + | * 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 | ||
| + | | ||
| + | | ||
| + | * 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 | ||
| + | | ||
| + | | ||
| - | ====Formations en FAD==== | + | * **LCF804 - Utilisation d' |
| + | * LAB #1 - Ansible et Docker | ||
| + | * 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 | ||
| - | Utilisez les commandes suivantes pour arrêter les machines virtuelles les machines virtuelles | + | |
| + | | ||
| + | | ||
| + | | ||
| + | * Évaluation de la Formation | ||
| - | < | + | =====Évaluation de la Formation===== |
| - | trainee@ansible: | + | |
| - | déconnexion | + | |
| - | Connection to localhost closed. | + | |
| - | desktop@server16: | + | |
| - | 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% | + | |
| - | desktop@server16: | + | |
| - | 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% | + | |
| - | </ | + | |
| - | Restaurez | + | Afin de valider votre formation, veuillez compléter |
| - | < | + | ----- |
| - | desktop@server16: | + | |
| - | Restoring snapshot ' | + | |
| - | 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% | + | |
| - | desktop@server16: | + | |
| - | Restoring snapshot ' | + | |
| - | 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% | + | |
| - | </ | + | |
| - | Dernièrement, | + | Copyright © 2023 Hugh Norris |
| - | + | ||
| - | < | + | |
| - | desktop@server16: | + | |
| - | </ | + | |
| - | + | ||
| - | =====LAB #17 - Automatiser avec Ansible===== | + | |
| - | + | ||
| - | Lancez la machine virtuelle **CentOS_7**. | + | |
| - | + | ||
| - | Si vous êtes en FAD, utilisez la commande suivante : | + | |
| - | + | ||
| - | < | + | |
| - | desktop@server16: | + | |
| - | Waiting for VM " | + | |
| - | VM " | + | |
| - | </ | + | |
| - | + | ||
| - | Connectez-vous à la VM en ssh en utilisant **localhost: | + | |
| - | + | ||
| - | Il vous est demandé d' | + | |
| - | + | ||
| - | * l' | + | |
| - | * la mise à jour éventuelle de firewalld, | + | |
| - | * la création d'une règle dans firewalld pour le trafic vers le serveur vsfptd, | + | |
| - | * la création sécurisée de deux comptes ftp : | + | |
| - | * user : mike | + | |
| - | * mot de passe : toto | + | |
| - | * user : bob | + | |
| - | * mot de passe : tata | + | |
| - | + | ||
| - | Installez donc Ansible à partir des dépôts : | + | |
| - | + | ||
| - | < | + | |
| - | [trainee@centos7 ~]$ su - | + | |
| - | Mot de passe : fenestros | + | |
| - | Dernière connexion : jeudi 5 septembre 2019 à 18:28:51 CEST sur pts/0 | + | |
| - | + | ||
| - | [root@centos7 ~]# yum install ansible | + | |
| - | </ | + | |
| - | + | ||
| - | Vérifiez ensuite la présence des exécutables : | + | |
| - | + | ||
| - | < | + | |
| - | [root@centos7 ~]# which ansible | + | |
| - | / | + | |
| - | [root@centos7 ~]# which ansible-playbook | + | |
| - | / | + | |
| - | </ | + | |
| - | + | ||
| - | Afin de vous aider, on vous fournit deux fichiers : | + | |
| - | + | ||
| - | < | + | |
| - | [root@centos7 ~]# cat vsftpd.yml | + | |
| - | --- | + | |
| - | - name: ftp server install | + | |
| - | hosts: localhost | + | |
| - | gather_facts: | + | |
| - | become: yes | + | |
| - | vars_files: | + | |
| - | - users.yml | + | |
| - | tasks: | + | |
| - | - name: latest vsftpd version | + | |
| - | yum: | + | |
| - | name: vsftpd | + | |
| - | state: latest | + | |
| - | - name: latest firewalld version | + | |
| - | 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 }}" | + | |
| - | </ | + | |
| - | + | ||
| - | < | + | |
| - | [root@centos7 ~]# ansible-vault view secrets.yml | + | |
| - | Vault password: fenestros | + | |
| - | ftp_users: | + | |
| - | - { username: mike, password: toto } | + | |
| - | - { username: bob, password: tata } | + | |
| - | </ | + | |
| - | + | ||
| - | Lors de l' | + | |
| - | + | ||
| - | < | + | |
| - | [root@centos7 ~]# ansible-playbook vsftpd.yml | + | |
| - | | + | |
| - | + | ||
| - | | + | |
| - | + | ||
| - | ERROR! Syntax Error while loading YAML. | + | |
| - | + | ||
| - | + | ||
| - | The error appears to have been in '/ | + | |
| - | be elsewhere in the file depending on the exact syntax problem. | + | |
| - | + | ||
| - | The offending line appears to be: | + | |
| - | + | ||
| - | - name: latest firewalld version | + | |
| - | name: firewalld | + | |
| - | ^ here | + | |
| - | + | ||
| - | exception type: <class ' | + | |
| - | exception: mapping values are not allowed in this context | + | |
| - | in "< | + | |
| - | </ | + | |
| - | + | ||
| - | A vous de jouer ! | + | |
| - | + | ||
| - | <ifauth @admin> | + | |
| - | ====Erreur #1==== | + | |
| - | + | ||
| - | Editez le fichier **vsftpd.yml** : | + | |
| - | + | ||
| - | < | + | |
| - | [root@centos7 ~]# vi vsftpd.yml | + | |
| - | [root@centos7 ~]# cat vsftpd.yml | + | |
| - | --- | + | |
| - | - name: ftp server install | + | |
| - | hosts: localhost | + | |
| - | gather_facts: | + | |
| - | become: yes | + | |
| - | vars_files: | + | |
| - | - users.yml | + | |
| - | tasks: | + | |
| - | - name: latest vsftpd version | + | |
| - | yum: | + | |
| - | name: vsftpd | + | |
| - | state: latest | + | |
| - | - name: latest firewalld version | + | |
| - | 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 **ansible-playbook** : | + | |
| - | + | ||
| - | < | + | |
| - | [root@centos7 ~]# ansible-playbook vsftpd.yml | + | |
| - | [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match ' | + | |
| - | ERROR! Syntax Error while loading YAML. | + | |
| - | mapping values are not allowed in this context | + | |
| - | + | ||
| - | The error appears to be in '/ | + | |
| - | be elsewhere in the file depending on the exact syntax problem. | + | |
| - | + | ||
| - | The offending line appears to be: | + | |
| - | + | ||
| - | name vsftpd | + | |
| - | enabled: true | + | |
| - | ^ here | + | |
| - | </ | + | |
| - | + | ||
| - | ====Erreur #2==== | + | |
| - | + | ||
| - | Editez le fichier **vsftpd.yml** : | + | |
| - | + | ||
| - | < | + | |
| - | [root@centos7 ~]# vi vsftpd.yml | + | |
| - | [root@centos7 ~]# cat vsftpd.yml | + | |
| - | --- | + | |
| - | - name: ftp server install | + | |
| - | hosts: localhost | + | |
| - | gather_facts: | + | |
| - | become: yes | + | |
| - | vars_files: | + | |
| - | - users.yml | + | |
| - | tasks: | + | |
| - | - name: latest vsftpd version | + | |
| - | yum: | + | |
| - | name: vsftpd | + | |
| - | state: latest | + | |
| - | - name: latest firewalld version | + | |
| - | 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 **ansible-playbook** : | + | |
| - | + | ||
| - | < | + | |
| - | [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match ' | + | |
| - | ERROR! vars file users.yml was not found | + | |
| - | Could not find file on the Ansible Controller. | + | |
| - | If you are using a module and expect the file to exist on the remote, see the remote_src option | + | |
| - | </ | + | |
| - | + | ||
| - | ====Erreur #3==== | + | |
| - | + | ||
| - | Créez le fichier **users.yml** : | + | |
| - | + | ||
| - | < | + | |
| - | [root@centos7 ~]# vi users.yml | + | |
| - | [root@centos7 ~]# cat users.yml | + | |
| - | ftp_users: | + | |
| - | - { username: mike, password: toto } | + | |
| - | - { username: bob, password: tata } | + | |
| - | </ | + | |
| - | + | ||
| - | Relancez la commande **ansible-playbook** : | + | |
| - | + | ||
| - | < | + | |
| - | [root@centos7 ~]# mv user.yml users.yml | + | |
| - | [root@centos7 ~]# ansible-playbook vsftpd.yml | + | |
| - | [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match ' | + | |
| - | + | ||
| - | PLAY [ftp server install] *********************************************************************************************************************************************** | + | |
| - | + | ||
| - | TASK [latest vsftpd version] ******************************************************************************************************************************************** | + | |
| - | changed: [localhost] | + | |
| - | + | ||
| - | TASK [latest firewalld version] ***************************************************************************************************************************************** | + | |
| - | changed: [localhost] | + | |
| - | + | ||
| - | TASK [vsftpd] *********************************************************************************************************************************************************** | + | |
| - | changed: [localhost] | + | |
| - | + | ||
| - | TASK [firewalld] ******************************************************************************************************************************************************** | + | |
| - | ok: [localhost] | + | |
| - | + | ||
| - | TASK [firewalld allows ftp] ********************************************************************************************************************************************* | + | |
| - | ok: [localhost] | + | |
| - | + | ||
| - | TASK [Create_FTP_users] ************************************************************************************************************************************************* | + | |
| - | fatal: [localhost]: | + | |
| - | + | ||
| - | PLAY RECAP ************************************************************************************************************************************************************** | + | |
| - | localhost | + | |
| - | </ | + | |
| - | + | ||
| - | ====Erreurs 4, 5 et 6==== | + | |
| - | + | ||
| - | < | + | |
| - | [root@centos7 ~]# vi vsftpd.yml | + | |
| - | [root@centos7 ~]# cat vsftpd.yml | + | |
| - | --- | + | |
| - | - name: ftp server install | + | |
| - | hosts: localhost | + | |
| - | gather_facts: | + | |
| - | become: yes | + | |
| - | vars_files: | + | |
| - | - users.yml | + | |
| - | tasks: | + | |
| - | - name: latest vsftpd version | + | |
| - | yum: | + | |
| - | name: vsftpd | + | |
| - | state: latest | + | |
| - | - name: latest firewalld version | + | |
| - | 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: | + | |
| - | name: "{{ item.username }}" | + | |
| - | password: "{{ item.password | password_hash(' | + | |
| - | with_items: "{{ ftp_users }}" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | + | |
| - | </ | + | |
| - | + | ||
| - | Relancez la commande **ansible-playbook** : | + | |
| - | + | ||
| - | < | + | |
| - | [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match ' | + | |
| - | ERROR! vars file users.yml was not found | + | |
| - | Could not find file on the Ansible Controller. | + | |
| - | If you are using a module and expect the file to exist on the remote, see the remote_src option | + | |
| - | </ | + | |
| - | + | ||
| - | Relancez la commande **ansible-playbook** : | + | |
| - | + | ||
| - | < | + | |
| - | [root@centos7 ~]# ansible-playbook vsftpd.yml | + | |
| - | [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match ' | + | |
| - | + | ||
| - | PLAY [ftp server install] *********************************************************************************************************************************************** | + | |
| - | + | ||
| - | TASK [latest vsftpd version] ******************************************************************************************************************************************** | + | |
| - | ok: [localhost] | + | |
| - | + | ||
| - | TASK [latest firewalld version] ***************************************************************************************************************************************** | + | |
| - | ok: [localhost] | + | |
| - | + | ||
| - | TASK [vsftpd] *********************************************************************************************************************************************************** | + | |
| - | ok: [localhost] | + | |
| - | + | ||
| - | TASK [firewalld] ******************************************************************************************************************************************************** | + | |
| - | ok: [localhost] | + | |
| - | + | ||
| - | TASK [firewalld allows ftp] ********************************************************************************************************************************************* | + | |
| - | ok: [localhost] | + | |
| - | + | ||
| - | TASK [Create_FTP_users] ************************************************************************************************************************************************* | + | |
| - | changed: [localhost] => (item={u' | + | |
| - | changed: [localhost] => (item={u' | + | |
| - | + | ||
| - | PLAY RECAP ************************************************************************************************************************************************************** | + | |
| - | localhost | + | |
| - | </ | + | |
| - | + | ||
| - | =====Arrêter la Machine Virtuelle===== | + | |
| - | + | ||
| - | ====Formations en FFP==== | + | |
| - | + | ||
| - | Utilisez l' | + | |
| - | + | ||
| - | Restaurez ensuite la machine virtuelle **CentOS_7** vers son état d' | + | |
| - | + | ||
| - | ====Formations en FAD==== | + | |
| - | + | ||
| - | Utilisez les commandes suivantes pour arrêter la machine virtuelle **CentOS_7** : | + | |
| - | + | ||
| - | < | + | |
| - | desktop@server16: | + | |
| - | 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% | + | |
| - | </ | + | |
| - | + | ||
| - | Restaurez l' | + | |
| - | + | ||
| - | < | + | |
| - | desktop@server16: | + | |
| - | Restoring snapshot ' | + | |
| - | 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% | + | |
| - | </ | + | |
| - | + | ||
| - | </ | + | |
| - | + | ||
| - | ----- | + | |
| - | < | + | |
| - | <div align=" | + | |
| - | Copyright © 2020 Hugh NORRIS | + | |
| - | </ | + | |
| - | </ | + | |