ansible / ansible.builtin / v2.9.25 / 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.9.25) — lookup
pip
Install with pip install ansible==2.9.25
This lookup understands 'host patterns' as used by the `hosts:` keyword in plays and can return a list of matching hosts from inventory
- name: show all the hosts matching the pattern, i.e. 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