solution cron
This commit is contained in:
17
Readme.md
17
Readme.md
@@ -70,4 +70,21 @@ dans /etc/vimrc, assurez-vous que la ligne 62 (qui commence par set list listcha
|
|||||||
ansible -i hosts -o -u root all -m lineinfile -a 'path=/etc/vimrc regex="^\"(set list listchars.*)" line=\1 backrefs=true'
|
ansible -i hosts -o -u root all -m lineinfile -a 'path=/etc/vimrc regex="^\"(set list listchars.*)" line=\1 backrefs=true'
|
||||||
#ou en recopiant la ligne entière
|
#ou en recopiant la ligne entière
|
||||||
ansible -i hosts -o -u root all -m lineinfile -a 'path=/etc/vimrc regex="^\"set list listchars.*" line=set list listchars=nbsp:▶,tab:··,trail:¤,extends:▶,precedes:◀'
|
ansible -i hosts -o -u root all -m lineinfile -a 'path=/etc/vimrc regex="^\"set list listchars.*" line=set list listchars=nbsp:▶,tab:··,trail:¤,extends:▶,precedes:◀'
|
||||||
|
```
|
||||||
|
|
||||||
|
## Planifier l'exécution de la tâche "_Exécuter des scripts à distance avec command_" toutes les semaines le dimanche soir avec cron
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ansible -i hosts -o -u root -m cron -a 'name="update starship" cron_file="starship" hour="12" minute="01" weekday="sun" job="sh /tmp/install.sh -y" user="root'
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# avec distribution horaire aléatoire ⚠️ principe d'indempotence non respecté
|
||||||
|
ansible -i hosts -o -u root -m cron -a 'name="update starship" cron_file="starship" hour="12" minute="{{ 59 | random() }}" weekday="sun" job="sh /tmp/install.sh -y" user="root"'
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
```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"'
|
||||||
```
|
```
|
||||||
Reference in New Issue
Block a user