solution blockinfile
This commit is contained in:
20
Readme.md
20
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"'
|
||||
```
|
||||
```
|
||||
|
||||
|
||||
## 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*
|
||||
|
||||
|
||||
Reference in New Issue
Block a user