From ad778a61bd789cc8dd9af0f69944535ef4d5f665 Mon Sep 17 00:00:00 2001 From: Thomas Constans Date: Mon, 14 Nov 2022 10:36:05 +0100 Subject: [PATCH] instructions indempotence --- Readme.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Readme.md diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..56df1ba --- /dev/null +++ b/Readme.md @@ -0,0 +1,25 @@ +# Indempotence. + +## Automatisation via un shell + +La commande suivante automatise (en shell) le déploiement de ma clé ssh sur une machine distante. + +```bash +ssh cible curl https://infra.opendoor.fr/id_rsa.pub -o ~/.ssh/authorized_keys +``` + +Identifier tous les problèmes que peut rencontrer ce script lors de son exécution. + +## Exécuter les commandes suivantes: + +Identifier lesquelles sont _indempotentes_ + +```bash +ansible all -u root -k -m debug -a 'msg="{{ 42 | random() }}"' -o +ansible all -u root -k -m debug -a 'msg="{{ 42 | random() }}"' -o + +ansible all -u root -k -m debug -a 'msg="{{ 1234 | random( seed='1234') }}"' -o + +ansible all -u root -k -m debug -a 'msg="{{ 1234 | random( seed=inventory_hostname ) }}"' -o +ansible all -u root -k -m debug -a 'msg="{{ 1234 | random( seed=inventory_hostname ) }}"' -o +``` \ No newline at end of file