Skip to main content
  1. Notes/
  2. Ansible/

Ansible commands

66 words
Table of Contents

Execute a uname -r on serverx:

ansible serverx -m command -a 'uname -r'

Execute a uname -r on serverx short:

ansible serverx -a 'uname -r'

List hosts in inventory:

ansible serverx --list-hosts
ansible all --list-hosts
ansible '*' --list-hosts

List all hosts in inventory but not the stinky group:

ansible 'all:!stinky' --list-hosts

Check the format of a playbook:

ansible-playbook --syntax-check someplay.yml

reference
#