AnonSec Shell
Server IP : 85.193.89.191  /  Your IP : 18.191.174.159
Web Server : Apache
System : Linux 956367-cx40159.tmweb.ru 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64
User : bitrix ( 600)
PHP Version : 8.1.27
Disable Function : NONE
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python2.7/site-packages/ansible/plugins/inventory/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /lib/python2.7/site-packages/ansible/plugins/inventory/openstack.pyo
�
��\c@`s�ddlmZmZmZeZdZdZddlZddl	Z	ddl
mZddlm
Z
mZmZyCddlZejd�Zejd�Zejd	�ZeZWnek
r�eZnXd
e
eefd��YZdS(i(tabsolute_importtdivisiontprint_functions�
    name: openstack
    plugin_type: inventory
    author:
      - Marco Vito Moscaritolo <marco@agavee.com>
      - Jesse Keating <jesse.keating@rackspace.com>
    short_description: OpenStack inventory source
    requirements:
        - openstacksdk
    extends_documentation_fragment:
        - inventory_cache
        - constructed
    description:
        - Get inventory hosts from OpenStack clouds
        - Uses openstack.(yml|yaml) YAML configuration file to configure the inventory plugin
        - Uses standard clouds.yaml YAML configuration file to configure cloud credentials
    options:
        plugin:
            description: token that ensures this is a source file for the 'openstack' plugin.
            required: True
            choices: ['openstack']
        show_all:
            description: toggles showing all vms vs only those with a working IP
            type: bool
            default: 'no'
        inventory_hostname:
            description: |
                What to register as the inventory hostname.
                If set to 'uuid' the uuid of the server will be used and a
                group will be created for the server name.
                If set to 'name' the name of the server will be used unless
                there are more than one server with the same name in which
                case the 'uuid' logic will be used.
                Default is to do 'name', which is the opposite of the old
                openstack.py inventory script's option use_hostnames)
            type: string
            choices:
                - name
                - uuid
            default: "name"
        expand_hostvars:
            description: |
                Run extra commands on each host to fill in additional
                information about the host. May interrogate cinder and
                neutron and can be expensive for people with many hosts.
                (Note, the default value of this is opposite from the default
                old openstack.py inventory script's option expand_hostvars)
            type: bool
            default: 'no'
        private:
            description: |
                Use the private interface of each server, if it has one, as
                the host's IP in the inventory. This can be useful if you are
                running ansible inside a server in the cloud and would rather
                communicate to your servers over the private network.
            type: bool
            default: 'no'
        only_clouds:
            description: |
                List of clouds from clouds.yaml to use, instead of using
                the whole list.
            type: list
            default: []
        fail_on_errors:
            description: |
                Causes the inventory to fail and return no hosts if one cloud
                has failed (for example, bad credentials or being offline).
                When set to False, the inventory will return as many hosts as
                it can from as many clouds as it can contact. (Note, the
                default value of this is opposite from the old openstack.py
                inventory script's option fail_on_errors)
            type: bool
            default: 'no'
        clouds_yaml_path:
            description: |
                Override path to clouds.yaml file. If this value is given it
                will be searched first. The default path for the
                ansible inventory adds /etc/ansible/openstack.yaml and
                /etc/ansible/openstack.yml to the regular locations documented
                at https://docs.openstack.org/os-client-config/latest/user/configuration.html#config-files
            type: string
        compose:
            description: Create vars from jinja2 expressions.
            type: dictionary
            default: {}
        groups:
            description: Add hosts to group based on Jinja2 conditionals.
            type: dictionary
            default: {}
s�
# file must be named openstack.yaml or openstack.yml
# Make the plugin behave like the default behavior of the old script
plugin: openstack
expand_hostvars: yes
fail_on_errors: yes
N(tAnsibleParserError(tBaseInventoryPlugint
Constructablet	Cacheablet	openstacksopenstack.cloud.inventorysopenstack.config.loadertInventoryModulecB`sSeZdZdZed�Zd�Zd�Zed�Ze	d�Z
d�ZRS(s= Host inventory provider for ansible using OpenStack clouds. Rc	C`s�tt|�j|||�|j|�}|j|�|_d}|jsUd}nod|jkr�|jd|jkr�d|jd}n6d|jkr�d|jkr�d}nts�d}n|r�t|��nd|jkr�i|_n|r|j	d�}nd}|rEy|jj|�}WqEt
k
rAqEXn|s�|jjd	�}|rs|tj}	nd}	tjd
tj�tjd|	d|jjdt��}
|jjd
g�}|r�t|t�r�td��n|r8g}x0|
jD]%}
|
j|kr|j|
�qqW||
_n|jjdt�}|jjdt�}|
jd|d|�}|jdk	r�|jj||�q�n|j|�dS(Nts&File empty. this is not my config filetplugins&plugin config file, but not for us: %stcloudss6it's not a plugin configuration nor a clouds.yaml filesiopenstacksdk is required for the OpenStack inventory plugin. OpenStack inventory sources will be skipped.tcachetclouds_yaml_pathtstreamtconfig_filestprivatetonly_cloudss<OpenStack Inventory Config Error: only_clouds must be a listtexpand_hostvarstfail_on_errorstexpandtfail_on_cloud_config( tsuperRtparset_get_cache_prefixt_read_config_datat_config_datatNAMEtHAS_SDKRt
get_optiontNoneRtgettKeyErrort
client_configtCONFIG_FILEStsdktenable_loggingtsyststderrt
sdk_inventorytOpenStackInventorytFalset
isinstancetlistt
ValueErrorRtnametappendt
list_hoststsett_populate_from_source(tselft	inventorytloadertpathRt	cache_keytmsgtsource_dataR
Rtcloud_inventoryRt
new_cloudstcloudRR((sG/usr/lib/python2.7/site-packages/ansible/plugins/inventory/openstack.pyR�sf		%		

		cC`s�tjt�}tjt�}i}|jjdd�dk}|jjdt�}x<|D]4}d|krz|rzq[n||dj|�q[Wx�|j�D]�\}}	t|	�dkr�|r�|j	||||	d�q�t
�}
x|	D]}|
j|d�q�Wt|
�dkrC|rC|j	||||	d�q�x.|	D]&}|j	|||d|dt�qJWq�W|j
||�dS(	Ntinventory_hostnameR-tshow_alltinterface_ipiitidt	namegroup(tcollectionstdefaultdictR+RRR)R.titemstlent_append_hostvarsR0taddtTruet_set_variables(R2R8tgroupst	firstpassthostvarst
use_server_idR=tserverR-tserverst
server_ids((sG/usr/lib/python2.7/site-packages/ansible/plugins/inventory/openstack.pyR1�s,
	

cC`s�x|D]w}|j|jjd�||�x0||D]$}|jj|||||�q7W|j|jjd�||�qWxN|j�D]@\}}|jj|�x!|D]}|jj||�q�Wq�WdS(NtcomposeRI(	t_set_composite_varsRRR3tset_variablet_add_host_to_composed_groupsRCt	add_groupt	add_child(R2RKRIthosttkeyt
group_nametgroup_hosts((sG/usr/lib/python2.7/site-packages/ansible/plugins/inventory/openstack.pyRH�s
"
cC`s�g}|d}|d}|jdi�}|j|�|rO|j|�n|jd||f�d|kr�|j|d�nx?|jdd�jd�D]"}|r�|j|j��q�q�W|jd	|d
�|r�|j|d�nx@dD]8}d||kr�|jd|||df�q�q�Wx7t|j��D]#\}}	|jd||	f�qMW|jdd�}
|
r�|j|
�|jd||
f�|jd|||
f�n|S(NtregionR;tmetadatas%s_%stgroupRIR	t,sinstance-%sR?R-tflavortimages%s-%ss
meta-%s_%stazs%s_%s_%s(R^R_(RR.tsplittstriptiterRCR(R2tserver_varsR@RIRZR;R[textra_groupRWtvalueR`((sG/usr/lib/python2.7/site-packages/ansible/plugins/inventory/openstack.pyt_get_groups_from_servers6


"
&
cC`sltd|dd|dd|�||<|jj|�x.|j|d|�D]}||j|�qMWdS(Ntansible_ssh_hostR>tansible_hostRR@(tdictR3tadd_hostRgR.(R2RKRItcurrent_hostRMR@R\((sG/usr/lib/python2.7/site-packages/ansible/plugins/inventory/openstack.pyRE1s


cC`sltt|�j|�rhxMdD]B}x9d	D]1}djd|d|�}|j|�r,tSq,WqWntS(
NRRtyamltymls
{fn}.{suffix}tfntsuffix(s	openstacksclouds(RmRn(RRtverify_filetformattendswithRGR)(R2R5RoRptmaybe((sG/usr/lib/python2.7/site-packages/ansible/plugins/inventory/openstack.pyRq<s

(t__name__t
__module__t__doc__RRGRR1RHRgR)RERq(((sG/usr/lib/python2.7/site-packages/ansible/plugins/inventory/openstack.pyRsK	 	-
(t
__future__RRRttypet
__metaclass__t
DOCUMENTATIONtEXAMPLESRAR%tansible.errorsRtansible.plugins.inventoryRRRt	importlibt
import_moduleR#R'R!RGRtImportErrorR)R(((sG/usr/lib/python2.7/site-packages/ansible/plugins/inventory/openstack.pyt<module>s [




Anon7 - 2022
AnonSec Team