Anons79 Mini Shell

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

�
�Udac#@`sKddlmZmZmZeZidgd6dd6dd6ZdZd	Zd
Z	ddl
mZddl
mZydd
l
mZeZWnek
r�eZnXdZdZdZdZdZdZdZdZdZdZededededgf�dedededgf�dedededgfd ed!d"�d#ededed$gfd%dH�d&ededed'd(gfd%ed!d)�d*ededed+gfd%ed!d)�d,ededed-gfd%d.d!d/�d0ededed1d2gfd%ed!d)d3d4g�d5ededed6gfd%d7d!d/�d8ededed9gfd%d:d!d/�d;eded!d<�d=eded%ed!d)�d>eded%ed!d)�d?eded%ed!d)��Zd@e fdA��YZ!dBe!fdC��YZ"dDe#fdE��YZ$dF�Z%e&dGkrGe%�ndHS(Ii(tabsolute_importtdivisiontprint_functiontpreviewtstatust	communitytsupported_bys1.1tmetadata_versions�
module: vdirect_commit
author: Evgeny Fedoruk @ Radware LTD (@evgenyfedoruk)
short_description: Commits pending configuration changes on Radware devices
description:
    - Commits pending configuration changes on one or more Radware devices via vDirect server.
    - For Alteon ADC device, apply, sync and save actions will be performed by default.
      Skipping of an action is possible by explicit parameter specifying.
    - For Alteon VX Container device, no sync operation will be performed
      since sync action is only relevant for Alteon ADC devices.
    - For DefensePro and AppWall devices, a bulk commit action will be performed.
      Explicit apply, sync and save actions specifying is not relevant.
notes:
    - Requires the Radware vdirect-client Python package on the host. This is as easy as
      C(pip install vdirect-client)
version_added: "2.5"
options:
  vdirect_ip:
    description:
     - Primary vDirect server IP address, may be set as C(VDIRECT_IP) environment variable.
    required: true
  vdirect_user:
    description:
     - vDirect server username, may be set as C(VDIRECT_USER) environment variable.
    required: true
  vdirect_password:
    description:
     - vDirect server password, may be set as C(VDIRECT_PASSWORD) environment variable.
    required: true
  vdirect_secondary_ip:
    description:
     - Secondary vDirect server IP address, may be set as C(VDIRECT_SECONDARY_IP) environment variable.
  vdirect_wait:
    description:
     - Wait for async operation to complete, may be set as C(VDIRECT_WAIT) environment variable.
    type: bool
    default: 'yes'
  vdirect_https_port:
    description:
     - vDirect server HTTPS port number, may be set as C(VDIRECT_HTTPS_PORT) environment variable.
    default: 2189
  vdirect_http_port:
    description:
     - vDirect server HTTP port number, may be set as C(VDIRECT_HTTP_PORT) environment variable.
    default: 2188
  vdirect_timeout:
    description:
     - Amount of time to wait for async operation completion [seconds],
     - may be set as C(VDIRECT_TIMEOUT) environment variable.
    default: 60
  vdirect_use_ssl:
    description:
     - If C(no), an HTTP connection will be used instead of the default HTTPS connection,
     - may be set as C(VDIRECT_HTTPS) or C(VDIRECT_USE_SSL) environment variable.
    type: bool
    default: 'yes'
  validate_certs:
    description:
     - If C(no), SSL certificates will not be validated,
     - may be set as C(VDIRECT_VALIDATE_CERTS) or C(VDIRECT_VERIFY) environment variable.
     - This should only set to C(no) used on personally controlled sites using self-signed certificates.
    type: bool
    default: 'yes'
    aliases: [ vdirect_validate_certs ]
  devices:
    description:
     - List of Radware Alteon device names for commit operations.
    required: true
  apply:
    description:
     - If C(no), apply action will not be performed. Relevant for ADC devices only.
    type: bool
    default: 'yes'
  save:
    description:
     - If C(no), save action will not be performed. Relevant for ADC devices only.
    type: bool
    default: 'yes'
  sync:
    description:
     - If C(no), sync action will not be performed. Relevant for ADC devices only.
    type: bool
    default: 'yes'

requirements:
  - "vdirect-client >= 4.1.1"
s�
- name: vdirect_commit
  vdirect_commit:
      vdirect_ip: 10.10.10.10
      vdirect_user: vDirect
      vdirect_password: radware
      devices: ['dev1', 'dev2']
      sync: no
s�
result:
    description: Message detailing actions result
    returned: success
    type: str
    sample: "Requested actions were successfully performed on all devices."
(t
AnsibleModule(tenv_fallback(trest_clients=Requested actions were successfully performed on all devices.sKFailure occurred while performing requested actions on devices. See detailstAdct	ContainertAlteonPartitionedtAppWallt
DefenseProt	succeededtfaileds
not performedt
vdirect_iptrequiredtfallbackt
VDIRECT_IPtvdirect_usertVDIRECT_USERtvdirect_passwordtVDIRECT_PASSWORDtno_logttypetstrtvdirect_secondary_iptVDIRECT_SECONDARY_IPtdefaulttvdirect_use_sslt
VDIRECT_HTTPStVDIRECT_USE_SSLtbooltvdirect_waittVDIRECT_WAITtvdirect_timeouttVDIRECT_TIMEOUTi<tinttvalidate_certstVDIRECT_VERIFYtVDIRECT_VALIDATE_CERTStaliasestvdirect_validate_certstvdirect_https_porttVDIRECT_HTTPS_PORTi�tvdirect_http_porttVDIRECT_HTTP_PORTi�tdevicestlisttapplytsavetsynctCommitExceptioncB`seZd�Zd�ZRS(cC`s||_||_dS(N(treasontdetails(tselfR8R9((sR/usr/lib/python2.7/site-packages/ansible/modules/network/radware/vdirect_commit.pyt__init__�s	cC`sdj|j|j�S(NsReason: {0}. Details:{1}.(tformatR8R9(R:((sR/usr/lib/python2.7/site-packages/ansible/modules/network/radware/vdirect_commit.pyt__str__�s(t__name__t
__module__R;R=(((sR/usr/lib/python2.7/site-packages/ansible/modules/network/radware/vdirect_commit.pyR7�s	tMissingDeviceExceptioncB`seZd�ZRS(cC`s+tt|�jddt|�d�dS(NsDevice missingsDevice s does not exist(tsuperR@R;trepr(R:tdevice_name((sR/usr/lib/python2.7/site-packages/ansible/modules/network/radware/vdirect_commit.pyR;�s(R>R?R;(((sR/usr/lib/python2.7/site-packages/ansible/modules/network/radware/vdirect_commit.pyR@�st
VdirectCommitcB`s,eZd�Zd�Zd�Zd�ZRS(cC`s�tj|d|d|dd|dd|dd|d	d
|dd|d
d|dd|d�|_|d|_|d|_|d|_|d|_i|_dS(NRRRtwaitR$tsecondary_vdirect_ipRt
https_portR.t	http_portR0ttimeoutR&thttpsR tverifyR)R2R4R5R6(R
t
RestClienttclientR2R4R5R6t
devicesMap(R:tparams((sR/usr/lib/python2.7/site-packages/ansible/modules/network/radware/vdirect_commit.pyR;�s











cC`s�x~|jD]s}y2|jjj|�}|tjdkrX|jjit|6�w
n|jj	j|�}|tjdkr�|tj
dtkr�|jjit|6�nw
n|jj
j|�}|tjdkr�|jjit|6�w
n|jjj|�}|tjdkrA|jjit|6�w
nWn,tk
rp}td|t|���nXt|��q
WdS(Ni�Rs"Failed to communicate with device (R2RMtadctgetR
tRESP_STATUSRNtupdatetADC_DEVICE_TYPEt	containert	RESP_DATAt!PARTITIONED_CONTAINER_DEVICE_TYPEtCONTAINER_DEVICE_TYPEtappWalltAPPWALL_DEVICE_TYPEt
defenseProtDP_DEVICE_TYPEt	ExceptionR7RR@(R:tdevicetreste((sR/usr/lib/python2.7/site-packages/ansible/modules/network/radware/vdirect_commit.pyt_validate_devices�s,
cC`sW|s
|rt||<tSy�|j|tkrL|jjj||�}n�|j|tkrz|jjj	||�}n\|j|t
kr�|jjj||�}n.|j|tkr�|jj
j||�}n|tjdkr�t||<nt||<|tj|d<tSWn:tk
rR}t||<d|dt|�|d<tSXtS(Ni�i�tfailure_descriptions$Exception occurred while performing s action. Exception: (i�i�(t
NOT_PERFORMEDtTrueRNRTRMRPtcontrol_deviceRXRUtcontrolRZRYR\R[R
RRt	SUCCEEDEDtFAILEDtRESP_STRtFalseR]R(R:R^tactiontperformtfailure_occurredtactions_resultR_R`((sR/usr/lib/python2.7/site-packages/ansible/modules/network/radware/vdirect_commit.pyt!_perform_action_and_update_results,




c	C`s]|j�t�}t�|d<x|jD]}t}|j|}t�}||d<||d<|ttgkr�|j|dt	||�p�|}n~|j|d|j
||�p�|}|tkr�|j|d|j||�p�|}n|j|d|j
||�p|}|dj|g�|r*t|d<q*q*Wd|krYt|d<n|S(	NR9RCtdevice_typetcommitR4R6R5tmsg(RatdictR3R2RjRNR\RZRoRdR4RXR6R5textendtFAILUREtSUCCESS(R:tresult_to_returnR^RmRpRn((sR/usr/lib/python2.7/site-packages/ansible/modules/network/radware/vdirect_commit.pyRqs:
	

	

		
(R>R?R;RaRoRq(((sR/usr/lib/python2.7/site-packages/ansible/modules/network/radware/vdirect_commit.pyRD�s			cC`s�tdt�}ts(|jdd�ny;t|j�}|j�}td|�}|j|�Wn)t	k
r�}|jdt
|��nXdS(Nt
argument_specRrs,The python vdirect-client module is requiredtresult(Rt	meta_argstHAS_REST_CLIENTt	fail_jsonRDRORqRst	exit_jsonR]R(tmoduletvdirect_commitRyR`((sR/usr/lib/python2.7/site-packages/ansible/modules/network/radware/vdirect_commit.pytmainFst__main__N('t
__future__RRRRt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNtansible.module_utils.basicRR	tvdirect_clientR
RdR{tImportErrorRjRvRuRTRXRWRZR\RgRhRcRstNoneRzR]R7R@tobjectRDR�R>(((sR/usr/lib/python2.7/site-packages/ansible/modules/network/radware/vdirect_commit.pyt<module>s�

X



		r	

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