Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/web_infrastructure/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/web_infrastructure/rundeck_acl_policy.pyc

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
mZddlm
Z
dd
lmZddlZddd��YZd�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys�
---
module: rundeck_acl_policy

short_description: Manage Rundeck ACL policies.
description:
    - Create, update and remove Rundeck ACL policies through HTTP API.
version_added: "2.4"
author: "Loic Blot (@nerzhul)"
options:
    state:
        description:
            - Create or remove Rundeck project.
        choices: ['present', 'absent']
        default: 'present'
    name:
        description:
            - Sets the project name.
        required: True
    url:
        description:
            - Sets the rundeck instance URL.
        required: True
    api_version:
        description:
            - Sets the API version used by module.
            - API version must be at least 14.
        default: 14
    token:
        description:
            - Sets the token to authenticate against Rundeck API.
        required: True
    project:
        description:
            - Sets the project which receive the ACL policy.
            - If unset, it's a system ACL policy.
    policy:
        description:
            - Sets the ACL policy content.
            - ACL policy content is a YAML object as described in http://rundeck.org/docs/man5/aclpolicy.html.
            - It can be a YAML string or a pure Ansible inventory YAML object.
s8
- name: Create or update a rundeck ACL policy in project Ansible
  rundeck_acl_policy:
    name: "Project_01"
    api_version: 18
    url: "https://rundeck.example.org"
    token: "mytoken"
    state: present
    project: "Ansible"
    policy:
      description: "my policy"
      context:
        application: rundeck
      for:
        project:
          - allow: read
      by:
        group: "build"

- name: Remove a rundeck system policy
  rundeck_acl_policy:
    name: "Project_02"
    url: "https://rundeck.example.org"
    token: "mytoken"
    state: absent
so
rundeck_response:
    description: Rundeck response when a failure occurs.
    returned: failed
    type: str
before:
    description: Dictionary containing ACL policy informations before modification.
    returned: success
    type: dict
after:
    description: Dictionary containing ACL policy informations after modification.
    returned: success
    type: dict
(t
AnsibleModule(t	fetch_url(tto_textNtRundeckACLManagercB`sDeZd�Zd�Zddd�Zd�Zd�Zd�ZRS(cC`s
||_dS(N(tmodule(tselfR((sY/usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/rundeck_acl_policy.pyt__init__nscC`sd|ddkr0|jjddd|d�n0|ddkr`|jjddd|d�ndS(	NRi�tmsgsQToken not allowed. Please ensure token is allowed or has the correct permissions.trundeck_responsetbodyi�sFatal Rundeck API error.(Rt	fail_json(R
tinfos((sY/usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/rundeck_acl_policy.pythandle_http_code_if_neededqs
tGETcC`st|jd|jjd|jjd|fdtj|�d|didd6dd	6|jjd
d6�\}}|j|�|dk	r|j�}|dkry)tjt	|d
d��}||fSWq	t
k
r}|jjddt|�|f�q	Xqn||fS(Ns%s/api/%d/%sturltapi_versiontdatatmethodtheaderssapplication/jsonsContent-TypetAcceptttokensX-Rundeck-Auth-Tokentterrorstsurrogate_or_strictRsHRundeck response was not a valid JSON. Exception was: %s. Object was: %s(
R	RtparamstjsontdumpsRtNonetreadtloadsR
t
ValueErrorRtstr(R
tqueryRRtresptinfot	json_respte((sY/usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/rundeck_acl_policy.pytrequest_rundeck_apixs&	'
cC`s'|jd|jjd�\}}|S(Nssystem/acl/%s.aclpolicytname(R-RR (R
R)R*((sY/usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/rundeck_acl_policy.pytget_acl�s#cC`s�|j�}|dkr`|jjrP|jjdtdid|jjd�n|jd|jjdddd	i|jjdd
6�\}}|ddkr�|jjdtdid|j��q�|dd
kr�|jjdd|jjd�q�|ddkr0|jjdd|jjd�q�|jjdd|ddid|j��nJ|d
|jjdkr�|jjdt	d|d|�n|jjr�|jjdtd|d|�n|jd|jjdddd	i|jjdd
6�\}}|ddkrB|jjdtd|d|j��nh|dd
krv|jjdd|jjd�n4|ddkr�|jjdd|jjd�ndS(Ntchangedtbeforetaftertpolicyssystem/acl/%s.aclpolicyR.RtPOSTRtcontentsRi�i�Rs9Unable to validate acl %s. Please ensure it's a valid ACLi�sACL %s already existss/Unhandled HTTP status %d, please report the bugtPUTi�i�s%ACL %s doesn't exists. Cannot update.(
R/R#Rt
check_modet	exit_jsontTrueR R-RtFalse(R
tfactst_R*((sY/usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/rundeck_acl_policy.pytcreate_or_update_acl�s<, ($"" (cC`s�|j�}|dkr:|jjdtdidi�nO|jjsj|jd|jjddd�n|jjdtd|di�dS(NR0R1R2ssystem/acl/%s.aclpolicyR.RtDELETE(	R/R#RR8R:R7R-R R9(R
R;((sY/usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/rundeck_acl_policy.pyt
remove_acl�s"$N(	t__name__t
__module__RRR#R-R/R=R?(((sY/usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/rundeck_acl_policy.pyRms				(cC`s<tdtdtdddddgdd�d	td
tdd�dtd
tdd�dtdd
dd�dtd
tdddt�dtdd�dtdd��ddddgggdt�}|jddkr�|jdd�nt|�}|jddkr|j�n |jddkr8|j�ndS(Nt
argument_spectstatettypeR'tchoicestpresenttabsenttdefaultR.trequiredRRtintiRtno_logR3tprojecttrequired_iftsupports_check_modeRs!API version should be at least 14(RtdictR9R RRR=R?(Rtrundeck((sY/usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/rundeck_acl_policy.pytmain�s$!	
t__main__((t
__future__RRRRDt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNtansible.module_utils.basicRtansible.module_utils.urlsR	tansible.module_utils._textR
R!RRQR@(((sY/usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/rundeck_acl_policy.pyt<module>	s


+Y	

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]