diff --git a/README.md b/README.md index 4b65e3292b5109dcee9f950229e05f1558d0612f..77189edb66a363e2dbd4b91605a6dc5a23245875 100644 --- a/README.md +++ b/README.md @@ -16,3 +16,58 @@ répondre à la question. - `all` $\rightarrow$ permet de spécifier sur quelles machines de l'inventaire le module sera appliqué, en l'occurrence on l'appliquera sur toutes les machines de l'inventaire donc H1, H2, R1, R2 +- Donner la commande _ad-hoc_ qui permet d’afficher l’uptime de toutes les +machines, sans écrire de fichier inventaire. Démontrez que cette commande est +correcte en l’exécutant sur la topologie + ```bash + ansible -a "uptime" -i "H1,H2,R1,R2" all + ansible -m command -a "uptime" -i "H1,H2,R1,R2" all + ``` + ```bash + [WARNING]: Platform linux on host H2 is using the discovered Python interpreter at /usr/bin/python3.9, but future installation of another Python interpreter could change the + meaning of that path. See https://docs.ansible.com/ansible-core/2.18/reference_appendices/interpreter_discovery.html for more information. + H2 | CHANGED | rc=0 >> + 08:47:28 up 46 min, 2 users, load average: 0.00, 0.00, 0.00 + [WARNING]: Platform linux on host R1 is using the discovered Python interpreter at /usr/bin/python3.9, but future installation of another Python interpreter could change the + meaning of that path. See https://docs.ansible.com/ansible-core/2.18/reference_appendices/interpreter_discovery.html for more information. + R1 | CHANGED | rc=0 >> + 08:47:29 up 46 min, 2 users, load average: 0.00, 0.00, 0.00 + [WARNING]: Platform linux on host R2 is using the discovered Python interpreter at /usr/bin/python3.9, but future installation of another Python interpreter could change the + meaning of that path. See https://docs.ansible.com/ansible-core/2.18/reference_appendices/interpreter_discovery.html for more information. + R2 | CHANGED | rc=0 >> + 08:47:29 up 46 min, 2 users, load average: 0.00, 0.00, 0.00 + [WARNING]: Platform linux on host H1 is using the discovered Python interpreter at /usr/bin/python3.9, but future installation of another Python interpreter could change the + meaning of that path. See https://docs.ansible.com/ansible-core/2.18/reference_appendices/interpreter_discovery.html for more information. + H1 | CHANGED | rc=0 >> + 08:47:29 up 46 min, 2 users, load average: 0.00, 0.00, 0.00 + ``` +- Donner la commande _ad-hoc_ qui va créer le fichier `/tmp/hello.txt` sur toutes +les machines. Montrez sa sortie par une capture d’écran. + ```bash + ansible -a "touch /tmp/hello.txt" -i "H1,H2,R1,R2" all + ``` + ```bash + [WARNING]: Platform linux on host H1 is using the discovered Python interpreter at /usr/bin/python3.9, but future installation of another Python interpreter could change the + meaning of that path. See https://docs.ansible.com/ansible-core/2.18/reference_appendices/interpreter_discovery.html for more information. + H1 | CHANGED | rc=0 >> + + [WARNING]: Platform linux on host R1 is using the discovered Python interpreter at /usr/bin/python3.9, but future installation of another Python interpreter could change the + meaning of that path. See https://docs.ansible.com/ansible-core/2.18/reference_appendices/interpreter_discovery.html for more information. + R1 | CHANGED | rc=0 >> + + [WARNING]: Platform linux on host H2 is using the discovered Python interpreter at /usr/bin/python3.9, but future installation of another Python interpreter could change the + meaning of that path. See https://docs.ansible.com/ansible-core/2.18/reference_appendices/interpreter_discovery.html for more information. + H2 | CHANGED | rc=0 >> + + [WARNING]: Platform linux on host R2 is using the discovered Python interpreter at /usr/bin/python3.9, but future installation of another Python interpreter could change the + meaning of that path. See https://docs.ansible.com/ansible-core/2.18/reference_appendices/interpreter_discovery.html for more information. + R2 | CHANGED | rc=0 >> + ``` +- Quelle est la différente entre les modules `command`, `shell` et `raw` ? +Expliquez et donner des exemples. + - `command` $\rightarrow$ + - `shell` $\rightarrow$ + - `raw` $\rightarrow$ ce module est différent des deux autres dans la mesure + où il ne transfère pas de code `python` sur l'hôte distant. La commande + spécifié sera exécuté par le daemon `sshd` en créant un processus enfant + sur la machine distante