File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -84,8 +84,8 @@ $ ansible --list-hosts lan
8484
8585## Run module on specific host or group
8686e.g.
87+ ### Ping all hosts of group wan
8788```
88- # ping all hosts of group 'wan'
8989$ ansible -m ping wan
9090vm05 | SUCCESS => {
9191 "changed": false,
@@ -95,14 +95,25 @@ vm06 | SUCCESS => {
9595 "changed": false,
9696 "ping": "pong"
9797}
98-
99- # execute 'echo world' on host vm01
98+ ```
99+ ### execute 'echo world' on host vm01
100+ ```
100101$ ansible -m shell -a "echo 'hello world'" vm01
101102vm01 | CHANGED | rc=0 >>
102103hello world
103104
104105```
105106
107+ ### Generate a template locally
108+ Very useful for local debug and avoiding additional code in your playbook or task files in role.
109+ ```
110+ # Generate the file /tmp/prometheus.yml from template roles/prometheus/templates/prometheus.yml
111+ $ ansible [--vault-password-file=~/.pass.txt] -m template -a "src=roles/prometheus/templates/prometheus.yml dest=/tmp/prometheus.yml" localhost
112+
113+ # Check the generated file locally
114+ $ promtool check config /tmp/prometheus.yml
115+ ```
116+
106117## Encryption/Decryption using ansible-vault
107118Documentation: https://docs.ansible.com/ansible/latest/cli/ansible-vault.html
108119### Using vault password file
You can’t perform that action at this time.
0 commit comments