ansible command
The command-line tool that runs a single module against a host pattern, used for ad hoc commands and quick checks.
In more detail
Its shape is ansible <pattern> -m <module> -a "<arguments>". Run with --version it prints the ansible-core version and the Python it uses, and with --list-hosts it shows which hosts a pattern selects without contacting any of them.
Example
ansible all -m ansible.builtin.pingRelated terms
- ad hoc command — A single Ansible module run against a set of hosts straight from the command line, without writing a playbook.
- host pattern — An expression that picks which hosts a command or play runs against, built from host names, group names and operators.
- --list-hosts — The flag that prints exactly which hosts a pattern selects, without connecting to any of them or running anything.
- ansible-playbook — The command that runs a playbook, printing a banner for each play and task, a result per host, and a recap at the end.
Taught in
- Ansible Architecture And The Control Node — Ansible Configuration Management at Scale
- Installing Ansible — Ansible Configuration Management at Scale
- Your First Ad Hoc Command — Ansible Configuration Management at Scale
- The Static Inventory File — Ansible Configuration Management at Scale
- Connections And Privilege Escalation — Ansible Configuration Management at Scale
- Static Inventories: Hosts, Groups And Groups Of Groups — RHCE in Ansible (EX294): Automate Red Hat Systems
- ansible.cfg: Which File Wins, And The Settings That Matter — RHCE in Ansible (EX294): Automate Red Hat Systems
- SSH Keys And An Account For Ansible — RHCE in Ansible (EX294): Automate Red Hat Systems
- Privilege Escalation: sudo Rules And become — RHCE in Ansible (EX294): Automate Red Hat Systems