Anons79 Mini Shell

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

�
�Udac@`ssddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
mZddl
mZy�dd
l
mZddlmZddlmZddlmZddlmZddlmZddlmZddlmZWn�ek
r�dd
lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZnXdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZ defd ��YZ!d!e"fd"��YZ#d#e"fd$��YZ$d%e"fd&��YZ%d'�Z&e'd(kroe&�nd)S(*i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	certifiedtsupported_bys,
---
module: bigip_ipsec_policy
short_description: Manage IPSec policies on a BIG-IP
description:
  - Manage IPSec policies on a BIG-IP.
version_added: 2.8
options:
  name:
    description:
      - Specifies the name of the IPSec policy.
    type: str
    required: True
  description:
    description:
      - Description of the policy
    type: str
  protocol:
    description:
      - Specifies the IPsec protocol
      - Options include ESP (Encapsulating Security Protocol) or AH (Authentication Header).
    type: str
    choices:
      - esp
      - ah
  mode:
    description:
      - Specifies the processing mode.
      - When C(transport), specifies a mode that encapsulates only the payload (adding
        an ESP header, trailer, and authentication tag).
      - When C(tunnel), specifies a mode that includes encapsulation of the header as
        well as the payload (adding a new IP header, in addition to adding an ESP header,
        trailer, and authentication tag). If you select this option, you must also
        provide IP addresses for the local and remote endpoints of the IPsec tunnel.
      - When C(isession), specifies the use of iSession over an IPsec tunnel. To use
        this option, you must also configure the iSession endpoints with IPsec in the
        Acceleration section of the user interface.
      - When C(interface), specifies that the IPsec policy can be used in the tunnel
        profile for network interfaces.
    type: str
    choices:
      - transport
      - interface
      - isession
      - tunnel
  tunnel_local_address:
    description:
      - Specifies the local endpoint IP address of the IPsec tunnel.
      - This parameter is only valid when C(mode) is C(tunnel).
    type: str
  tunnel_remote_address:
    description:
      - Specifies the remote endpoint IP address of the IPsec tunnel.
      - This parameter is only valid when C(mode) is C(tunnel).
    type: str
  encrypt_algorithm:
    description:
      - Specifies the algorithm to use for IKE encryption.
    type: str
    choices:
      - none
      - 3des
      - aes128
      - aes192
      - aes256
      - aes-gmac256
      - aes-gmac192
      - aes-gmac128
      - aes-gcm256
      - aes-gcm192
      - aes-gcm256
      - aes-gcm128
  route_domain:
    description:
      - Specifies the route domain, when C(interface) is selected for the C(mode) setting.
    type: int
  auth_algorithm:
    description:
      - Specifies the algorithm to use for IKE authentication.
    type: str
    choices:
      - sha1
      - sha256
      - sha384
      - sha512
      - aes-gcm128
      - aes-gcm192
      - aes-gcm256
      - aes-gmac128
      - aes-gmac192
      - aes-gmac256
  ipcomp:
    description:
      - Specifies whether to use IPComp encapsulation.
      - When C(none), specifies that IPComp is disabled.
      - When C(deflate), specifies that IPComp is enabled and uses the Deflate
        compression algorithm.
    type: str
    choices:
      - none
      - "null"
      - deflate
  lifetime:
    description:
      - Specifies the length of time, in minutes, before the IKE security association
        expires.
    type: int
  kb_lifetime:
    description:
      - Specifies the length of time, in kilobytes, before the IKE security association
        expires.
    type: int
  perfect_forward_secrecy:
    description:
      - Specifies the Diffie-Hellman group to use for IKE Phase 2 negotiation.
    type: str
    choices:
      - none
      - modp768
      - modp1024
      - modp1536
      - modp2048
      - modp3072
      - modp4096
      - modp6144
      - modp8192
  ipv4_interface:
    description:
      - When C(mode) is C(interface) indicate if the IPv4 C(any) address should be used.
        By default C(BIG-IP) assumes C(any6) address for tunnel addresses when C(mode) is C(interface).
      - This option takes effect only when C(mode) is set to C(interface).
    type: bool
    version_added: 2.9
  partition:
    description:
      - Device partition to manage resources on.
    type: str
    default: Common
  state:
    description:
      - When C(present), ensures that the resource exists.
      - When C(absent), ensures the resource is removed.
    type: str
    choices:
      - present
      - absent
    default: present
extends_documentation_fragment: f5
author:
  - Tim Rupp (@caphrim007)
  - Wojciech Wypior (@wojtek0806)
sw
- name: Create a IPSec policy
  bigip_ipsec_policy:
    name: policy1
    mode: tunnel
    tunnel_local_address: 1.1.1.1
    tunnel_remote_address: 2.2.2.
    auth_algorithm: sha1
    encrypt_algorithm: 3des
    protocol: esp
    perfect_forward_secrecy: modp1024
    provider:
      password: secret
      server: lb.mydomain.com
      user: admin
  delegate_to: localhost
sv
auth_algorithm:
  description: The new IKE Phase 2 Authentication Algorithm value.
  returned: changed
  type: str
  sample: sha512
encrypt_algorithm:
  description: The new IKE Phase 2 Encryption Algorithm value.
  returned: changed
  type: str
  sample: aes256
lifetime:
  description: The new IKE Phase 2 Lifetime value.
  returned: changed
  type: int
  sample: 1440
kb_lifetime:
  description: The new IKE Phase 2 KB Lifetime value.
  returned: changed
  type: int
  sample: 0
perfect_forward_secrecy:
  description: The new IKE Phase 2 Perfect Forward Secrecy value.
  returned: changed
  type: str
  sample: modp2048
tunnel_local_address:
  description: The new Tunnel Local Address value.
  returned: changed
  type: str
  sample: 1.2.2.1
tunnel_remote_address:
  description: The new Tunnel Remote Address value.
  returned: changed
  type: str
  sample: 2.1.1.2
mode:
  description: The new Mode value.
  returned: changed
  type: str
  sample: tunnel
protocol:
  description: The new IPsec Protocol value.
  returned: changed
  type: str
  sample: ah
ipcomp:
  description: The new IKE Phase 2 IPComp value.
  returned: changed
  type: str
  sample: deflate
description:
  description: The new description value.
  returned: changed
  type: str
  sample: My policy
route_domain:
  description: The new Route Domain value when in Tunnel mode.
  returned: changed
  type: int
  sample: 2
(t
AnsibleModule(tenv_fallback(tF5RestClient(t
F5ModuleError(tAnsibleF5Parameters(tfq_name(tf5_argument_spec(ttransform_name(tflatten_boolean(tcmp_str_with_nonet
ParameterscB`s�eZidd6dd6dd6dd6dd	6d
d6dd
6Zddddd	dd
ddddgZdddddd
ddddddgZdddddd
ddddddgZed��Zed��ZRS(tauth_algorithmtikePhase2AuthAlgorithmtencrypt_algorithmtikePhase2EncryptAlgorithmtlifetimetikePhase2Lifetimetkb_lifetimetikePhase2LifetimeKilobytestperfect_forward_secrecytikePhase2PerfectForwardSecrecyttunnel_local_addressttunnelLocalAddressttunnel_remote_addressttunnelRemoteAddresstmodetprotocoltipcomptdescriptiontroute_domaincC`s5|jddkrdS|jdjd�d}|S(NRt%i(t_valuestNonetsplit(tselftresult((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pyRGscC`s5|jddkrdS|jdjd�d}|S(NRR&i(R'R(R)(R*R+((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pyRNs(	t__name__t
__module__tapi_maptapi_attributestreturnablest
updatablestpropertyRR(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pyRsZ
			t
ApiParameterscB`s5eZed��Zed��Zed��ZRS(cC`s"|jddkrdS|jdS(NR$tnone(NR4(R'R((R*((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pyR$WscC`s9|jddkrdS|jddkr.dS|jdS(NRtnullR4(R'R((R*((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pyR]s
cC`s�|jddkr*|jddkr*dS|jddkr�|jddk	r�|jddkrld}q||jddkr�d}q|t|jdjd�d�}n�|jddkr,|jddk	r,|jddkr�d}q||jddkr	d}q|t|jdjd�d�}nPy$t|jdjd�d�}Wn)tk
r{|jddkrwdSdSXy2|d	kr�dSt|jdjd�d�SWntk
r�dSXdS(
NRRtany6tanyR&ii(R6sany(R6sany(R'R(tintR)t	Exception(R*R+((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pyR%es4&&		#&		#$
"
(R,R-R2R$RR%(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pyR3VstModuleParameterscB`s&eZed��Zed��ZRS(cC`s't|jd�}|dkr#tStS(Ntipv4_interfacetyes(RR'tTruetFalse(R*R+((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pyR;�scC`s9|jddkrdS|jddkr.dS|jdS(NR$R4t(snoneR?(R'R((R*((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pyR$�s
(R,R-R2R;R$(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pyR:�stChangescB`seZd�ZRS(cC`sXi}y:x$|jD]}t||�||<qW|j|�}Wntk
rSnX|S(N(R0tgetattrt_filter_paramsR9(R*R+t
returnable((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pyt	to_return�s
(R,R-RD(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pyR@�st
UsableChangescB`s5eZed��Zed��Zed��ZRS(cC`s9|jddkrdS|jddkr.dS|jdS(NRR4R5(R'R((R*((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pyR�s
cC`su|jddkrdS|jdrjt|jdjd��dkrjdj|jd|jd�}|S|jdS(NRR%R&is{0}%{1}(R'R(tlenR)tformat(R*R+((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pyR�s/ cC`su|jddkrdS|jdrjt|jdjd��dkrjdj|jd|jd�}|S|jdS(NRR%R&is{0}%{1}(R'R(RFR)RG(R*R+((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pyR�s/ (R,R-R2RRR(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pyRE�s	tReportableChangescB`seZed��ZRS(cC`s9|jddkrdS|jddkr.dS|jdS(NRR5R4(R'R((R*((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pyR�s
(R,R-R2R(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pyRH�st
DifferencecB`sDeZdd�Zd�Zd�Zed��Zed��ZRS(cC`s||_||_dS(N(twantthave(R*RJRK((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pyt__init__�s	cC`s9yt||�}|SWntk
r4|j|�SXdS(N(RAtAttributeErrort_Difference__default(R*tparamR+((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pytcompare�s

cC`sQt|j|�}y&t|j|�}||kr7|SWntk
rL|SXdS(N(RARJRKRM(R*ROtattr1tattr2((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pyt	__default�s
cC`st|jj|jj�S(N(RRJR$RK(R*((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pyR$�sc	C`s�|jjdkrdS|jj|jjkr�|jjdkrk|jjrktddddd|jj�S|jjdkr�|jjr�tddddd|jj�Stddj|jj�ddj|jj�d|jj�SndS(NiRR7RR%R6sany%{0}(RJR%R(RKR;tdictRG(R*((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pyR%�s"

N(	R,R-R(RLRPRNR2R$R%(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pyRI�s
			t
ModuleManagercB`s�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zdd�Z
d
�Zd�Zd�Zd�Zd�ZRS(cO`s^|jdd�|_t|jj�|_td|jj�|_t�|_	t
�|_dS(Ntmoduletparams(tgetR(RVR
RWtclientR:RJR3RKREtchanges(R*targstkwargs((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pyRL�s
cC`sji}xBtjD]7}t|j|�dk	rt|j|�||<qqW|rftd|�|_ndS(NRW(RR0RARJR(RERZ(R*tchangedtkey((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pyt_set_changed_optionsscC`s�t|j|j�}tj}t�}xX|D]P}|j|�}|dkrUq.q.t|t�rt|j	|�q.|||<q.W|r�t
d|�|_tSt
S(NRW(RIRJRKRR1RTRPR(t
isinstancetupdateRERZR=R>(R*tdiffR1R]tktchange((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pyt_update_changed_optionss		
cC`s|j�}|rtStS(N(ReR=R>(R*R+((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pyt
should_updatescC`s�t}t�}|jj}|dkr6|j�}n|dkrQ|j�}ntd|jj��}|j�}|j	|�|j	td|��|j
|�|S(NtpresenttabsentRWR](R>RTRJtstateRgRhRHRZRDRat_announce_deprecations(R*R]R+Rit
reportableRZ((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pytexec_module#s	

cC`sK|jdg�}x2|D]*}|jjjd|dd|d�qWdS(Nt
__warningstmsgtversion(tpopRYRVt	deprecate(R*R+twarningstwarning((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pyRj4s


cC`s$|j�r|j�S|j�SdS(N(texistsRatcreate(R*((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pyRg<s
cC`s�dj|jjd|jjdt|jj|jj��}|jjj|�}y|j	�}Wnt
k
rwtSX|jdks�d|kr�|ddkr�tSt
S(Ns2https://{0}:{1}/mgmt/tm/net/ipsec/ipsec-policy/{2}tservertserver_porti�tcode(RGRYtproviderRRJt	partitiontnametapiRXtjsont
ValueErrorR>RR=(R*turitresptresponse((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pyRtBs


+cC`s=|j�|_|j�stS|jjr/tS|j�tS(N(tread_current_from_deviceRKRfR>RVt
check_modeR=tupdate_on_device(R*((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pyRaQs
cC`s9|jjrtS|j�|j�r5td��ntS(NsFailed to delete the resource.(RVR�R=tremove_from_deviceRtR(R*((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pytremoveZs
cC`sf|jjdkr>|jjr1|jdd�q>|j�n|j�|jjrXtS|j�tS(Nt	interfacetiptipv4(	RJR!R;t_set_any_on_interfaceR_RVR�R=tcreate_on_device(R*((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pyRubs


tipv6cC`so|dkr=|jjidd6�|jjidd6�n.|jjidd6�|jjidd6�dS(NR�R7RRR6(RJRa(R*R�((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pyR�ns
cC`s�|jj�}|jj|d<|jj|d<dj|jjd|jjd�}|jjj	|d|�}y|j
�}Wn%tk
r�}tt
|���nXd|kr�|ddkr�d
|kr�t|d
��q�t|j��ndS(NR{Rzs/https://{0}:{1}/mgmt/tm/net/ipsec/ipsec-policy/RvRwR}Rxi�i�tmessage(i�i�(RZt
api_paramsRJR{RzRGRYRyR|tpostR}R~Rtstrtcontent(R*RWRR�R�tex((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pyR�vs
cC`s�|jj�}dj|jjd|jjdt|jj|jj��}|jj	j
|d|�}y|j�}Wn%tk
r�}t
t|���nXd|kr�|ddkr�d|kr�t
|d��q�t
|j��ndS(Ns2https://{0}:{1}/mgmt/tm/net/ipsec/ipsec-policy/{2}RvRwR}Rxi�R�(RZR�RGRYRyRRJRzR{R|tpatchR}R~RR�R�(R*RWRR�R�R�((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pyR��s

cC`s|j�r|j�StS(N(RtR�R>(R*((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pyRh�s
cC`sjdj|jjd|jjdt|jj|jj��}|jjj|�}|j	dkrft
SdS(Ns2https://{0}:{1}/mgmt/tm/net/ipsec/ipsec-policy/{2}RvRwi�(RGRYRyRRJRzR{R|tdeleteRR=(R*RR�((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pyR��s

cC`s�dj|jjd|jjdt|jj|jj��}|jjj|�}y|j	�}Wn%t
k
r�}tt|���nXd|kr�|ddkr�d|kr�t|d��q�t|j
��ntd|�S(Ns2https://{0}:{1}/mgmt/tm/net/ipsec/ipsec-policy/{2}RvRwRxi�R�RW(RGRYRyRRJRzR{R|RXR}R~RR�R�R3(R*RR�R�R�((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pyR��s

(R,R-RLR_ReRfRlRjRgRtRaR�RuR�R�R�RhR�R�(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pyRU�s"																
tArgumentSpeccB`seZd�ZRS(c'C`s�t|_tdtdt�dt�dtdddg�dtdd	d
ddg�d
tdd�dt�dt�dtdddddddddddddg�dtdd�d tdd!d"d#d$ddddddg
�d%tddd&d'g�d(tdd�d)tdd�d*tddd+d,d-d.d/d0d1d2g	�d3td4d5dd6d5g�d7td4d8d9td:gf��}i|_|jjt�|jj|�ddddggdd
dggg|_dS(;NR{trequiredR$R"tchoicestesptahR!t	transportR�tisessionttunnelR;ttypetboolRRRR4t3destaes128taes192taes256saes-gmac256saes-gmac192saes-gmac128s
aes-gcm256s
aes-gcm192s
aes-gcm128R%R8Rtsha1tsha256tsha384tsha512R#R5tdeflateRRRtmodp768tmodp1024tmodp1536tmodp2048tmodp3072tmodp4096tmodp6144tmodp8192RitdefaultRgRhRztCommontfallbacktF5_PARTITION(R=tsupports_check_modeRTR	t
argument_specRaRtrequired_if(R*R�((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pyRL�sH					(R,R-RL(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pyR��scC`s�t�}td|jd|jd|j�}y,td|�}|j�}|j|�Wn)tk
r�}|j	dt
|��nXdS(NR�R�R�RVRn(R�RR�R�R�RURlt	exit_jsonRt	fail_jsonR�(tspecRVtmmtresultsR�((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pytmain�s			t__main__N((t
__future__RRRR�t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNtansible.module_utils.basicRR	t%library.module_utils.network.f5.bigipR
t&library.module_utils.network.f5.commonRRR
RRRt'library.module_utils.network.f5.compareRtImportErrort%ansible.module_utils.network.f5.bigipt&ansible.module_utils.network.f5.commont'ansible.module_utils.network.f5.compareRR3R:R@RERHtobjectRIRUR�R�R,(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ipsec_policy.pyt<module>sN


�?
F0
2�8	

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