Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/network/f5/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/network/f5/bigip_remote_role.pyo

�
�Udac@`s3ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
mZddlm
Z
yddd
lmZddlmZddlmZddlmZddlmZddlmZWnqek
rIdd
lmZddlmZddlmZddlmZddlmZddlmZnXdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZdefd ��YZ d!efd"��YZ!d#efd$��YZ"d%�Z#e$d&kr/e#�nd'S((i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	certifiedtsupported_bys�

---
module: bigip_remote_role
short_description: Manage remote roles on a BIG-IP
description:
  - Manages remote roles on a BIG-IP. Remote roles are used in situations where
    user authentication is handled off-box. Local access control to the BIG-IP
    is controlled by the defined remote role. Where-as authentication (and by
    extension, assignment to the role) is handled off-box.
version_added: 2.7
options:
  name:
    description:
      - Specifies the name of the remote role.
    type: str
    required: True
  line_order:
    description:
      - Specifies the order of the line in the file C(/config/bigip/auth/remoterole).
      - The LDAP and Active Directory servers read this file line by line.
      - The order of the information is important; therefore, F5 recommends that
        you set the first line at 1000. This allows you, in the future, to insert
        lines before the first line.
      - When creating a new remote role, this parameter is required.
    type: int
  attribute_string:
    description:
      - Specifies the user account attributes saved in the group, in the format
        C(cn=, ou=, dc=).
      - When creating a new remote role, this parameter is required.
    type: str
  remote_access:
    description:
      - Enables or disables remote access for the specified group of remotely
        authenticated users.
      - When creating a new remote role, if this parameter is not specified, the default
        is C(yes).
    type: bool
  assigned_role:
    description:
      - Specifies the authorization (level of access) for the account.
      - When creating a new remote role, if this parameter is not provided, the
        default is C(none).
      - The C(partition_access) parameter controls which partitions the account can
        access.
      - The chosen role may affect the partitions that one is allowed to specify.
        Specifically, roles such as C(administrator), C(auditor) and C(resource-administrator)
        required a C(partition_access) of C(all).
      - A set of pre-existing roles ship with the system. They are C(none), C(guest),
        C(operator), C(application-editor), C(manager), C(certificate-manager),
        C(irule-manager), C(user-manager), C(resource-administrator), C(auditor),
        C(administrator), C(firewall-manager).
    type: str
  partition_access:
    description:
      - Specifies the accessible partitions for the account.
      - This parameter supports the reserved names C(all) and C(Common), as well as
        specific partitions a user may access.
      - Users who have access to a partition can operate on objects in that partition,
        as determined by the permissions conferred by the user's C(assigned_role).
      - When creating a new remote role, if this parameter is not specified, the default
        is C(all).
    type: str
  terminal_access:
    description:
      - Specifies terminal-based accessibility for remote accounts not already
        explicitly assigned a user role.
      - Common values for this include C(tmsh) and C(none), however custom values
        may also be specified.
      - When creating a new remote role, if this parameter is not specified, the default
        is C(none).
    type: str
  state:
    description:
      - When C(present), guarantees that the remote role exists.
      - When C(absent), removes the remote role from the system.
    type: str
    choices:
      - absent
      - present
    default: present
extends_documentation_fragment: f5
author:
  - Tim Rupp (@caphrim007)
s�
- name: Create a remote role
  bigip_remote_role:
    name: foo
    group_name: ldap_group
    line_order: 1
    attribute_string: memberOf=cn=ldap_group,cn=ldap.group,ou=ldap
    remote_access: enabled
    assigned_role: administrator
    partition_access: all
    terminal_access: none
    state: present
    provider:
      password: secret
      server: lb.mydomain.com
      user: admin
  delegate_to: localhost
s
attribute_string:
  description: The new attribute string of the resource.
  returned: changed
  type: str
  sample: "memberOf=cn=ldap_group,cn=ldap.group,ou=ldap"
terminal_access:
  description: The terminal setting of the remote role.
  returned: changed
  type: str
  sample: tmsh
line_order:
  description: Order of the remote role for LDAP and Active Directory servers.
  returned: changed
  type: int
  sample: 1000
assigned_role:
  description: System role that this remote role is associated with.
  returned: changed
  type: str
  sample: administrator
partition_access:
  description: Partition that the role has access to.
  returned: changed
  type: str
  sample: all
remote_access:
  description: Whether remote access is allowed or not.
  returned: changed
  type: bool
  sample: no
(t
AnsibleModule(t	iteritems(tF5RestClient(t
F5ModuleError(tAnsibleF5Parameters(tf5_argument_spec(tflatten_boolean(ttransform_namet
ParameterscB`s�eZidd6dd6dd6dd6dd	6d
d6Zdddddd	gZdddddd
gZdddddd
gZidd
6dd6dd6dd6dd6dd6dd6ZRS(tattribute_stringt	attributetterminal_accesstconsolet
line_ordert	lineOrdert
assigned_roletroletpartition_accesst
userPartitiont
remote_accesstdenytapplicationeditorsapplication-editortnoaccesstnonetcertificatemanagerscertificate-managertirulemanagers
irule-managertusermanagersuser-managert
resourceadminsresource-administratortfirewallmanagersfirewall-manager(t__name__t
__module__tapi_maptapi_attributestreturnablest
updatablestrole_map(((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_remote_role.pyR�sB
			t
ApiParameterscB`seZRS((R%R&(((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_remote_role.pyR,�stModuleParameterscB`sSeZed��Zed��Zed��Zed��Zed��ZRS(cC`sdS(NtCommon((tself((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_remote_role.pyt	partition�scC`s8|jddkrdS|jj|jd|jd�S(NR(t_valuestNoneR+tget(R/((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_remote_role.pyR�scC`s@|jddkr|jdS|jddkr5dS|jdS(NRttmshRtdisable(NR4(R1R2(R/((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_remote_role.pyR�s
cC`s9|jddkrdS|jddkr.dS|jdS(NRtalltAll(R1R2(R/((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_remote_role.pyR�s
cC`s7t|jd�}|dkr#dS|dkr3dSdS(NRtyestdisabledtnotenabled(RR1(R/tresult((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_remote_role.pyR�s
(R%R&tpropertyR0RRRR(((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_remote_role.pyR-�s
tChangescB`seZd�ZRS(cC`sXi}y:x$|jD]}t||�||<qW|j|�}Wntk
rSnX|S(N(R)tgetattrt_filter_paramst	Exception(R/R<t
returnable((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_remote_role.pyt	to_returns
(R%R&RC(((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_remote_role.pyR>st
UsableChangescB`seZRS((R%R&(((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_remote_role.pyRDstReportableChangescB`s&eZed��Zed��ZRS(cC`sT|jddkrdStd�t|j�D��}|j|jd|jd�S(NRcs`s!|]\}}||fVqdS(N((t.0tktv((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_remote_role.pys	<genexpr>s(R1R2tdictR	R+R3(R/trmap((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_remote_role.pyRscC`s@|jddkr|jdS|jddkr5dS|jdS(NRR4R9R(Nstmsh(R1R2(R/((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_remote_role.pyRs
(R%R&R=RR(((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_remote_role.pyREst
DifferencecB`s&eZdd�Zd�Zd�ZRS(cC`s||_||_dS(N(twantthave(R/RLRM((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_remote_role.pyt__init__&s	cC`s9yt||�}|SWntk
r4|j|�SXdS(N(R?tAttributeErrort_Difference__default(R/tparamR<((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_remote_role.pytcompare*s

cC`sQt|j|�}y&t|j|�}||kr7|SWntk
rL|SXdS(N(R?RLRMRO(R/RQtattr1tattr2((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_remote_role.pyt	__default1s
N(R%R&R2RNRRRP(((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_remote_role.pyRK%s	t
ModuleManagercB`s�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�ZRS(cO`s^|jdd�|_t|jj�|_td|jj�|_t�|_	t
�|_dS(Ntmoduletparams(R3R2RWR
RXtclientR-RLR,RMRDtchanges(R/targstkwargs((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_remote_role.pyRN<s
cC`sji}xBtjD]7}t|j|�dk	rt|j|�||<qqW|rftd|�|_ndS(NRX(RR)R?RLR2RDRZ(R/tchangedtkey((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_remote_role.pyt_set_changed_optionsCscC`s�t|j|j�}tj}t�}xX|D]P}|j|�}|dkrUq.q.t|t�rt|j	|�q.|||<q.W|r�t
d|�|_tSt
S(NRX(RKRLRMRR*RIRRR2t
isinstancetupdateRDRZtTruetFalse(R/tdiffR*R]RGtchange((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_remote_role.pyt_update_changed_optionsKs		
cC`s|j�}|rtStS(N(RfRbRc(R/R<((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_remote_role.pyt
should_update]scC`s�t}t�}|jj}|dkr6|j�}n|dkrQ|j�}ntd|jj��}|j�}|j	|�|j	td|��|j
|�|S(NtpresenttabsentRXR](RcRIRLtstateRhRiRERZRCRat_announce_deprecations(R/R]R<Rjt
reportableRZ((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_remote_role.pytexec_modulecs	

cC`sK|jdg�}x2|D]*}|jjjd|dd|d�qWdS(Nt
__warningstmsgtversion(tpopRYRWt	deprecate(R/R<twarningstwarning((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_remote_role.pyRkts


cC`s$|j�r|j�S|j�SdS(N(texistsRatcreate(R/((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_remote_role.pyRh|s
cC`s�dj|jjd|jjdt|jj|jj��}|jjj|�}y|j	�}Wnt
k
rwtSX|jdks�d|kr�|ddkr�tSt
S(Ns6https://{0}:{1}/mgmt/tm/auth/remote-role/role-info/{2}tservertserver_porti�tcode(tformatRYtproviderRRLR0tnametapiR3tjsont
ValueErrorRcRRb(R/turitresptresponse((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_remote_role.pyRu�s


+cC`s=|j�|_|j�stS|jjr/tS|j�tS(N(tread_current_from_deviceRMRgRcRWt
check_modeRbtupdate_on_device(R/((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_remote_role.pyRa�s
cC`s9|jjrtS|j�|j�r5td��ntS(NsFailed to delete the resource.(RWR�Rbtremove_from_deviceRuR(R/((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_remote_role.pytremove�s
cC`s�|jjdkr,|jjidd6�n|jjdkrX|jjitd6�n|jjdkr�|jjidd6�n|jjdkr�|jjidd6�n|j�|j	j
r�tS|j�tS(NR6RRRRR(RLRR2RaRRbRRR_RWR�tcreate_on_device(R/((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_remote_role.pyRv�s

cC`s�|jj�}|jj|d<dj|jjd|jjd�}|jjj|d|�}y|j	�}Wn%t
k
r�}tt|���nXd|kr�|dd
kr�d	|kr�t|d	��q�t|j
��ndS(NR|s3https://{0}:{1}/mgmt/tm/auth/remote-role/role-info/RwRxR~Ryi�i�tmessage(i�i�(RZt
api_paramsRLR|RzRYR{R}tpostR~RRtstrtcontent(R/RXR�R�R�tex((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_remote_role.pyR��s
cC`s|jj�}dj|jjd|jjdt|jj|jj��}|jj	j
|d|�}y|j�}Wn%tk
r�}t
t|���nXd|kr|ddkrd|kr�d|dkr�t
d	��nt
|d��qt
|j��ndS(
Ns6https://{0}:{1}/mgmt/tm/auth/remote-role/role-info/{2}RwRxR~Ryi�R�s9Once configured [All] partition, remote user group cannotsHThe specified 'attribute_string' is already used in the 'all' partition.(RZR�RzRYR{RRLR0R|R}tpatchR~RRR�R�(R/RXR�R�R�R�((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_remote_role.pyR��s"

cC`s|j�r|j�StS(N(RuR�Rc(R/((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_remote_role.pyRi�s
cC`s�dj|jjd|jjdt|jj|jj��}|jjj|�}|j	dkrft
Sd|kr�|ddkr�d|kr�t|d��q�t|j��ndS(Ns6https://{0}:{1}/mgmt/tm/auth/remote-role/role-info/{2}RwRxi�Ryi�R�(
RzRYR{RRLR0R|R}tdeleteRRbRR�(R/R�R�((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_remote_role.pyR��s

cC`s�dj|jjd|jjdt|jj|jj��}|jjj|�}y|j	�}Wn%t
k
r�}tt|���nXd|kr�|ddkr�d|kr�t|d��q�t|j
��ntd|�S(Ns6https://{0}:{1}/mgmt/tm/auth/remote-role/role-info/{2}RwRxRyi�R�RX(RzRYR{RRLR0R|R}R3R~RRR�R�R,(R/R�R�R�R�((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_remote_role.pyR��s

(R%R&RNR_RfRgRmRkRhRuRaR�RvR�R�RiR�R�(((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_remote_role.pyRV;s 																tArgumentSpeccB`seZd�ZRS(cC`s�t|_tdtdt�dtdd�dt�dtdd�d	t�d
t�dt�dtd
ddddg��}i|_|jjt�|jj|�dS(NR|trequiredRttypetintRRtboolRRRRjtdefaultRhtchoicesRi(Rbtsupports_check_modeRIt
argument_specRaR
(R/R�((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_remote_role.pyRNs						(R%R&RN(((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_remote_role.pyR�scC`s�t�}td|jd|j�}y,td|�}|j�}|j|�Wn)tk
r{}|jdt	|��nXdS(NR�R�RWRo(
R�RR�R�RVRmt	exit_jsonRt	fail_jsonR�(tspecRWtmmtresultsR�((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_remote_role.pytmains		t__main__N(%t
__future__RRRR�t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNtansible.module_utils.basicRtansible.module_utils.sixR	t%library.module_utils.network.f5.bigipR
t&library.module_utils.network.f5.commonRRR
RRtImportErrort%ansible.module_utils.network.f5.bigipt&ansible.module_utils.network.f5.commonRR,R-R>RDREtobjectRKRVR�R�R%(((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_remote_role.pyt<module>sF


V!
0$�	

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