�
�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 d � 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_role
version_added: "2.3"
author: "Wayne Witzel III (@wwitzel3)"
short_description: create, update, or destroy Ansible Tower role.
description:
- Create, update, or destroy Ansible Tower roles. See
U(https://www.ansible.com/tower) for an overview.
options:
user:
description:
- User that receives the permissions specified by the role.
team:
description:
- Team that receives the permissions specified by the role.
role:
description:
- The role type to grant/revoke.
required: True
choices: ["admin", "read", "member", "execute", "adhoc", "update", "use", "auditor", "project_admin", "inventory_admin", "credential_admin",
"workflow_admin", "notification_admin", "job_template_admin"]
target_team:
description:
- Team that the role acts on.
inventory:
description:
- Inventory the role acts on.
job_template:
description:
- The job template the role acts on.
credential:
description:
- Credential the role acts on.
organization:
description:
- Organization the role acts on.
project:
description:
- Project the role acts on.
state:
description:
- Desired state of the resource.
default: "present"
choices: ["present", "absent"]
extends_documentation_fragment: tower
s�
- name: Add jdoe to the member role of My Team
tower_role:
user: jdoe
target_team: "My Team"
role: member
state: present
tower_config_file: "~/tower_cli.cfg"
( t TowerModulet tower_auth_configt tower_check_modeN( t settingsc C` s | j � } i d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d
6} x� | j � D]� \ } } yZ | | r� | d k r� d n | } t j | � j i | | | 6� } | d | | <n WqW t j k
r� } | j d d
j | | � d t � qW XqW W| S( sr update_resources attempts to fetch any of the resources given
by name using their unique field (identity)
t usernamet usert namet teamt target_teamt inventoryt job_templatet
credentialt organizationt projectt idt msgs) Failed to update role, {0} not found: {1}t changed(
t copyt itemst tower_clit get_resourcet gett exct NotFoundt fail_jsont formatt False( t modulet pt paramst identity_mapt kt vt keyt resultt excinfo( ( s_ /usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/ansible_tower/tower_role.pyt update_resourcesV s&