Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/remote_management/cpm/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/remote_management/cpm/cpm_user.pyc

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlmZdd
l
mZmZmZddlmZmZddlmZmZmZd�Zd�Zd�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bysb

---
module: cpm_user
version_added: "2.7"
author: "Western Telematic Inc. (@wtinetworkgear)"
short_description: Get various status and parameters from WTI OOB and PDU devices
description:
    - "Get/Add/Edit Delete Users from WTI OOB and PDU devices"
options:
  cpm_action:
    description:
      - This is the Action to send the module.
    required: true
    choices: [ "getuser", "adduser", "edituser", "deleteuser" ]
  cpm_url:
    description:
      - This is the URL of the WTI device to send the module.
    required: true
  cpm_username:
    description:
      - This is the Basic Authentication Username of the WTI device to send the module.
    required: true
  cpm_password:
    description:
      - This is the Basic Authentication Password of the WTI device to send the module.
    required: true
  use_https:
    description:
      - Designates to use an https connection or http connection.
    required: false
    type: bool
    default: true
  validate_certs:
    description:
      - If false, SSL certificates will not be validated. This should only be used
      - on personally controlled sites using self-signed certificates.
    required: false
    type: bool
    default: true
  use_proxy:
    description: Flag to control if the lookup will observe HTTP proxy environment variables when present.
    required: false
    type: bool
    default: false
  user_name:
    description:
      - This is the User Name that needs to be create/modified/deleted
    required: true
  user_pass:
    description:
      - This is the User Password that needs to be create/modified/deleted
      - If the user is being Created this parameter is required
    required: false
  user_accesslevel:
    description:
      - This is the access level that needs to be create/modified/deleted
      - 0 View, 1 User, 2 SuperUser, 3 Administrator
    required: false
    choices: [ 0, 1, 2, 3 ]
  user_accessssh:
    description:
      - If the user has access to the WTI device via SSH
      - 0 No , 1 Yes
    required: false
    choices: [ 0, 1 ]
  user_accessserial:
    description:
      - If the user has access to the WTI device via Serial ports
      - 0 No , 1 Yes
    required: false
    choices: [ 0, 1 ]
  user_accessweb:
    description:
      - If the user has access to the WTI device via Web
      - 0 No , 1 Yes
    required: false
    choices: [ 0, 1 ]
  user_accessapi:
    description:
      - If the user has access to the WTI device via RESTful APIs
      - 0 No , 1 Yes
    required: false
    choices: [ 0, 1 ]
  user_accessmonitor:
    description:
      - If the user has ability to monitor connection sessions
      - 0 No , 1 Yes
    required: false
    choices: [ 0, 1 ]
  user_accessoutbound:
    description:
      - If the user has ability to initiate Outbound connection
      - 0 No , 1 Yes
    required: false
    choices: [ 0, 1 ]
  user_portaccess:
    description:
      - If AccessLevel is lower than Administrator, which ports the user has access
    required: false
  user_plugaccess:
    description:
      - If AccessLevel is lower than Administrator, which plugs the user has access
    required: false
  user_groupaccess:
    description:
      - If AccessLevel is lower than Administrator, which Groups the user has access
    required: false
  user_callbackphone:
    description:
      - This is the Call Back phone number used for POTS modem connections
    required: false
s�
# Get User Parameters
- name: Get the User Parameters for the given user of a WTI device
  cpm_user:
    cpm_action: "getuser"
    cpm_url: "rest.wti.com"
    cpm_username: "restuser"
    cpm_password: "restfuluserpass12"
    use_https: true
    validate_certs: true
    user_name: "usernumberone"

# Create User
- name: Create a User on a given WTI device
  cpm_user:
    cpm_action: "adduser"
    cpm_url: "rest.wti.com"
    cpm_username: "restuser"
    cpm_password: "restfuluserpass12"
    use_https: true
    validate_certs: false
    user_name: "usernumberone"
    user_pass: "complicatedpassword"
    user_accesslevel: 2
    user_accessssh: 1
    user_accessserial: 1
    user_accessweb: 0
    user_accessapi: 1
    user_accessmonitor: 0
    user_accessoutbound: 0
    user_portaccess: "10011111"
    user_plugaccess: "00000111"
    user_groupaccess: "00000000"

# Edit User
- name: Edit a User on a given WTI device
  cpm_user:
    cpm_action: "edituser"
    cpm_url: "rest.wti.com"
    cpm_username: "restuser"
    cpm_password: "restfuluserpass12"
    use_https: true
    validate_certs: false
    user_name: "usernumberone"
    user_pass: "newpasswordcomplicatedpassword"

# Delete User
- name: Delete a User from a given WTI device
  cpm_user:
    cpm_action: "deleteuser"
    cpm_url: "rest.wti.com"
    cpm_username: "restuser"
    cpm_password: "restfuluserpass12"
    use_https: true
    validate_certs: true
    user_name: "usernumberone"
sk
data:
    description: The output JSON returned from the commands sent
    returned: always
    type: str
N(t
AnsibleModule(tto_texttto_bytest	to_native(t	HTTPErrortURLError(topen_urltConnectionErrortSSLValidationErrorcC`s�dt|jd�}|jddk	rct|jd�dkrcd|t|jd�f}n|jddk	r�d|t|jd�f}n|jddk	r�d	|t|jd�f}n|jd
dk	r�d|t|jd
�f}n|jddk	r/d
|t|jd�f}n|jddk	rbd|t|jd�f}n|jddk	r�d|t|jd�f}n|jddk	r�d|t|jd�f}n|jddk	r�d|t|jd�f}n|jddk	r.d|t|jd�f}n|jddk	rad|t|jd�f}n|jddk	r�d|t|jd�f}nd|}|S(Ns{"users":{"username": "%s"t	user_namet	user_passis%s,"newpasswd": "%s"tuser_accesslevels%s,"accesslevel": %stuser_portaccesss%s,"portaccess": %stuser_plugaccesss%s,"plugaccess": %stuser_groupaccesss%s,"groupaccess": %stuser_accessserials%s,"accessserial": %stuser_accesssshs%s,"accessssh": %stuser_accesswebs%s,"accessweb": %stuser_accessoutbounds%s,"accessoutbound": %stuser_accessapis%s,"accessapi": %stuser_accessmonitors%s,"accessmonitor": %stuser_callbackphones%s,"callbackphone": "%s"s%s}}(RtparamstNonetlen(t	cpmmodulet	json_load((sR/usr/lib/python2.7/site-packages/ansible/modules/remote_management/cpm/cpm_user.pyt
assemble_json�s6,            
c-C`stdtdddddgdt�dtd	d
dt�dtd	d
dt�dtd	d
dtd
t�dtd	d
dt�dtd	d
dtddd
t�dtd	ddtdddddddg�dtd	ddtdddddg�dtd	ddtdddddg�dtd	ddtdddddg�dtd	ddtdddddg�dtd	ddtdddddg�dtd	ddtdddddg�dtd	d
dtdd�dtd	d
dtdd�dtd	d
dtdd�d td	d
dtdd�d!td	d"dt�d#td	d"dt�d$td	d"dt��}td%td&d'�}td(|d)t�}|jr�|Sttjt	d*j
t|jd�t|jd��d+d,���}|jd!tkrd-}nd.}d}|jddkrVd/|t|jd�t|jd�f}d0}n|jddkr�|jddks�t
|jd�dkr�|jd1d2|�nt|�}d3|t|jd�f}d4}n�|jddkr"t|�}d3|t|jd�f}d5}nI|jddkrkd/|t|jd�t|jd�f}d6}nygt|d&|d7|d#|jd#d$|jd$d8id9d:6d;|d<6�}|d0kr�t|d%<nWntk
r}	td1d=j
|t|	��d%t�}
|j|
�n�tk
ra}	td1d>j
|t|	��d%t�}
|j|
�n�tk
r�}	td1d?j
|t|	��d%t�}
|j|
�nGtk
r�}	td1d@j
|t|	��d%t�}
|j|
�nXt|j��|d&<|j|�dS(ANt
cpm_actiontchoicestgetusertadduserteditusert
deleteusertrequiredtcpm_urlttypetstrtcpm_usernametcpm_passwordtno_logRRtdefaultRtintiiiiRRRRRRRRRRt	use_httpstbooltvalidate_certst	use_proxytchangedtdatatt
argument_spectsupports_check_modes{0}:{1}terrorstsurrogate_or_strictshttps://shttp://s$%s%s/api/v2/config/users?username=%stGETtmsgsuser_pass not defined.s%s%s/api/v2/config/userstPOSTtPUTtDELETEtmethodtheaderssapplication/jsonsContent-TypesBasic %st
Authorizations!Received HTTP error for {0} : {1}sFailed lookup url for {0} : {1}s6Error validating the servers certificate for {0} : {1}s"Error connecting to  for {0} : {1}(tdicttTruetFalseRRt
check_modeR	tbase64t	b64encodeR
tformatRRR t	fail_jsonR#RRR
RRtreadt	exit_json(tmodule_argstresulttmoduletauthtprotocoltpayloadtfullurlRCtresponseteRM((sR/usr/lib/python2.7/site-packages/ansible/modules/remote_management/cpm/cpm_user.pyt
run_module�s�!!-''''''		8	-	,		-	/''''cC`st�dS(N(RY(((sR/usr/lib/python2.7/site-packages/ansible/modules/remote_management/cpm/cpm_user.pytmainMst__main__(t
__future__RRRR,t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNRJtansible.module_utils.basicRtansible.module_utils._textR	R
Rt+ansible.module_utils.six.moves.urllib.errorRR
tansible.module_utils.urlsRRRR#RYRZt__name__(((sR/usr/lib/python2.7/site-packages/ansible/modules/remote_management/cpm/cpm_user.pyt<module>s$

r:	"	U	

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