
    VhVr                       d dl mZ dZdZd dlZd dlZd dlmZ d dlm	Z	 d dl
mZmZmZ d dlmZ d d	lmZ d d
lmZ d dlmZ d dlmZ 	 d dlZ eej2                         ed      k  redZ e       Z G d deee      Zy# e$ r dZY w xY w)    )annotationsa  
    name: proxmox
    short_description: Proxmox inventory source
    author:
        - Jeffrey van Pelt (@Thulium-Drake) <jeff@vanpelt.one>
    requirements:
        - requests >= 1.1
    description:
        - Get inventory hosts from a Proxmox PVE cluster.
        - "Uses a configuration file as an inventory source, it must end in C(.proxmox.yml) or C(.proxmox.yaml)"
        - Will retrieve the first network interface with an IP for Proxmox nodes.
        - Can retrieve LXC/QEMU configuration as facts.
    extends_documentation_fragment:
        - constructed
        - inventory_cache
    options:
      plugin:
        description: The name of this plugin, it should always be set to V(community.proxmox.proxmox) for this plugin to recognize it as its own.
        required: true
        choices: ['community.proxmox.proxmox']
        type: str
      url:
        description:
          - URL to Proxmox cluster.
          - If the value is not specified in the inventory configuration, the value of environment variable E(PROXMOX_URL) will be used instead.
          - You can use templating to specify the value of the O(url).
        default: 'http://localhost:8006'
        type: str
        env:
          - name: PROXMOX_URL
      user:
        description:
          - Proxmox authentication user.
          - If the value is not specified in the inventory configuration, the value of environment variable E(PROXMOX_USER) will be used instead.
          - You can use templating to specify the value of the O(user).
        required: true
        type: str
        env:
          - name: PROXMOX_USER
      password:
        description:
          - Proxmox authentication password.
          - If the value is not specified in the inventory configuration, the value of environment variable E(PROXMOX_PASSWORD) will be used instead.
          - You can use templating to specify the value of the O(password).
          - If you do not specify a password, you must set O(token_id) and O(token_secret) instead.
        type: str
        env:
          - name: PROXMOX_PASSWORD
      token_id:
        description:
          - Proxmox authentication token ID.
          - If the value is not specified in the inventory configuration, the value of environment variable E(PROXMOX_TOKEN_ID) will be used instead.
          - To use token authentication, you must also specify O(token_secret). If you do not specify O(token_id) and O(token_secret),
            you must set a password instead.
          - Make sure to grant explicit pve permissions to the token or disable 'privilege separation' to use the users' privileges instead.
        type: str
        env:
          - name: PROXMOX_TOKEN_ID
      token_secret:
        description:
          - Proxmox authentication token secret.
          - If the value is not specified in the inventory configuration, the value of environment variable E(PROXMOX_TOKEN_SECRET) will be used instead.
          - To use token authentication, you must also specify O(token_id). If you do not specify O(token_id) and O(token_secret),
            you must set a password instead.
        type: str
        env:
          - name: PROXMOX_TOKEN_SECRET
      validate_certs:
        description: Verify SSL certificate if using HTTPS.
        type: boolean
        default: true
      group_prefix:
        description: Prefix to apply to Proxmox groups.
        default: proxmox_
        type: str
      facts_prefix:
        description: Prefix to apply to LXC/QEMU config facts.
        default: proxmox_
        type: str
      want_facts:
        description:
          - Gather LXC/QEMU configuration facts.
          - When O(want_facts) is set to V(true) more details about QEMU VM status are possible, besides the running and stopped states.
            Currently if the VM is running and it is suspended, the status will be running and the machine will be in C(running) group,
            but its actual state will be paused. See O(qemu_extended_statuses) for how to retrieve the real status.
        default: false
        type: bool
      qemu_extended_statuses:
        description:
          - Requires O(want_facts) to be set to V(true) to function. This will allow you to differentiate between C(paused) and C(prelaunch)
            statuses of the QEMU VMs.
          - This introduces multiple groups [prefixed with O(group_prefix)] C(prelaunch) and C(paused).
        default: false
        type: bool
      want_proxmox_nodes_ansible_host:
        description:
          - Whether to set C(ansible_host) for proxmox nodes.
          - When set to V(true) (default), will use the first available interface. This can be different from what you expect.
        type: bool
        default: false
      exclude_nodes:
        description: Exclude proxmox nodes and the nodes-group from the inventory output.
        type: bool
        default: false
      filters:
        description: A list of Jinja templates that allow filtering hosts.
        type: list
        elements: str
        default: []
ao  
---
# Minimal example which will not gather additional facts for QEMU/LXC guests
# By not specifying a URL the plugin will attempt to connect to the controller host on port 8006
# my.proxmox.yml
plugin: community.proxmox.proxmox
user: ansible@pve
password: secure
# Note that this can easily give you wrong values as ansible_host. See further below for
# an example where this is set to `false` and where ansible_host is set with `compose`.
want_proxmox_nodes_ansible_host: true

---
# Instead of login with password, proxmox supports api token authentication since release 6.2.
plugin: community.proxmox.proxmox
user: ci@pve
token_id: gitlab-1
token_secret: fa256e9c-26ab-41ec-82da-707a2c079829

# The secret can also be a vault string or passed via the environment variable TOKEN_SECRET.
token_secret: !vault |
          $ANSIBLE_VAULT;1.1;AES256
          62353634333163633336343265623632626339313032653563653165313262343931643431656138
          6134333736323265656466646539663134306166666237630a653363623262636663333762316136
          34616361326263383766366663393837626437316462313332663736623066656237386531663731
          3037646432383064630a663165303564623338666131353366373630656661333437393937343331
          32643131386134396336623736393634373936356332623632306561356361323737313663633633
          6231313333666361656537343562333337323030623732323833

---
# More complete example demonstrating the use of 'want_facts' and the constructed options
# Note that using facts returned by 'want_facts' in constructed options requires 'want_facts=true'
# my.proxmox.yml
plugin: community.proxmox.proxmox
url: http://pve.domain.com:8006
user: ansible@pve
password: secure
want_facts: true
keyed_groups:
    # proxmox_tags_parsed is an example of a fact only returned when 'want_facts=true'
  - key: proxmox_tags_parsed
    separator: ""
    prefix: group
groups:
  webservers: "'web' in (proxmox_tags_parsed|list)"
  mailservers: "'mail' in (proxmox_tags_parsed|list)"
compose:
  ansible_port: 2222
# Note that this can easily give you wrong values as ansible_host. See further below for
# an example where this is set to `false` and where ansible_host is set with `compose`.
want_proxmox_nodes_ansible_host: true

---
# Using the inventory to allow ansible to connect via the first IP address of the VM / Container
# (Default is connection by name of QEMU/LXC guests)
# Note: my_inv_var demonstrates how to add a string variable to every host used by the inventory.
# my.proxmox.yml
plugin: community.proxmox.proxmox
url: http://192.168.1.2:8006
user: ansible@pve
password: secure
validate_certs: false  # only do this when you trust the network!
want_facts: true
want_proxmox_nodes_ansible_host: false
compose:
  ansible_host: proxmox_ipconfig0.ip | default(proxmox_net0.ip) | ipaddr('address')
  my_inv_var_1: "'my_var1_value'"
  my_inv_var_2: >
    "my_var_2_value"

---
# Specify the url, user and password using templating
# my.proxmox.yml
plugin: community.proxmox.proxmox
url: "{{ lookup('ansible.builtin.ini', 'url', section='proxmox', file='file.ini') }}"
user: "{{ lookup('ansible.builtin.env','PM_USER') | default('ansible@pve') }}"
password: "{{ lookup('community.proxmox.random_string', base64=True) }}"
# Note that this can easily give you wrong values as ansible_host. See further up for
# an example where this is set to `false` and where ansible_host is set with `compose`.
want_proxmox_nodes_ansible_host: true

N)MutableMapping)AnsibleError)BaseInventoryPluginConstructable	Cacheable)string_types)	urlencode)Display)LooseVersion)make_unsafez1.1.0TFc                       e Zd ZdZdZ fdZ fdZd Zd ZddZ	d Z
d	 Zd
 Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd fd	Z xZS )InventoryModulez< Host inventory parser for ansible using Proxmox as source. zcommunity.proxmox.proxmoxc                b    t         t        |           d | _        d | _        d | _        d | _        y N)superr   __init__proxmox_urlsession	cache_key	use_cache)self	__class__s    o/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/community/proxmox/plugins/inventory/proxmox.pyr   zInventoryModule.__init__   s/    ot-/      c                    d}t         t        |   |      r0|j                  d      rd}|S | j                  j                  d       |S )NF)zproxmox.yamlzproxmox.ymlTzOSkipping due to inventory source not ending in "proxmox.yaml" nor "proxmox.yml")r   r   verify_fileendswithdisplayvvv)r   pathvalidr   s      r   r   zInventoryModule.verify_file   sJ    $3D9}}<=    !rsr   c                    | j                   s9t        j                          | _         | j                  d      | j                   _        | j                   S )Nvalidate_certs)r   requests
get_optionverifyr   s    r   _get_sessionzInventoryModule._get_session   s9    ||#++-DL"&//2B"CDLL||r   c                   | j                  d      }|du rddlm}  |        | j                  rut	        | j
                  | j                  d      }| j                         }|j                  | j                   d|      }|j                         }dd	|d
   d    i| _
        y | j
                  j                         }| j                  j                         }| j                  j                         }	| d| d|	 }
dd|
 i| _
        y )Nr$   Fr   )disable_warnings)usernamepasswordz/api2/json/access/ticket)dataCookiezPVEAuthCookie=r.   ticket!=AuthorizationzPVEAPIToken=)r&   requests.packages.urllib3r+   proxmox_passwordr
   proxmox_userr)   postr   jsonheadersstripproxmox_token_idproxmox_token_secret)r   r$   r+   credentialsaretr8   usertoken_idtoken_secrettokens              r   	_get_authzInventoryModule._get_auth  s   )9:U"B  #1B1BPTPePe$fgK!!#A&&D,,--EF[&YC88:D N4<+A*BCDL $$**,D,,224H44::<L fAhZq7E ,|E7-CDDLr   c                   g }d}| j                   r	 | j                  | j                     |   }d}|s| j                         }	 |j                  || j                        }|r|j                  |v rnN|j                          |j                         }d|vr|}n't        |d   t              r|d   }n|d   r||d   z   }	 || j                  |<   t        |      S # t        $ r
 d| _        Y w xY w)NFT)r9   r.   )r   _cacher   KeyErrorupdate_cacher)   getr9   status_coderaise_for_statusr8   
isinstancer   _resultsr   )r   urlignore_errorsr.   has_datasr?   r8   s           r   	_get_jsonzInventoryModule._get_json"  s    >>){{4>>237 !!#AeeCe6 S__%E$$&xxz
 %DVn=<DF|#d6l2!c4  =  )$(!)s   C C,+C,c                >    | j                  | j                   d      S )Nz/api2/json/nodesrR   r   r(   s    r   
_get_nodeszInventoryModule._get_nodesK       ~~!1!1 22BCDDr   c                >    | j                  | j                   d      S )Nz/api2/json/poolsrT   r(   s    r   
_get_poolszInventoryModule._get_poolsN  rV   r   c                D    | j                  | j                   d| d      S )N/api2/json/nodes/z/lxcrT   r   nodes     r   _get_lxc_per_nodez!InventoryModule._get_lxc_per_nodeQ  s&    ~~!1!1 22CD6NOOr   c                D    | j                  | j                   d| d      S )NrZ   z/qemurT   r[   s     r   _get_qemu_per_nodez"InventoryModule._get_qemu_per_nodeT  s&    ~~!1!1 22CD6OPPr   c                L    | j                  | j                   d|       }|d   S )Nz/api2/json/pools/membersrT   )r   poolr?   s      r   _get_members_per_poolz%InventoryModule._get_members_per_poolW  s-    nn 0 011B4&IJ9~r   c           
        | j                  | j                   d| d      }|j                  d        |D ]  }	 d|vr&| j                  j	                  d|d    d| d	       .d
|vr&| j                  j	                  d|d    d| d       Xd|vr&| j                  j	                  d|d    d| d       | j                  j                  d|d    d| d|d
    d       |d
   c S  y # t        $ r Y w xY w)NrZ   z/networkc                    | d   S )Niface )xs    r   <lambda>z.InventoryModule._get_node_ip.<locals>.<lambda>_  s
    qz r   )keyactivez
Interface rf   z	 on node z does not have an active stateaddressz does not have an addressgatewayz does not have a gatewayzUsing interface z with address z as node ip for ansible_host)rR   r   sortr   r    vv	Exception)r   r\   r?   rf   s       r   _get_node_ipzInventoryModule._get_node_ip[  sC   nn 0 011B4&QR 	)* 	E5(LL$$z%.1A4&Pn%opE)LL$$z%.1A4&Pi%jkE)LL$$z%.1A4&Ph%ij"25>2B)D6Q_`efo`p_q  rN  !O  PY''	    s#   )C-%)C-)C-9/C--	C98C9c                6   | j                  d      }||vs||   dk(  sy | j                  | j                   d| d| ddg      }|sy g }|D ]6  }|d   |d	   d
}d|v r|d   |d<   d|v r|d   |d<   |j                  |       8 ||| j                  d      <   y )NstatusrunningrZ   z/lxc/z/interfacesi  )rO   namehwaddr)ru   rv   inetinet6lxc_interfaces)_factrR   r   append)	r   
propertiesr\   vmid
status_keyr?   resultrf   result_ifaces	            r   _get_lxc_interfacesz#InventoryModule._get_lxc_interfacess  s    ZZ)
Z'z*/E/Rnn 0 011B4&dVS^_psotnu 	(Ef/L
 ',V}V$%(-gW%MM,'	( 4:
4::./0r   c                   g }	 | j                  | j                   d| d| d| d      d   }d|v rQd|d   v rH|d   d   }|dv r| j                  j                  d       |S |d	v r| j                  j                  d
       |S |D ]E  }|j	                  |d   d|v r|d   ndd|v r|d   D cg c]  }|d    d|d     c}ng d       G 	 |S c c}w # t
        j                  $ r Y |S w xY w)NrZ   /z/agent/network-get-interfacesr   errorclass)UnsupportedzhRetrieving network interfaces from guest agents on windows with older qemu-guest-agents is not supported)CommandDisabledzARetrieving network interfaces from guest agents has been disabledru   zhardware-address ip-addressesz
ip-addressprefix)ru   zmac-addressr   )rR   r   r   vr{   r%   	HTTPError)	r   r\   r}   vmtyper   ifaces
errorClassrf   ips	            r   _get_agent_network_interfacesz-InventoryModule._get_agent_network_interfaces  sZ   	^^##$$5dV1VHAdVKhiF & fWo- "(!9J!_4  (R  S  $'::'jk !&M@RV[@[5);#<acn|  AF  oFTYZhTi$jb<(8'92h<.%I$j  LN   %k!! 		s0   AC " C )C ,C C C C,+C,c           
     h   | j                  | j                   d| d| d| d      }||| j                  d      <   ||| j                  d      <   ||| j                  d      <   dg}|D ]y  }| j                  |      }	||   }
	 |dk(  s|j                  d	      rd
|
 }
|dk(  rW|
j	                         }|rE|	 d}|j                  dd      j                  d      D cg c]  }|j	                          c}||<   |dk(  rPd}	 t        |
j                  d      d         }|r.| j                  |||      }|r| j                  |	 d      }|||<   |dk(  r2i }|
D ])  \  }}|j                  d      r|t        d      d  }|||<   + |}
||vrSt        |
t              rCt        d |
j                  d      D              r"	 t        d |
j                  d      D              }
|
||	<   | y c c}w # t        $ r |
j                  d      d   dk(  rd}Y w xY w# t         $ r Y w xY w# t"        $ r Y  y w xY w)NrZ   r   z/configr\   r}   r   descriptionrootfs)virtiosataidescsizdisk_image=tags_parsed,;agentr   z	enabled=1   _interfaceslxczlxc.c              3  $   K   | ]  }d |v  
 yw)r2   Nrg   ).0r   s     r   	<genexpr>z1InventoryModule._get_vm_config.<locals>.<genexpr>  s     CQqCs   c              3  @   K   | ]  }|j                  d d        yw)r2   r   N)split)r   rj   s     r   r   z1InventoryModule._get_vm_config.<locals>.<genexpr>  s     $S3SYYsA%6$Ss   )rR   r   rz   
startswithr:   replacer   int
ValueErrorr   to_safelenrL   r	   alldictrp   	NameError)r   r|   r\   r}   r   ru   r?   plaintext_configsconfigrj   valuestripped_value
parsed_keytagagent_enabledagent_iface_valueagent_iface_keyout_valkr   s                       r   _get_vm_configzInventoryModule._get_vm_config  s   nn 0 011B4&&QRSWRXX_`a)-
4::f%&)-
4::f%&+1
4::h'( 
  2	F**V$CKE/X%):):;\)])%1E V#%*[[]N%(+uG_
IWI_I_`cehIiIoIopsIt1u##))+1u
:.
 W$$%M.(+EKK,<Q,?(@ %,0,N,NtUY[a,b),.2llcU+;N.OO:KJ7U? G % '1<</ !#f+,A%&
' $E!22z%7VC%++c2BCC! $$S%++cBR$S S #(
3a2	 2v & . ;;s+A.+=,-M.. % ! !  sn   AH$G'5H$G, BH$=!HH$'H$,"HH$HH$	H!H$ H!!H$$	H10H1c           
         | j                  | j                   d| d| d| d      }|d   || j                  d      <   |dk(  r|d   || j                  d      <   y y )NrZ   r   z/status/currentrs   qemu	qmpstatusrR   r   rz   )r   r|   r\   r}   r   ru   r?   s          r   _get_vm_statuszInventoryModule._get_vm_status  sq    nn 0 011B4&&QRSWRXXghi+.x=
4::h'(V25k2BJtzz+./ r   c           
         | j                  | j                   d| d| d| d      }|D cg c]  }|d   dk7  s|d    }}||| j                  d      <   y c c}w )NrZ   r   z	/snapshotru   current	snapshotsr   )	r   r|   r\   r}   r   ru   r?   snapshotr   s	            r   _get_vm_snapshotsz!InventoryModule._get_vm_snapshots  ss    nn 0 011B4&&QRSWRXXabc69[(Xf=MQZ=ZXf%[	[.7
4::k*+ \s
   AAc                T    d}t        j                  |d|j                  dd            S )zConverts 'bad' characters in a string to underscores so they can be used as Ansible groups
        #> ProxmoxInventory.to_safe("foo-bar baz")
        'foo_barbaz'
        z[^A-Za-z0-9\_]_ r   )resubr   )r   wordregexs      r   r   zInventoryModule.to_safe  s'    
 "vveS$,,sB"788r   c                \    | j                  | j                   |j                                S )z>Generate a fact's full name from the common prefix and a name.)r   facts_prefixlowerr   ru   s     r   rz   zInventoryModule._fact  '    ||t001$**,@AAr   c                \    | j                  | j                   |j                                S )z?Generate a group's full name from the common prefix and a name.)r   group_prefixr   r   s     r   _groupzInventoryModule._group  r   r   c                    | j                   D ]  }	 | j                  ||      s y y# t        $ rA}d| d| d| }| j                  rt	        |      t
        j                  |       Y d}~`d}~ww xY w)zEnsure that a host satisfies all defined hosts filters. If strict mode is
        enabled, any error during host filter compositing will lead to an AnsibleError
        being raised, otherwise the filter will be ignored.
        FzCould not evaluate host filter z
 for host z - NT)host_filters_composerp   strictr   r   warning)r   ru   r|   host_filteremessages         r   _can_add_hostzInventoryModule._can_add_host  s    
  ,, 	)K)}}[*=  >	)   );K=
SWRXX[\][^_;;&w//((	)s   (	A27A--A2c                
   | j                   j                  |       |j                         D ]"  \  }}| j                   j                  |||       $ | j                   j	                  |      j                         }| j                  | j                  d      ||| j                         | j                  | j                  d      ||| j                         | j                  | j                  d      ||| j                         y )Ncomposer   groupskeyed_groups)	inventoryadd_hostitemsset_variableget_hostget_vars_set_composite_varsr&   r   _add_host_to_composed_groups_add_host_to_keyed_groups)r   ru   	variablesr   r   s        r   	_add_hostzInventoryModule._add_host  s    %OO% 	4DAqNN''a3	4NN++D1::<	  !;YUYU`U` a))$//(*CYPT]a]h]h)i&&t~'F	SW`d`k`k&lr   c                   |j                  d      ryt               }|d   |d   }}| j                  d      }|rW| j                  |||||       | j	                  |||||       | j                  |||||       |dk(  r| j                  |||       | j                  ||      sy| j                  ||       | j                  | d|       }| j                  j                  | j                  d|       |       | j                  j                  ||       |d	   }	|	d
k(  r9|r7|dk(  r2| j                  d      r!|j                  | j                  d      |	      }	| j                  j                  | j                  d|	       |       |S )zHandle an item from the list of LXC containers and Qemu VM. The
        return value will be either None if the item was skipped or the name of
        the item if it was added to the inventory.templateNru   r}   
want_factsr   r   all_rs   rt   r   qemu_extended_statusesr   )rI   r   r&   r   r   r   r   r   r   r   r   	add_childrz   )
r   r\   ittypeitemr|   ru   r}   r   node_type_groupitem_statuss
             r   _handle_itemzInventoryModule._handle_item   sw    88JV
&\4<d __\2

D$E
D$E"":tT64H((T4@ !!$
3 	tZ(++ax&89  tF8_!=tD  $78n)#f.4??C[3\(nnTZZ-DkR  tK=-A!BDIr   c                J   | j                         D ]  }|j                  d      }|s| j                  d|       }| j                  j	                  |       | j                  |      D ]7  }|j                  d      }|s||v s| j                  j                  ||       9  y)zcGenerate groups from Proxmox resource pools, ignoring VMs and
        containers that were skipped.poolidpool_ru   N)rX   rI   r   r   	add_grouprc   r   )r   added_hostsrb   r   
pool_groupmemberru   s          r   _populate_pool_groupsz%InventoryModule._populate_pool_groupsG  s     OO% 
	?DXXh'FuVH%56JNN$$Z044V< ?zz&)DK/NN,,Z>?
	?r   c                   g d}| j                  d      r|j                  ddg       |D ]/  }| j                  j                  | j	                  d|              1 | j	                  d      }| j
                  s| j                  j                  |       | j                  d      }| j                          g }| j                         D ]  }|j                  d      s| j
                  s| j                  j                  |d          |d	   dk(  r+| j
                  s| j                  j                  ||d          |d
   dk(  r||r@| j
                  s4| j                  |d         }| j                  j                  |d   d|       | j
                  s]| j                  j                  |d         j                         }| j                  | j                  d      ||d   | j                          dD ]6  }	| j	                  |d    d|	       }
| j                  j                  |
       8 t#        t%        j&                  d      | j)                  |d               }t#        t%        j&                  d      | j+                  |d               }t%        j,                  ||      D ]/  \  }	}| j/                  |d   |	|      }||j1                  |       1  | j3                  |       y )N)r   r   rt   stoppedr   	prelaunchpausedr   nodeswant_proxmox_nodes_ansible_hostr\   typers   offlineansible_hostr   r   )r   r   r   r   r   )r&   extendr   r   r   exclude_nodesrD   rU   rI   r   r   rq   r   r   r   r   r   zip	itertoolsrepeatr]   r_   chainr   r{   r   )r   default_groupsgroupnodes_groupr  hostsr\   r   r   r   r   lxc_objectsqemu_objectsr   ru   s                  r   	_populatezInventoryModule._populateV  s    ???34!!;"9:# 	BENN$$T[[4w%@A	Bkk'*!!NN$$[1*.//:[*\' 	OO%  	'D88F#%%''V5F|v%d.@.@((d6lCH~* /t7I7I&&tF|4++DL."M %% NN33DLAJJL	(()CYPTU[P\eiepep(q * :"&++fax.H"I((9:
 i..u5t7M7MdSYl7[\Ky//79P9PQUV\Q]9^_L )\ J '((fvtD#LL&'; 	'F 	""5)r   c                ,   t         st        d      t        t        |   |||       | j                  |       dD ][  }| j                  |      }| j                  j                  |      r| j                  j                  |d      }t        | d| |       ] | j                  j                  d      | _        | j                  #| j                  | j                  t        d      | j                  d      r| j                  d	      st        d
      | j                  d      | _        | j#                  |      | _        |xr | j                  d      | _        | xr | j                  d      | _        | j                  d      | _        | j                  d      | _        | j                  d      | _        | j                  d      | _        i | _        | j5                          | j(                  r$| j2                  | j6                  | j$                  <   y y )NzVThis module requires Python Requests 1.1.0 or higher: https://github.com/psf/requests.)rN   r@   r-   rA   rB   F)disable_lookupsproxmox_r   zEYou must specify either a password or both token_id and token_secret.r   r   zJYou must set want_facts to True if you want to use qemu_extended_statuses.r
  cachefiltersr   r   r   )HAS_REQUESTSr   r   r   parse_read_config_datar&   templaris_templater   setattrr   rstripr5   r;   r<   r
  get_cache_keyr   r   rH   r   r   r   r   rM   r  rF   )r   r   loaderr!   r  or   r   s          r   r  zInventoryModule.parse  s     B C C 	ot*9fdC 	t$ I 	-A"A||''*LL))!U)CDHQC.!,		-  ++2237  (d.C.C.KtOhOhOpfgg??34T__\=Zkll!___=++D1;4??7#; %IB$//'*B OOI6 OON; OON;ooh/ *.--DKK' r   r   )T)__name__
__module____qualname____doc__NAMEr   r   r)   rD   rR   rU   rX   r]   r_   rc   rq   r   r   r   r   r   r   rz   r   r   r   r   r   r  r  __classcell__)r   s   @r   r   r      s    F&D	E:'!REEPQ0:8<=~C8
9BB m%N?6*p'8 '8r   r   )
__future__r   DOCUMENTATIONEXAMPLESr  r   /ansible.module_utils.common._collections_compatr   ansible.errorsr   ansible.plugins.inventoryr   r   r   ansible.module_utils.sixr	   +ansible.module_utils.six.moves.urllib.parser
   ansible.utils.displayr   Bansible_collections.community.proxmox.plugins.module_utils.versionr   Aansible_collections.community.proxmox.plugins.plugin_utils.unsafer   r%   __version__ImportErrorr  r   r   rg   r   r   <module>r8     s    #m^Qf  	 J ' S S 1 A ) [ YH(()L,AAL )P8)=) P8  Ls   #B   B
	B
