Show pagesourceBack to top Share via Share via... Twitter LinkedIn Telegram Yammer RedditRecent ChangesSend via e-MailPrintPermalink × Table of Contents Inventory list all inventory groups alphabetically list all hosts in group list all groups a host is in Conditions Operating system 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'" Last modified: 2023-04-01 19:37