??????????????
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 173
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 174
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 175
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 176
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 177
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 178
ó
àUdac @` 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
Z
d d l m Z d d l
m Z m Z m Z m Z m Z d d l m Z m Z d d l m Z m Z d d l m Z d d
l m Z y d d l m Z Wn! e k
r
d d l m Z n Xd e f d
„ ƒ YZ! d S( i ( t absolute_importt divisiont print_functionsÿ
name: tower
plugin_type: inventory
author:
- Matthew Jones (@matburt)
- Yunfan Zhang (@YunfanZhang42)
short_description: Ansible dynamic inventory plugin for Ansible Tower.
version_added: "2.7"
description:
- Reads inventories from Ansible Tower.
- Supports reading configuration from both YAML config file and environment variables.
- If reading from the YAML file, the file name must end with tower.(yml|yaml) or tower_inventory.(yml|yaml),
the path in the command would be /path/to/tower_inventory.(yml|yaml). If some arguments in the config file
are missing, this plugin will try to fill in missing arguments by reading from environment variables.
- If reading configurations from environment variables, the path in the command must be @tower_inventory.
options:
plugin:
description: the name of this plugin, it should always be set to 'tower'
for this plugin to recognize it as it's own.
env:
- name: ANSIBLE_INVENTORY_ENABLED
required: True
choices: ['tower']
host:
description: The network address of your Ansible Tower host.
type: string
env:
- name: TOWER_HOST
required: True
username:
description: The user that you plan to use to access inventories on Ansible Tower.
type: string
env:
- name: TOWER_USERNAME
required: True
password:
description: The password for your Ansible Tower user.
type: string
env:
- name: TOWER_PASSWORD
required: True
inventory_id:
description:
- The ID of the Ansible Tower inventory that you wish to import.
- This is allowed to be either the inventory primary key or its named URL slug.
- Primary key values will be accepted as strings or integers, and URL slugs must be strings.
- Named URL slugs follow the syntax of "inventory_name++organization_name".
type: raw
env:
- name: TOWER_INVENTORY
required: True
validate_certs:
description: Specify whether Ansible should verify the SSL certificate of Ansible Tower host.
type: bool
default: True
env:
- name: TOWER_VERIFY_SSL
required: False
aliases: [ verify_ssl ]
include_metadata:
description: Make extra requests to provide all group vars with metadata about the source Ansible Tower host.
type: bool
default: False
version_added: "2.8"
sA
# Before you execute the following commands, you should make sure this file is in your plugin path,
# and you enabled this plugin.
# Example for using tower_inventory.yml file
plugin: tower
host: your_ansible_tower_server_network_address
username: your_ansible_tower_username
password: your_ansible_tower_password
inventory_id: the_ID_of_targeted_ansible_tower_inventory
# Then you can run the following command.
# If some of the arguments are missing, Ansible will attempt to read them from environment variables.
# ansible-inventory -i /path/to/tower_inventory.yml --list
# Example for reading from environment variables:
# Set environment variables:
# export TOWER_HOST=YOUR_TOWER_HOST_ADDRESS
# export TOWER_USERNAME=YOUR_TOWER_USERNAME
# export TOWER_PASSWORD=YOUR_TOWER_PASSWORD
# export TOWER_INVENTORY=THE_ID_OF_TARGETED_INVENTORY
# Read the inventory specified in TOWER_INVENTORY from Ansible Tower, and list them.
# The inventory path must always be @tower_inventory if you are reading all settings from environment variables.
# ansible-inventory -i @tower_inventory --list
N( t six( t Requestt urllib_errort ConnectionErrort sockett httplib( t to_textt to_native( t AnsibleParserErrort AnsibleOptionsError( t BaseInventoryPlugin( t ensure_type( t urljoint InventoryModulec B` s2 e Z d Z e Z d „ Z d „ Z e d „ Z RS( t towerc C` sô y | j | ƒ } Wn‰ t t j t j t j f k
rž } d j d t | ƒ ƒ } t
t | d d ƒ ƒ r | d j d t | j
ƒ ƒ ƒ 7} n t | ƒ ‚ n Xy t j | j
ƒ ƒ SWn7 t t f k
rï } t d j d t | ƒ ƒ ƒ ‚ n Xd S( sE Makes the request to given URL, handles errors, returns JSON
s' Connection to remote host failed: {err}t errt reads with message: {err_msg}t err_msgs% Failed to parse json from host: {err}N( t getR R t URLErrorR t errorR t
HTTPExceptiont formatR
t callablet getattrt NoneR R t jsont loadst
ValueErrort TypeError( t selft request_handlert tower_urlt responset et n_error_msg( ( sC /usr/lib/python2.7/site-packages/ansible/plugins/inventory/tower.pyt make_request| s $%c C` sI | j d ƒ r t | _ t St t | ƒ j | ƒ rA | j d ƒ St Sd S( Ns @tower_inventorys tower_inventory.ymls tower_inventory.yamls tower.ymls
tower.yaml( s tower_inventory.ymls tower_inventory.yamls tower.ymls
tower.yaml( t endswitht Truet no_config_file_suppliedt superR t verify_filet False( R! t path( ( sC /usr/lib/python2.7/site-packages/ansible/plugins/inventory/tower.pyR, s
c C` s² t t | ƒ j | | | ƒ | j rH t j j | ƒ rH | j | ƒ n | j d ƒ } t j
d | ƒ s~ d j d | ƒ } n t d | j d ƒ d | j d ƒ d t
d
| j d
ƒ ƒ } | j d ƒ } t | t ƒ rí t | d d
ƒ} nG y t | d ƒ } Wn1 t k
r3} t d j d t | ƒ ƒ ƒ ‚ n X| j d d ƒ } d j d | ƒ } t | | ƒ } | j | | ƒ } x- | D]% }
|
d k r€| j j |
ƒ q€q€W| d d } xc t j | ƒ D]R \ } }
| j j | ƒ x3 t j |
ƒ D]" \ } } | j j | | | ƒ qóWqÇWxé t j | ƒ D]Ø \ }
} |
d k r´|
d k r´x- | j d g ƒ D] } | j j | |
ƒ qdWx0 | j d g ƒ D] } | j j |
| ƒ q”Wn |
d k r-xB t j | j d i ƒ ƒ D]" \ } } | j j |
| | ƒ qÜWq-q-W| j d ƒ r¡t | d ƒ } | j | | ƒ } i } | j d i ƒ j d d ƒ | d