|
2 | 2 |
|
3 | 3 | > Manage groups of computers remotely over SSH. (use the `/etc/ansible/hosts` file to add new groups/hosts).
|
4 | 4 | > Some subcommands such as `galaxy` have their own usage documentation.
|
5 |
| -> More information: <https://www.ansible.com/>. |
| 5 | +> More information: <https://docs.ansible.com/ansible/latest/cli/ansible.html>. |
6 | 6 |
|
7 | 7 | - List hosts belonging to a group:
|
8 | 8 |
|
9 | 9 | `ansible {{group}} --list-hosts`
|
10 | 10 |
|
11 |
| -- Ping a group of hosts by invoking the ping [m]odule: |
| 11 | +- Ping a group of hosts by invoking the ping module: |
12 | 12 |
|
13 |
| -`ansible {{group}} -m ping` |
| 13 | +`ansible {{group}} {{[-m|--module-name]}} ping` |
14 | 14 |
|
15 | 15 | - Display facts about a group of hosts by invoking the setup [m]odule:
|
16 | 16 |
|
17 |
| -`ansible {{group}} -m setup` |
| 17 | +`ansible {{group}} {{[-m|--module-name]}} setup` |
18 | 18 |
|
19 | 19 | - Execute a command on a group of hosts by invoking command module with arguments:
|
20 | 20 |
|
21 |
| -`ansible {{group}} -m command -a '{{my_command}}'` |
| 21 | +`ansible {{group}} {{[-m|--module-name]}} command {{[-a|--args]}} '{{my_command}}'` |
22 | 22 |
|
23 | 23 | - Execute a command with administrative privileges:
|
24 | 24 |
|
25 |
| -`ansible {{group}} --become --ask-become-pass -m command -a '{{my_command}}'` |
| 25 | +`ansible {{group}} {{[-b|--become]}} --ask-become-pass {{[-m|--module-name]}} command {{[-a|--args]}} '{{my_command}}'` |
26 | 26 |
|
27 | 27 | - Execute a command using a custom inventory file:
|
28 | 28 |
|
29 |
| -`ansible {{group}} -i {{inventory_file}} -m command -a '{{my_command}}'` |
| 29 | +`ansible {{group}} {{[-i|--inventory]}} {{inventory_file}} {{[-m|--module-name]}} command {{[-a|--args]}} '{{my_command}}'` |
30 | 30 |
|
31 | 31 | - List the groups in an inventory:
|
32 | 32 |
|
33 |
| -`ansible localhost -m debug -a '{{var=groups.keys()}}'` |
| 33 | +`ansible localhost {{[-m|--module-name]}} debug {{[-a|--args]}} '{{var=groups.keys()}}'` |
0 commit comments