1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-23 05:02:10 +02:00
tldr/pages/common/ansible.md
Vitor Henrique 814e511bae
pages*: add missing mnemonics (part 1) (#12143)
* pages*: add missing mnemonics

---------

Co-authored-by: Lena <126529524+acuteenvy@users.noreply.github.com>
Co-authored-by: Sebastiaan Speck <12570668+sebastiaanspeck@users.noreply.github.com>
2024-02-09 20:04:08 +05:30

33 lines
992 B
Markdown

# ansible
> Manage groups of computers remotely over SSH. (use the `/etc/ansible/hosts` file to add new groups/hosts).
> Some subcommands such as `ansible galaxy` have their own usage documentation.
> More information: <https://www.ansible.com/>.
- List hosts belonging to a group:
`ansible {{group}} --list-hosts`
- Ping a group of hosts by invoking the ping [m]odule:
`ansible {{group}} -m ping`
- Display facts about a group of hosts by invoking the setup [m]odule:
`ansible {{group}} -m setup`
- Execute a command on a group of hosts by invoking command module with arguments:
`ansible {{group}} -m command -a '{{my_command}}'`
- Execute a command with administrative privileges:
`ansible {{group}} --become --ask-become-pass -m command -a '{{my_command}}'`
- Execute a command using a custom inventory file:
`ansible {{group}} -i {{inventory_file}} -m command -a '{{my_command}}'`
- List the groups in an inventory:
`ansible localhost -m debug -a '{{var=groups.keys()}}'`