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/04/13 12:57] – 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 |
- | =====Arrêter les Machines Virtuelles non Indisponsables===== | + | =====Contenu du Module===== |
- | ====Formations en FFP==== | + | * **LCF805 - Validation de la Formation** |
+ | * Contenu du Module | ||
+ | * Rappel du Programme de la Formation | ||
+ | * Validation des acquis globale | ||
+ | * Évaluation de la Formation | ||
- | Utilisez l' | + | =====Rappel du Programme |
- | Restaurez ensuite les machines virtuelles | + | |
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
- | ====Formations en FAD==== | + | * **LCF801 - Installation d' |
+ | * Qu' | ||
+ | * Installation d' | ||
+ | * LAB #1 - Configuration de ssh et de sudo | ||
+ | * 1.1 - ssh | ||
+ | * 1.2 - sudo | ||
- | Utilisez les commandes suivantes pour arrêter les machines virtuelles les machines virtuelles | + | |
+ | * LAB #1 - Débuter avec Ansible | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | * 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** |
- | trainee@ansible: | + | * LAB #1 - Dépendances de Rôles |
- | déconnexion | + | * LAB #2 - Utilisation des Gabarits |
- | Connection to localhost closed. | + | * 2.1 - Variables |
- | desktop@server16: | + | * 2.2 - Gabarits Conditionnels |
- | 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% | + | * 2.3 - Boucles |
- | desktop@server16: | + | * 2.4 - Macros |
- | 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% | + | * 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 | ||
- | Restaurez l' | + | * **LCF804 - Utilisation |
+ | * 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 | ||
- | < | + | * **LCF805 |
- | desktop@server16: | + | * Support de Cours |
- | Restoring snapshot ' | + | * Rappel du Programme de la Formation |
- | 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% | + | * Validation des acquis globale |
- | desktop@server16: | + | * Évaluation de la Formation |
- | Restoring snapshot ' | + | |
- | 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% | + | |
- | </ | + | |
- | =====LAB #17 - Automatiser avec Ansible===== | + | =====Évaluation de la Formation===== |
- | Lancez | + | Afin de valider votre formation, veuillez compléter l’Évaluation de la Formation. |
- | Si vous êtes en FAD, utilisez la commande suivante : | + | ----- |
- | < | + | Copyright © 2023 Hugh Norris |
- | 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 | + | |
- | </ | + | |
- | </ | + |