�
�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
Z d Z
e Z y d d l
m Z Wn e k
r� e Z n Xd d
l m Z d d l m Z m Z d � Z d � Z d � Z d � Z d � 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: purefb_ds
version_added: '2.8'
short_description: Configure FlashBlade Directory Service
description:
- Create or erase directory services configurations. There is no facility
to SSL certificates at this time. Use the FlashBlade GUI for this
additional configuration work.
- To modify an existing directory service configuration you must first delete
an existing configuration and then recreate with new settings.
author:
- Pure Storage Ansible Team (@sdodsley) <[email protected]>
options:
state:
description:
- Create or delete directory service configuration
default: present
type: str
choices: [ absent, present ]
dstype:
description:
- The type of directory service to work on
choices: [ management, nfs, smb ]
type: str
enable:
description:
- Whether to enable or disable directory service support.
default: false
type: bool
uri:
description:
- A list of up to 30 URIs of the directory servers. Each URI must include
the scheme ldap:// or ldaps:// (for LDAP over SSL), a hostname, and a
domain name or IP address. For example, ldap://ad.company.com configures
the directory service with the hostname "ad" in the domain "company.com"
while specifying the unencrypted LDAP protocol.
type: list
base_dn:
description:
- Sets the base of the Distinguished Name (DN) of the directory service
groups. The base should consist of only Domain Components (DCs). The
base_dn will populate with a default value when a URI is entered by
parsing domain components from the URI. The base DN should specify DC=
for each domain component and multiple DCs should be separated by commas.
required: true
type: str
bind_password:
description:
- Sets the password of the bind_user user name account.
type: str
bind_user:
description:
- Sets the user name that can be used to bind to and query the directory.
- For Active Directory, enter the username - often referred to as
sAMAccountName or User Logon Name - of the account that is used to
perform directory lookups.
- For OpenLDAP, enter the full DN of the user.
type: str
nis_servers:
description:
- A list of up to 30 IP addresses or FQDNs for NIS servers.
- This cannot be used in conjunction with LDAP configurations.
type: list
version_added: 2.9
nis_domain:
description:
- The NIS domain to search
- This cannot be used in conjunction with LDAP configurations.
type: str
version_added: 2.9
join_ou:
description:
- The optional organizational unit (OU) where the machine account
for the directory service will be created.
type: str
version_added: 2.9
extends_documentation_fragment:
- purestorage.fb
sq
- name: Delete existing management directory service
purefb_ds:
dstype: management
state: absent
fb_url: 10.10.10.2
api_token: e31060a7-21fc-e277-6240-25983c6c4592
- name: Create NFS directory service (disabled)
purefb_ds:
dstype: nfs
uri: "ldaps://lab.purestorage.com"
base_dn: "DC=lab,DC=purestorage,DC=com"
bind_user: Administrator
bind_password: password
fb_url: 10.10.10.2
api_token: e31060a7-21fc-e277-6240-25983c6c4592
- name: Enable existing SMB directory service
purefb_ds:
dstypr: smb
enable: true
fb_url: 10.10.10.2
api_token: e31060a7-21fc-e277-6240-25983c6c4592
- name: Disable existing management directory service
purefb_ds:
dstype: management
enable: false
fb_url: 10.10.10.2
api_token: e31060a7-21fc-e277-6240-25983c6c4592
- name: Create NFS directory service (enabled)
purefb_ds:
dstype: nfs
enable: true
uri: "ldaps://lab.purestorage.com"
base_dn: "DC=lab,DC=purestorage,DC=com"
bind_user: Administrator
bind_password: password
fb_url: 10.10.10.2
api_token: e31060a7-21fc-e277-6240-25983c6c4592
t
s 1.7( t DirectoryService( t
AnsibleModule( t get_bladet purefb_argument_specc C` s t } | j d | � d S( s Update Directory Servicet changedN( t Falset exit_json( t modulet bladeR
( ( sQ /usr/lib/python2.7/site-packages/ansible/modules/storage/purestorage/purefb_ds.pyt update_ds� s c C` s� t } | j s| y6 | j j d | j d g d t d t � � t } Wq| t k
rx | j d d j | j d � � q| Xn | j d | � d S( s Enable Directory Servicet namest dstypet directory_servicet enabledt msgs8 Enable {0} Directory Service failed: Check ConfigurationR
N(
t Truet
check_modet directory_servicest update_directory_servicest paramsR t Exceptiont fail_jsont formatR ( R R R
( ( sQ /usr/lib/python2.7/site-packages/ansible/modules/storage/purestorage/purefb_ds.pyt enable_ds� s
'c C` s� t } | j sv y0 | j j d | j d g d t d t � � Wqv t k
rr | j d d j | j d � � qv Xn | j
d | � d S( s Disable Directory ServiceR R R R R s$ Disable {0} Directory Service failedR
N( R R R R R R R R R R R ( R R R
( ( sQ /usr/lib/python2.7/site-packages/ansible/modules/storage/purestorage/purefb_ds.pyt
disable_ds� s
'c
C` s t } | j s�| j j d | j d g � } y�| j d d k r� | j d j r� t d d g d d d d d d d
t � } q�t } n| j d d k r� | j d j r� i d d 6} t d d g d d d d d d d | d
t � } q�t } n� | j d d
k r�| j d j rFt d d g d d d d d d d
t � } q�| j d j j
r�i g d 6g d 6} t d
| d
t � } q�t } n | r�| j j d | j d g d | � n Wq�t k
r�| j
d d j | j d � � q�Xn | j d | � d S( s Delete Directory ServiceR R t
managementi t urist t base_dnt bind_usert
bind_passwordR t smbt join_out nfst nis_domainst nis_serversR R s# Delete {0} Directory Service failedR
N( R R R t list_directory_servicesR t itemsR# R R R* R+ R R R R R ( R R R
t dirservt dir_servicet smb_attrst nfs_attrs( ( sQ /usr/lib/python2.7/site-packages/ansible/modules/storage/purestorage/purefb_ds.pyt delete_ds� sR
'c C` s� t } | j sty.| j d d k r� | j d r� t d | j d d d !d | j d d | j d d | j d d
| j d � } q| j d d
j | j d � � np| j d d k rZ| j d r7i | j d d 6} t d | j d d d !d | j d d | j d d | j d d | d
| j d � } q| j d d
j | j d � � n� | j d d k r| j d r�i | j d g d 6| j d d d !d 6} t d | d
| j d � } qt d | j d d d !d | j d d | j d d | j d d
| j d � } n | j j d | j d g d | � Wqtt k
rp| j d d j | j d � � qtXn | j d | � d S( s Create Directory ServiceR R"