Server IP : 85.193.89.191 / Your IP : 3.133.131.251 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 : |
� � �\c @` s� d d l m Z m Z m Z e Z d Z d Z d d l Z d d l Z d d l m Z m Z m Z d d l m Z d d l m Z m Z d d l m Z m Z d d l m Z d e f d � � YZ d S( i ( t absolute_importt divisiont print_functions< inventory: ini version_added: "2.4" short_description: Uses an Ansible INI file as inventory source. description: - INI file based inventory, sections are groups or group related with special `:modifiers`. - Entries in sections C([group_1]) are hosts, members of the group. - Hosts can have variables defined inline as key/value pairs separated by C(=). - The C(children) modifier indicates that the section contains groups. - The C(vars) modifier indicates that the section contains variables assigned to members of the group. - Anything found outside a section is considered an 'ungrouped' host. - Values passed in using the C(key=value) syntax are interpreted as Python literal structure (strings, numbers, tuples, lists, dicts, booleans, None), alternatively as string. For example C(var=FALSE) would create a string equal to 'FALSE'. Do not rely on types set during definition, always make sure you specify type with a filter when needed when consuming the variable. notes: - It takes the place of the previously hardcoded INI inventory. - To function it requires being whitelisted in configuration. - Variable values are processed by Python's ast.literal_eval function (U(https://docs.python.org/2/library/ast.html#ast.literal_eval)) which could cause the value to change in some cases. See the Examples for proper quoting to prevent changes. Another option would be to use the yaml format for inventory source which processes the values correctly. s3 example1: | # example cfg file [web] host1 host2 ansible_port=222 [web:vars] http_port=8080 # all members of 'web' will inherit these myvar=23 [web:children] # child groups will automatically add their hosts to partent group apache nginx [apache] tomcat1 tomcat2 myvar=34 # host specific vars override group vars tomcat3 mysecret="'03#pa33w0rd'" # proper quoting to prevent value changes [nginx] jenkins1 [nginx:vars] has_java = True # vars in child groups override same in parent [all:vars] has_java = False # 'all' is 'top' parent example2: | # other example config host1 # this is 'ungrouped' # both hosts have same IP but diff ports, also 'ungrouped' host2 ansible_host=127.0.0.1 ansible_port=44 host3 ansible_host=127.0.0.1 ansible_port=45 [g1] host4 [g2] host4 # same host as above, but member of 2 groups, will inherit vars from both # inventory hostnames are unique N( t BaseFileInventoryPlugint detect_ranget expand_hostname_range( t parse_address( t AnsibleErrort AnsibleParserError( t to_bytest to_text( t shlex_splitt InventoryModulec B` s� e Z d Z d Z e d � Z e d � Z d � Z e d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z e d � � Z d � Z RS( s� Takes an INI-format inventory file and builds a list of groups and subgroups with their associated hosts and variable settings. t iniu ;u #t ;t #c C` s) t t | � j � i | _ d | _ d S( N( t superR t __init__t patternst Nonet _filename( t self( ( sA /usr/lib/python2.7/site-packages/ansible/plugins/inventory/ini.pyR ] s c C` sH t t | � j | | | � | | _ y� | j rL | j j | � \ } } n6 t | d d �} t | d � � } | j � } Wd QXy t | d d �j � } Wnp t k rg } xZ | j � D]H } | r� | d | j k r� | j d � q� | j t | d d �� q� Wn X| j | | � Wn t k rC} t | � � n Xd S( Nt errorst surrogate_or_strictt rbi u ( R R t parseR t loadert _get_file_contentsR t opent readR t splitlinest UnicodeErrort b_COMMENT_MARKERSt appendt _parset ExceptionR ( R t inventoryR t patht cachet b_datat privatet b_patht fht datat linet e( ( sA /usr/lib/python2.7/site-packages/ansible/plugins/inventory/ini.pyR d s&