Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/network/netscaler/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/network/netscaler/netscaler_ssl_certkey.pyc

�
�Udac@`sddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	y*ddl
mZddlm
Z
eZWnek
r�ZeZnXdd
lmZddlmZmZmZmZmZmZd�Zd�Zd�Zd�Ze dkre�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys#

---
module: netscaler_ssl_certkey
short_description: Manage ssl certificate keys.
description:
    - Manage ssl certificate keys.

version_added: "2.4.0"

author: George Nikolopoulos (@giorgos-nikolopoulos)

options:

    certkey:
        description:
            - >-
                Name for the certificate and private-key pair. Must begin with an ASCII alphanumeric or underscore
                C(_) character, and must contain only ASCII alphanumeric, underscore C(_), hash C(#), period C(.), space C( ),
                colon C(:), at C(@), equals C(=), and hyphen C(-) characters. Cannot be changed after the certificate-key
                pair is created.
            - "The following requirement applies only to the NetScaler CLI:"
            - >-
                If the name includes one or more spaces, enclose the name in double or single quotation marks (for
                example, "my cert" or 'my cert').
            - "Minimum length = 1"

    cert:
        description:
            - >-
                Name of and, optionally, path to the X509 certificate file that is used to form the certificate-key
                pair. The certificate file should be present on the appliance's hard-disk drive or solid-state drive.
                Storing a certificate in any location other than the default might cause inconsistency in a high
                availability setup. /nsconfig/ssl/ is the default path.
            - "Minimum length = 1"

    key:
        description:
            - >-
                Name of and, optionally, path to the private-key file that is used to form the certificate-key pair.
                The certificate file should be present on the appliance's hard-disk drive or solid-state drive.
                Storing a certificate in any location other than the default might cause inconsistency in a high
                availability setup. /nsconfig/ssl/ is the default path.
            - "Minimum length = 1"

    password:
        description:
            - >-
                Passphrase that was used to encrypt the private-key. Use this option to load encrypted private-keys
                in PEM format.

    inform:
        choices:
            - 'DER'
            - 'PEM'
            - 'PFX'
        description:
            - >-
                Input format of the certificate and the private-key files. The three formats supported by the
                appliance are:
            - "PEM - Privacy Enhanced Mail"
            - "DER - Distinguished Encoding Rule"
            - "PFX - Personal Information Exchange."

    passplain:
        description:
            - >-
                Pass phrase used to encrypt the private-key. Required when adding an encrypted private-key in PEM
                format.
            - "Minimum length = 1"

    expirymonitor:
        choices:
            - 'enabled'
            - 'disabled'
        description:
            - "Issue an alert when the certificate is about to expire."

    notificationperiod:
        description:
            - >-
                Time, in number of days, before certificate expiration, at which to generate an alert that the
                certificate is about to expire.
            - "Minimum value = C(10)"
            - "Maximum value = C(100)"


extends_documentation_fragment: netscaler
requirements:
    - nitro python sdk
sL

- name: Setup ssl certkey
  delegate_to: localhost
  netscaler_ssl_certkey:
    nitro_user: nsroot
    nitro_pass: nsroot
    nsip: 172.18.0.2

    certkey: certirificate_1
    cert: server.crt
    key: server.key
    expirymonitor: enabled
    notificationperiod: 30
    inform: PEM
    password: False
    passplain: somesecret
s
loglines:
    description: list of logged messages by the module
    returned: always
    type: list
    sample: "['message 1', 'message 2']"

msg:
    description: Message detailing the failure reason
    returned: failure
    type: str
    sample: "Action does not exist"

diff:
    description: List of differences between the actual configured object and the configuration specified in the module
    returned: failure
    type: dict
    sample: "{ 'targetlbvserver': 'difference. ours: (str) server1 other: (str) server2' }"
(t
sslcertkey(tnitro_exception(t
AnsibleModule(tConfigProxytget_nitro_clienttnetscaler_common_argumentstlogtloglinestget_immutables_intersectioncC`sitd�td|jd�tj|�}g|D]}|j^q5}|jd|kratStSdS(NsChecking if key existss
certkey is %stcertkey(RtparamsRtgetRtTruetFalse(tclienttmoduletall_certificatestitemtcertkeys((s[/usr/lib/python2.7/site-packages/ansible/modules/network/netscaler/netscaler_ssl_certkey.pyt
key_exists�s
cC`s�td�tj|d|jd�}|j|d�}d|krP|d=nd|krf|d=nt|�dkr|tStSdS(Ns'Checking if configured key is identicals
certkey:%sRitpasswordt	passplain(RRtget_filteredRtdiff_objecttlenRR(RRtsslcertkey_proxytsslcertkey_listt	diff_dict((s[/usr/lib/python2.7/site-packages/ansible/modules/network/netscaler/netscaler_ssl_certkey.pyt
key_identical�s


cC`s.tj|d|jd�}|j|d�S(Ns
certkey:%sRi(RRRR(RRR!R"((s[/usr/lib/python2.7/site-packages/ansible/modules/network/netscaler/netscaler_ssl_certkey.pyt	diff_list�sc
C`sdtdtdd�dtdd�dtdd�dtdd�dtddd	d
ddg�d
tdddt�dtddd	ddg�dtdd��}t�}|jt�|j|�td|dt�}tdtdtdt�}ts|jdd�nt	|�}y|j
�Wn�tk
ri}dt|j
�|jf}|jd|�n�tk
r�}tt|��dkr�|jddt|��qtt|��dkr�|jddt|��q|jdd t|��nXdddddd
ddg}d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0g}dddddd
g}	id1�gd6}
td2t�d3|d4|jd5|d6|d7|	d8|
�}yL|jd9d:krUtd;�t||�s.|js!td<�|j�|jd=r!|j�q!nt|d<n�t|||�s�t|t|||�j��}|gkr�|jdd>|fd?t|||�|�n|js�|j�|jd=r�|j�q�nt|d<n
t|d<|jstd@�t||�s|jddA�nt|||�sR|jddBd?t|||��qRqn�|jd9dCkrtdD�t||�r�|js�|j�|jd=r�|j�q�nt|d<n
t|d<|jstdE�t||�r|jddF�qqnWnBtk
rH}dGt|j
�|jf}|jd||�nX|j�|j|�dS(HNRttypetstrtcerttkeyRtbooltinformtchoicestDERtPEMtPFXRtno_logt
expirymonitortenabledtdisabledtnotificationperiodtfloatt
argument_spectsupports_check_modetchangedtfailedRtmsgsCould not load nitro python sdks6nitro exception during login. errorcode=%s, message=%ss-<class 'requests.exceptions.ConnectionError'>sConnection error %ss&<class 'requests.exceptions.SSLError'>sSSL Error %ss Unexpected error during login %stsignaturealgtcertificatetypetserialtissuertclientcertnotbeforetclientcertnotaftertdaystoexpirationtsubjectt	publickeyt
publickeysizetversiontpriorityRt	passcrypttdatatservicenamecS`s
|j�S(N(tupper(tv((s[/usr/lib/python2.7/site-packages/ansible/modules/network/netscaler/netscaler_ssl_certkey.pyt<lambda>%stactualRtattribute_values_dicttreadwrite_attrstreadonly_attrstimmutable_attrst
transformststatetpresents"Applying actions for state presentsAdding certificate keytsave_configs%Cannot update immutable attributes %stdiffsSanity checks for state presentsSSL certkey does not exists#SSL certkey differs from configuredtabsents!Applying actions for state absentsSanity checks for state absentsSSL certkey still existss(nitro exception errorcode=%s, message=%s( tdictRtupdateR
R
RRtPYTHON_SDK_IMPORTEDt	fail_jsonRtloginR	R't	errorcodetmessaget	ExceptionR&RRRRRt
check_modetaddRUR$RR%tkeystdeletetlogoutt	exit_json(
tmodule_specific_argumentsR6Rt
module_resultRteR:RORPRQRRR!timmutables_changed((s[/usr/lib/python2.7/site-packages/ansible/modules/network/netscaler/netscaler_ssl_certkey.pytmain�s		

								
	



!	

	



	
+
	



	

t__main__N(!t
__future__RRRR&t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNt?nssrc.com.citrix.netscaler.nitro.resource.config.ssl.sslcertkeyRt:nssrc.com.citrix.netscaler.nitro.exception.nitro_exceptionR	RRZtImportErrorRhRtansible.module_utils.basicR
t0ansible.module_utils.network.netscaler.netscalerRRR
RRRRR$R%Rjt__name__(((s[/usr/lib/python2.7/site-packages/ansible/modules/network/netscaler/netscaler_ssl_certkey.pyt<module>s*


\

.				�

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