�
�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 Z d d l
m Z 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_host
version_added: "2.3"
author: "Wayne Witzel III (@wwitzel3)"
short_description: create, update, or destroy Ansible Tower host.
description:
- Create, update, or destroy Ansible Tower hosts. See
U(https://www.ansible.com/tower) for an overview.
options:
name:
description:
- The name to use for the host.
required: True
description:
description:
- The description to use for the host.
inventory:
description:
- Inventory the host should be made a member of.
required: True
enabled:
description:
- If the host should be enabled.
type: bool
default: 'yes'
variables:
description:
- Variables to use for the host. Use C(@) for a file.
state:
description:
- Desired state of the resource.
choices: ["present", "absent"]
default: "present"
extends_documentation_fragment: tower
s�
- name: Add tower host
tower_host:
name: localhost
description: "Local Host Group"
inventory: "Local Inventory"
state: present
tower_config_file: "~/tower_cli.cfg"
variables:
example_var: 123
N( t TowerModulet tower_auth_configt tower_check_modet
HAS_TOWER_CLI( t settingsc C` s� t d t d t � d t � d t d t � d t d d d t � 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 � } | r?| j d � r?t j j | d � } t | d � � } | j
� } Wd QXq?n 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 t � } | d |
d <n+ | d
k r(| j d | d | d � } n Wnx t j k
r`} | j d d j | � d t � nD t j t j t j f k
r�} | j d d j | � d t � n XWd QX| d |
d <| j |
� d S( Nt namet requiredt descriptiont inventoryt enabledt typet boolt defaultt variablest statet choicest presentt absentt
argument_spect supports_check_modet @i t rt hostt idt create_on_missingt msgs/ Failed to update host, inventory not found: {0}t changeds Failed to update host: {0}( t dictt TrueR t paramst gett
startswitht ost patht
expandusert opent readR 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 t filenamet ft json_outputt
tower_authR t inv_rest invt resultt excinfo( ( s_ /usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/ansible_tower/tower_host.pyt mainP sN
#"!)t __main__( t
__future__R R R R t
__metaclass__t ANSIBLE_METADATAt
DOCUMENTATIONt EXAMPLESR( t"