List inventory hosts

Show all hosts and groups parsed from inventory

ansible-inventory -i inventory --list | jq 'keys'

tool
ansible56 commands
tags
ansible

More ansible commands

  • ansible-playbook playbook.yml -e 'env=prod version=2.0'

    Pass extra variables at runtime overriding playbook defaults

  • ansible-playbook playbook.yml -vvv

    Maximum verbosity — shows every task, connection, output

  • ansible-playbook playbook.yml --syntax-check

    Validate YAML syntax without executing any tasks

  • ansible all -m ping -i inventory.ini

    Check SSH connectivity and Python for all hosts

  • ansible webservers -m shell -a 'uptime && free -h' -i inventory.ini

    Run a shell command on all hosts in the webservers group

all 56 ansible commands