�
�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 d l
Z
d d l m Z d d
l
m Z d d l j j Z d d l m Z e j � Z d e f d � � YZ 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: na_ontap_unix_user
short_description: NetApp ONTAP UNIX users
extends_documentation_fragment:
- netapp.na_ontap
version_added: '2.8'
author: NetApp Ansible Team (@carchi8py) <[email protected]>
description:
- Create, delete or modify UNIX users local to ONTAP.
options:
state:
description:
- Whether the specified user should exist or not.
choices: ['present', 'absent']
default: 'present'
name:
description:
- Specifies user's UNIX account name.
- Non-modifiable.
required: true
group_id:
description:
- Specifies the primary group identification number for the UNIX user
- Required for create, modifiable.
vserver:
description:
- Specifies the Vserver for the UNIX user.
- Non-modifiable.
required: true
id:
description:
- Specifies an identification number for the UNIX user.
- Required for create, modifiable.
full_name:
description:
- Specifies the full name of the UNIX user
- Optional for create, modifiable.
sL
- name: Create UNIX User
na_ontap_unix_user:
state: present
name: SampleUser
vserver: ansibleVServer
group_id: 1
id: 2
full_name: Test User
hostname: "{{ netapp_hostname }}"
username: "{{ netapp_username }}"
password: "{{ netapp_password }}"
- name: Delete UNIX User
na_ontap_unix_user:
state: absent
name: SampleUser
vserver: ansibleVServer
hostname: "{{ netapp_hostname }}"
username: "{{ netapp_username }}"
password: "{{ netapp_password }}"
s
N( t
AnsibleModule( t to_native( t NetAppModulet NetAppOntapUnixUserc B` sM e Z d Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z RS( s6
Common operations to manage users and roles.
c C` s9 t j � | _ | j j t d t d t d d d g d d � d t d t d d � d
t d t d d � d t d t d d � d
t d t d d � d t d t d d � � � t d | j d t � | _ t � | _
| j
j | j j � | _
t t k r| j j d d � n% t j d | j d | j
d � | _ d S( Nt statet requiredt choicest presentt absentt defaultt namet typet strt group_idt intt idt full_namet vservert
argument_spect supports_check_modet msgs( the python NetApp-Lib module is requiredt module( t netapp_utilst na_ontap_host_argument_specR t updatet dictt Falset TrueR R R
t na_helpert set_parameterst paramst
parameterst HAS_NETAPP_LIBt fail_jsont setup_na_ontap_zapit server( t self( ( sU /usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_unix_user.pyt __init__k s ! c C` s. t j j d � } i i i | j d d 6| j d d 6d 6d 6} | j | � y� | j j | d t �} | j d � r� t | j
d � � d k r� | d
d } i t | d � d 6t | d
� d 6| d d 6Sd SWnO t j j k
r)} | j
j d d | j d t | � f d t j � � n Xd S( s�
Checks if the UNIX user exists.
:return:
dict() if user found
None if user is not found
s name-mapping-unix-user-get-iterR s user-nameR s unix-user-infot queryt enable_tunnelings num-recordsi s attributes-lists group-idR s user-idR s full-nameR R s Error getting UNIX user %s: %st exceptionN( R t zapit NaElementR'