ansible / ansible.builtin / v2.4.3.0-1 / lookup / inventory_hostnames list of inventory hosts matching a host pattern | "added in version" 1.3 of ansible.builtin" Authors: Michael DeHaan <michael.dehaan@gmail.com>, Steven Dossett <sdossett@panath.com>ansible.builtin.inventory_hostnames (v2.4.3.0-1) — lookup
pip
Install with pip install ansible==2.4.3.0.post1
This lookup understands 'host patterns' as used bye the `hosts:` keyword in plays and can return a list of matching hosts from inventory
- name: show all the hosts matching the pattern, ie all but the group www debug: msg: "{{ item }}" with_inventory_hostnames: - all:!www
_hostnames: description: list of hostnames that matched the host pattern in inventory type: list