Gather facts for a host

Collect and filter Ansible facts for a single host

ansible <host> -m setup -i inventory.ini | jq '.ansible_facts | {os: .ansible_distribution, mem: .ansible_memtotal_mb}'

tool
ansible56 commands
tags
ansibledebug

More ansible commands

  • ansible-playbook site.yml --check --diff -i inventory.ini

    Show what would change without making any modifications

  • ansible-playbook deploy.yml -e 'env=prod version=2.1.0' -i inventory.ini

    Override variables from the command line

  • ansible-playbook site.yml --limit 'web-01,web-02' -i inventory.ini

    Run playbook only on specified hosts

  • ansible-playbook site.yml --tags 'config,restart' -i inventory.ini

    Execute only tasks marked with specified tags

  • ansible-playbook site.yml --skip-tags 'slow,optional' -i inventory.ini

    Skip tasks with specified tags

all 56 ansible commands