�
�Udac @` s� d d l m Z m Z m Z e Z i d d 6d g d 6d d 6Z d Z d Z d d
l m
Z
m Z m Z y/ d d l
Z
d d l j Z d d l m Z Wn e k
r� n Xd
� Z e d k r� e � n d S( i ( t absolute_importt divisiont print_functions 1.1t metadata_versiont previewt statust communityt supported_bys{
---
module: tower_inventory
version_added: "2.3"
author: "Wayne Witzel III (@wwitzel3)"
short_description: create, update, or destroy Ansible Tower inventory.
description:
- Create, update, or destroy Ansible Tower inventories. See
U(https://www.ansible.com/tower) for an overview.
options:
name:
description:
- The name to use for the inventory.
required: True
description:
description:
- The description to use for the inventory.
organization:
description:
- Organization the inventory belongs to.
required: True
variables:
description:
- Inventory variables. Use C(@) to get from file.
kind:
description:
- The kind field. Cannot be modified after created.
default: ""
choices: ["", "smart"]
version_added: "2.7"
host_filter:
description:
- The host_filter field. Only useful when C(kind=smart).
version_added: "2.7"
state:
description:
- Desired state of the resource.
default: "present"
choices: ["present", "absent"]
extends_documentation_fragment: tower
s�
- name: Add tower inventory
tower_inventory:
name: "Foo Inventory"
description: "Our Foo Cloud Servers"
organization: "Bar Org"
state: present
tower_config_file: "~/tower_cli.cfg"
( t TowerModulet tower_auth_configt tower_check_modeN( t settingsc C` s� t d t d t � d t � d t d t � d t � d t d d d g d
d � d t � d t d d
d g d
d
� � } t d | d t � } | j j d � } | j j d � } | j j d � } | j j d � } | j j d � } | j j d � } | j j d � } i | d 6| d 6} t | � }
t j |
� �@t | � t j
d � } y� t j
d � } | j d | � }
| d
k r�| j d | d |
d d | d | d | d | d t � } | d | d <n+ | d k r�| j d | d |
d � } n Wnx t
j k
r2} | j d d j | � d t � nD t
j t
j t
j f k
ru} | j d d j | � d t � n XWd QX| d | d <| j | � d S( Nt namet requiredt descriptiont organizationt variablest kindt choicest t smartt defaultt host_filtert statet presentt absentt
argument_spect supports_check_modet inventoryt idt create_on_missingt msgs7 Failed to update inventory, organization not found: {0}t changeds Failed to update inventory: {0}( t dictt TrueR t paramst getR R t runtime_valuesR
t tower_clit get_resourcet modifyt deletet exct NotFoundt fail_jsont formatt Falset ConnectionErrort
BadRequestt AuthErrort exit_json( R t moduleR R R R R R R t json_outputt
tower_authR t org_rest orgt resultt excinfo( ( sd /usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/ansible_tower/tower_inventory.pyt mainQ sJ
#"!)t __main__( t
__future__R R R t typet
__metaclass__t ANSIBLE_METADATAt
DOCUMENTATIONt EXAMPLESt"