summaryrefslogtreecommitdiff
path: root/3 resources/ansible/ad-hoc-commands.md
blob: eda1265db1d83a58dd7b580b6e915087db199aa9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Using ansible we can perform ad-hoc commands, useful for a one-off thing that won't require writing a full playbook.

Some examples include:
update apt cache:
```
ansible <pattern> -m ansible.builtin.apt -a "update_cache=true cache_valid_time=3600"
```

update packages:
```
ansible <pattern> -m ansible.builtin.apt -a "name=* state=latest"
```

run puppet:
```
ansible <pattern> -a "/opt/puppetlabs/bin/puppet agent --test"
```

reboot:
```
ansible <pattern> -m ansible.builtin.reboot -f 1
```

[[ansible]]
#ansible