diff --git a/Readme.md b/Readme.md index 53a397a..17ba12a 100644 --- a/Readme.md +++ b/Readme.md @@ -87,4 +87,22 @@ ansible -i hosts -o -u root -m cron -a 'name="update starship" cron_file="stars ```bash # avec distribution horaire aléatoire principe d'indempotence respecté ansible -i hosts -o -u root -m cron -a 'name="update starship" cron_file="starship" hour="12" minute="{{ 59 | random(seed=inventory_hostname) }}" weekday="sun" job="sh /tmp/install.sh -y" user="root"' -``` \ No newline at end of file +``` + + +## Rajouter des blocs de textes dans un fichier avec blockinfile + +Rajouter dans ~/.ssh/config, sur la machine *pilote* les infos suivantes: + +```bash +Host machinecible #cf variable inventory_hostname + User: formation + Port 22 +``` + +```bash +ansible -oi localhost all -u formation -m blockinfile -a 'path=/home/formation//.ssh/config block="Host {{ inventory_hostname }}\n\tPort 22" create=true marker="# {mark} ssh config for {{ inventory_hostname }}"' +``` + +⚠️ on travaile sur *localhost* +