The document provides information on using Ansible playbooks and commands to execute tasks on remote hosts. It lists playbook commands for running playbooks on all or specific hosts, with options for testing, verbosity, and limiting parallelism. It also lists commands for getting info on playbook tasks and hosts, checking playbook syntax, executing ad hoc commands, and debugging with setup modules to view host facts and state.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
1K views2 pages
Ansible Cheat Sheet
The document provides information on using Ansible playbooks and commands to execute tasks on remote hosts. It lists playbook commands for running playbooks on all or specific hosts, with options for testing, verbosity, and limiting parallelism. It also lists commands for getting info on playbook tasks and hosts, checking playbook syntax, executing ad hoc commands, and debugging with setup modules to view host facts and state.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2
Ansible Cheat SheetEdit Cheat Sheet
Playbooks
ansible-playbook <YAML> # Run on all hosts defined
ansible-playbook <YAML> -f 10 # Run 10 hosts parallel ansible-playbook <YAML> --verbose # Verbose on successful tasks ansible-playbook <YAML> -C # Test run ansible-playbook <YAML> -C -D # Dry run ansible-playbook <YAML> -l <host> # Run on single host
Run Infos
ansible-playbook <YAML> --list-hosts
ansible-playbook <YAML> --list-tasks
Syntax Check
ansible-playbook --syntax-check <YAML>
Remote Execution
ansible all -m ping
Execute arbitrary commands
ansible <hostgroup> -a <command>
ansible all -a "ifconfig -a"
Debugging
List facts and state of a host
ansible <host> -m setup # All facts for one host
ansible <host> -m setup -a 'filter=ansible_eth*' # Only ansible fact for one host ansible all -m setup -a 'filter=facter_*' # Only facter facts but for all hosts