
    Vh                    V    d dl mZ dZdZdZd dlmZ d dlmZ d dl	m
Z
  G d d	e
      Zy
)    )annotationsa	  
    name: inventory_hostnames
    author:
      - Michael DeHaan
      - Steven Dossett (!UNKNOWN) <sdossett@panath.com>
    version_added: "1.3"
    short_description: list of inventory hosts matching a host pattern
    description:
      - "This lookup understands 'host patterns' as used by the C(hosts:) keyword in plays
        and can return a list of matching hosts from inventory"
    notes:
      - this is only worth for 'hostname patterns' it is easier to loop over the group/group_names variables otherwise.
z
- name: show all the hosts matching the pattern, i.e. all but the group www
  ansible.builtin.debug:
    msg: "{{ item }}"
  with_inventory_hostnames:
    - all:!www
zk
 _hostnames:
    description: list of hostnames that matched the host pattern in inventory
    type: list
)AnsibleError)InventoryManager)
LookupBasec                      e Zd ZddZy)LookupModuleNc                >   t        | j                  d      }|d   j                         D ]0  \  }}|j                  |       |D ]  }|j	                  ||        2 	 |j                  |      D cg c]  }|j                   c}S c c}w # t        $ r g cY S w xY w)NF)parsegroups)group)pattern)r   _loaderitems	add_groupadd_host	get_hostsnamer   )	selfterms	variableskwargsmanagerr   hostshosths	            Z/home/dcms/DCMS/lib/python3.12/site-packages/ansible/plugins/lookup/inventory_hostnames.pyrunzLookupModule.run*   s    "4<<u=%h/557 	4LE5e$ 4  U 34	4
	$+$5$5e$5$DEqAFFEEE 	I	s$   B 3B	B 	B BB)N)__name__
__module____qualname__r        r   r   r   )   s    
r"   r   N)
__future__r   DOCUMENTATIONEXAMPLESRETURNansible.errorsr   ansible.inventory.managerr   ansible.plugins.lookupr   r   r!   r"   r   <module>r*      s6    #
 ( 6 -: r"   