====== Useful Ansible snippets ====== ===== Inventory ===== === list all inventory groups alphabetically === ansible localhost -m debug -a 'var=groups.keys()|sort' === list all hosts in group === ansible $GROUP_NAME --list-hosts === list all groups a host is in === ansible $HOST_NAME_AS_IN_INVENTORY -m debug -a 'var=group_names' ===== Conditions ===== ==== Operating system ==== Run this on FreeBSD which is not on PowerPC, or on Debian: when: "(ansible_os_family == 'FreeBSD' and ansible_architecture != 'powerpc') or ansible_os_family == 'Debian'"