Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/storage/netapp/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_ldap.pyc

�
�Udac@`sddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlZyddlZWn e
k
r�ddljZnXddlmZdd
lmZmZddlmZdefd��YZd�Zedkre�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys�
---
module: netapp_e_ldap
short_description: NetApp E-Series manage LDAP integration to use for authentication
description:
    - Configure an E-Series system to allow authentication via an LDAP server
version_added: '2.7'
author: Michael Price (@lmprice)
extends_documentation_fragment:
    - netapp.eseries
options:
    state:
        description:
            - Enable/disable LDAP support on the system. Disabling will clear out any existing defined domains.
        choices:
            - present
            - absent
        default: present
    identifier:
        description:
            - This is a unique identifier for the configuration (for cases where there are multiple domains configured).
            - If this is not specified, but I(state=present), we will utilize a default value of 'default'.
    username:
        description:
            - This is the user account that will be used for querying the LDAP server.
            - "Example: CN=MyBindAcct,OU=ServiceAccounts,DC=example,DC=com"
        required: yes
        aliases:
            - bind_username
    password:
        description:
            - This is the password for the bind user account.
        required: yes
        aliases:
            - bind_password
    attributes:
        description:
            - The user attributes that should be considered for the group to role mapping.
            - Typically this is used with something like 'memberOf', and a user's access is tested against group
              membership or lack thereof.
        default: memberOf
    server:
        description:
            - This is the LDAP server url.
            - The connection string should be specified as using the ldap or ldaps protocol along with the port
              information.
        aliases:
            - server_url
        required: yes
    name:
        description:
            - The domain name[s] that will be utilized when authenticating to identify which domain to utilize.
            - Default to use the DNS name of the I(server).
            - The only requirement is that the name[s] be resolvable.
            - "Example: [email protected]"
        required: no
    search_base:
        description:
            - The search base is used to find group memberships of the user.
            - "Example: ou=users,dc=example,dc=com"
        required: yes
    role_mappings:
        description:
            - This is where you specify which groups should have access to what permissions for the
              storage-system.
            - For example, all users in group A will be assigned all 4 available roles, which will allow access
              to all the management functionality of the system (super-user). Those in group B only have the
              storage.monitor role, which will allow only read-only access.
            - This is specified as a mapping of regular expressions to a list of roles. See the examples.
            - The roles that will be assigned to to the group/groups matching the provided regex.
            - storage.admin allows users full read/write access to storage objects and operations.
            - storage.monitor allows users read-only access to storage objects and operations.
            - support.admin allows users access to hardware, diagnostic information, the Major Event
              Log, and other critical support-related functionality, but not the storage configuration.
            - security.admin allows users access to authentication/authorization configuration, as well
              as the audit log configuration, and certification management.
        required: yes
    user_attribute:
        description:
            - This is the attribute we will use to match the provided username when a user attempts to
              authenticate.
        default: sAMAccountName
    log_path:
        description:
            - A local path to a file to be used for debug logging
        required: no
notes:
    - Check mode is supported.
    - This module allows you to define one or more LDAP domains identified uniquely by I(identifier) to use for
      authentication. Authorization is determined by I(role_mappings), in that different groups of users may be given
      different (or no), access to certain aspects of the system and API.
    - The local user accounts will still be available if the LDAP server becomes unavailable/inaccessible.
    - Generally, you'll need to get the details of your organization's LDAP server before you'll be able to configure
      the system for using LDAP authentication; every implementation is likely to be very different.
    - This API is currently only supported with the Embedded Web Services API v2.0 and higher, or the Web Services Proxy
      v3.0 and higher.
s8
    - name: Disable LDAP authentication
      netapp_e_ldap:
        api_url: "10.1.1.1:8443"
        api_username: "admin"
        api_password: "myPass"
        ssid: "1"
        state: absent

    - name: Remove the 'default' LDAP domain configuration
      netapp_e_ldap:
        state: absent
        identifier: default

    - name: Define a new LDAP domain, utilizing defaults where possible
      netapp_e_ldap:
        state: present
        bind_username: "CN=MyBindAccount,OU=ServiceAccounts,DC=example,DC=com"
        bind_password: "mySecretPass"
        server: "ldap://example.com:389"
        search_base: 'OU=Users,DC=example,DC=com'
        role_mappings:
          ".*dist-dev-storage.*":
            - storage.admin
            - security.admin
            - support.admin
            - storage.monitor
s
msg:
    description: Success message
    returned: on success
    type: str
    sample: The ldap settings have been updated.
N(t
AnsibleModule(trequestteseries_host_argument_spec(t	to_nativetLdapcB`steZdZd�Zd�Zd�Zd�Zd�Zd�Zdd�Z
d�Zd	�Zd
�Z
d�ZRS(
sNo changes were necessary.cC`s�t�}|jtdtdddtdddddg�d	tdddt�d
tdddtddg�d
tdddtddgdt�dtdddt�dtdddtddg�dtdddt�dtdddt�dtdddtdd�dtddddgdt�dtdddt���ddd
d
dddggg}td|dtd|�|_|jj}|ddk|_|d	|_	|d
|_
|d
|_|d|_|d|_
|d|_|d|_|d|_|d|_|d|_|d |_td!|d"d#|d#d$|d%d&d'�|_|jj|_|d}tj|jj�|_|r�tjd(tjd)|d*d+d,d-�n|jjd.�s�|jd.7_nd|_d|_ dS(/Ntstatettypetstrtrequiredtdefaulttpresenttchoicestabsentt
identifiertusernametaliasest
bind_usernametpasswordt
bind_passwordtno_logtnametlisttservert
server_urltsearch_baset
role_mappingstdicttuser_attributetsAMAccountNamet
attributestmemberOftlog_patht
argument_spectsupports_check_modetrequired_iftssidtapi_urlturl_passwordtapi_passwordtvalidate_certsturl_usernametapi_usernamettimeouti<tleveltfilenametfilemodetwtformatsS%(relativeCreated)dms %(levelname)s %(module)s.%(funcName)s:%(lineno)d
 %(message)st/(!R
tupdateR"tFalsetTrueRtmoduletparamstldapRRRtnamesRR R!R#R%R+turltcredst
check_modetloggingt	getLoggert	__class__t__name__t_loggertbasicConfigtDEBUGtendswithtNonetembeddedt	base_path(tselfR(R*targsR'((sP/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_ldap.pyt__init__�sX	$!













	
	cC`s%|jsd|_n|jsjtj|j�}|j}d|kr[|jd�d}n|g|_nt�}xK|jD]@}x7|j|D](}|jt	d|dt
d|��q�Wq}Wt	d|jd|jd	t	d
|jd|j�d|d
|j
d|jd|jd|j�}|S(NRt:it
groupRegext
ignoreCaseRtidtldapUrltbindLookupUsertuserRtroleMapCollectiontgroupAttributesR?t
searchBaset
userAttribute(RR?turlparseRtnetloctsplitRR!tappendR"R;RRR%R R#(RNtpartsR]trolestregextroletdomain((sP/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_ldap.pytmake_configuration�s.								cC`s�|jdkr�|j}y^tj|�}|jdd�}tj|�}t|d|j�\}}|d|_Wq�tk
r�}|j	j
d�|jjdd|j
t|�f�q�Xn|jS(	sYDetermine whether or not we're using the embedded or proxy implementation of Web Servicestpaths/devmgr/utils/tabouttrunningAsProxys)Failed to retrieve the About information.tmsgsTFailed to determine the Web Services implementation type! Array Id [%s]. Error [%s].N(RLRKR@R\t_replacet
urlunparseR	RAt	ExceptionRGt	exceptionR<t	fail_jsonR+R(RNR@R`trctresultterr((sP/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_ldap.pytis_embedded�s	cC`szy*t|j|j|j�\}}|SWnItk
ru}|jjd�|jjdd|j	t
|�f�nXdS(Ns*Failed to retrieve the LDAP configuration.RisAFailed to retrieve LDAP configuration! Array Id [%s]. Error [%s].(R	R@RMRARlRGRmR<RnR+R(RNRoRpRq((sP/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_ldap.pytget_full_configurations"cC`s�ytt|j|jd|dt|j�\}}|dkrC|S|dkrSdS|jjdd|j|f�WnIt	k
r�}|j
jd�|jjdd|jt|�f�nXdS(Ns%st
ignore_errorsi�i�RisAFailed to retrieve LDAP configuration! Array Id [%s]. Error [%s].s*Failed to retrieve the LDAP configuration.(
R	R@RMR;RARKR<RnR+RlRGRmR(RNRRoRpRq((sP/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_ldap.pytget_configurations0c	C`s)|j�}|j|j�}||k}d|j}|jjd|�|r|jrd|j}yi|dkr�|jd}n|jd|d}t|j	|ddd	t
j|�|j�\}}Wqt
k
r}|jjd
�|jjdd|jt|�f�qXn||fS(
Ns#No changes were necessary for [%s].sIs updated: %ss-The configuration changes were made for [%s].t	addDomains%sRTtmethodtPOSTtdatas(Failed to modify the LDAP configuration.Ris?Failed to modify LDAP configuration! Array Id [%s]. Error [%s].(ReRuRRGtinfoRBRKRMR	R@tjsontdumpsRARlRmR<RnR+R(	RNRdtcurrentR9RitapiRoRpRq((sP/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_ldap.pytupdate_configuration)s"

8cC`s�|dkr|j}n|j|�}t}|j}|r�t}d|}|js�y4t|j|j	d|dd|j
�\}}Wq�tk
r�}|jj
dd|jt|�f�q�Xq�n||fS(Ns3The LDAP domain configuration for [%s] was cleared.s%sRwtDELETERis?Failed to remove LDAP configuration! Array Id [%s]. Error [%s].(RKRRuR:t
NO_CHANGE_MSGR;RBR	R@RMRARlR<RnR+R(RNRt
configurationtupdatedRiRoRpRq((sP/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_ldap.pytclear_single_configurationCs	
	4!cC`s�|j�}t}|j}|dr�t}d}|js�ygt|j|jdddt|j�\}}|dkr�x&|dD]}|j	|d�q�WnWq�t
k
r�}|jjdd	|j
t|�f�q�Xq�n||fS(
NtldapDomainss3The LDAP configuration for all domains was cleared.RwR�Rti�RTRis>Failed to clear LDAP configuration! Array Id [%s]. Error [%s].(RsR:R�R;RBR	R@RMRAR�RlR<RnR+R(RNR�R�RiRoRptconfigRq((sP/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_ldap.pytclear_configurationUs 	
	.!cC`s%|j�}|rd|jSdSdS(Nsstorage-systems/%s/ldap/s/ldap/(RrR+(RNRL((sP/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_ldap.pyt
get_base_pathjscC`sz|j�|_|jr-|j�\}}n0|jrK|j�\}}n|j�\}}|jjd|d|�dS(NRitchanged(	R�RMR>RRR�R�R<t	exit_json(RNRiR9((sP/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_ldap.pyR9qs		cO`s|j�dS(N(R9(RNROtkwargs((sP/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_ldap.pyt__call__|sN(RFt
__module__R�RPReRrRsRuRRKR�R�R�R9R�(((sP/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_ldap.pyR�s	;									cC`st�}|�dS(N(R(tsettings((sP/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_ldap.pytmain�s	t__main__(t
__future__RRRRt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR{RCR\tImportErrorturllib.parsetparsetansible.module_utils.basicRtansible.module_utils.netappR	R
tansible.module_utils._textRtobjectRR�RF(((sP/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_ldap.pyt<module>s(


b
�	

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