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_asm_policy.pyc

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlZddlm
Z
dd
lmZddlmZy�ddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZWn�ek
r�ddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZnXdefd��YZ de fd��YZ!de fd��YZ"de fd��YZ#de$fd ��YZ%d!e$fd"��YZ&d#e$fd$��YZ'd%e&fd&��YZ(d'e&fd(��YZ)d)e$fd*��YZ*d+�Z+e,d,kr�e+�ndS(-i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiont
deprecatedtstatust	certifiedtsupported_bys�

---
module: bigip_asm_policy
short_description: Manage BIG-IP ASM policies
description:
   - Manage BIG-IP ASM policies.
version_added: 2.5
deprecated:
  removed_in: '2.12'
  alternative: bigip_asm_policy_manage
  why: >
    The bigip_asm_policy module has been split into three new modules to handle import, export and general policy
    management. This will allow scalability of the asm policy management as well as ease of maintenance.
    Additionally to further reduce the burden of having multiple smaller module F5 has created asm_policy
    role in Ansible Galaxy for a more declarative way of ASM policy management.
options:
  active:
    description:
      - If C(yes) will apply and activate existing inactive policy. If C(no), it will
        deactivate existing active policy. Generally should be C(yes) only in cases where
        you want to activate new or existing policy.
    default: no
    type: bool
  name:
    description:
      - The ASM policy to manage or create.
    required: True
  state:
    description:
      - When C(state) is C(present), and C(file) or C(template) parameter is provided,
        new ASM policy is imported and created with the given C(name).
      - When C(state) is present and no C(file) or C(template) parameter is provided
        new blank ASM policy is created with the given C(name).
      - When C(state) is C(absent), ensures that the policy is removed, even if it is
        currently active.
    choices:
      - present
      - absent
    default: present
  file:
    description:
      - Full path to a policy file to be imported into the BIG-IP ASM.
      - Policy files exported from newer versions of BIG-IP cannot be imported into older
        versions of BIG-IP. The opposite, however, is true; you can import older into
        newer.
  template:
    description:
      - An ASM policy built-in template. If the template does not exist we will raise an error.
      - Once the policy has been created, this value cannot change.
      - The C(Comprehensive), C(Drupal), C(Fundamental), C(Joomla),
        C(Vulnerability Assessment Baseline), and C(Wordpress) templates are only available
        on BIG-IP versions >= 13.
    choices:
      - ActiveSync v1.0 v2.0 (http)
      - ActiveSync v1.0 v2.0 (https)
      - Comprehensive
      - Drupal
      - Fundamental
      - Joomla
      - LotusDomino 6.5 (http)
      - LotusDomino 6.5 (https)
      - OWA Exchange 2003 (http)
      - OWA Exchange 2003 (https)
      - OWA Exchange 2003 with ActiveSync (http)
      - OWA Exchange 2003 with ActiveSync (https)
      - OWA Exchange 2007 (http)
      - OWA Exchange 2007 (https)
      - OWA Exchange 2007 with ActiveSync (http)
      - OWA Exchange 2007 with ActiveSync (https)
      - OWA Exchange 2010 (http)
      - OWA Exchange 2010 (https)
      - Oracle 10g Portal (http)
      - Oracle 10g Portal (https)
      - Oracle Applications 11i (http)
      - Oracle Applications 11i (https)
      - PeopleSoft Portal 9 (http)
      - PeopleSoft Portal 9 (https)
      - Rapid Deployment Policy
      - SAP NetWeaver 7 (http)
      - SAP NetWeaver 7 (https)
      - SharePoint 2003 (http)
      - SharePoint 2003 (https)
      - SharePoint 2007 (http)
      - SharePoint 2007 (https)
      - SharePoint 2010 (http)
      - SharePoint 2010 (https)
      - Vulnerability Assessment Baseline
      - Wordpress
  partition:
    description:
      - Device partition to manage resources on.
    default: Common
extends_documentation_fragment: f5
author:
  - Wojciech Wypior (@wojtek0806)
  - Tim Rupp (@caphrim007)
s�
- name: Import and activate ASM policy
  bigip_asm_policy:
    name: new_asm_policy
    file: /root/asm_policy.xml
    active: yes
    state: present
    provider:
      server: lb.mydomain.com
      user: admin
      password: secret
  delegate_to: localhost

- name: Import ASM policy from template
  bigip_asm_policy:
    name: new_sharepoint_policy
    template: SharePoint 2007 (http)
    state: present
    provider:
      server: lb.mydomain.com
      user: admin
      password: secret
  delegate_to: localhost

- name: Create blank ASM policy
  bigip_asm_policy:
    name: new_blank_policy
    state: present
    provider:
      server: lb.mydomain.com
      user: admin
      password: secret
  delegate_to: localhost

- name: Create blank ASM policy and activate
  bigip_asm_policy:
    name: new_blank_policy
    active: yes
    state: present
    provider:
      server: lb.mydomain.com
      user: admin
      password: secret
  delegate_to: localhost

- name: Activate ASM policy
  bigip_asm_policy:
    name: inactive_policy
    active: yes
    state: present
    provider:
      server: lb.mydomain.com
      user: admin
      password: secret
  delegate_to: localhost

- name: Deactivate ASM policy
  bigip_asm_policy:
    name: active_policy
    state: present
    provider:
      server: lb.mydomain.com
      user: admin
      password: secret
  delegate_to: localhost

- name: Import and activate ASM policy in Role
  bigip_asm_policy:
    name: new_asm_policy
    file: "{{ role_path }}/files/asm_policy.xml"
    active: yes
    state: present
    provider:
      server: lb.mydomain.com
      user: admin
      password: secret
  delegate_to: localhost

- name: Import ASM binary policy
  bigip_asm_policy:
    name: new_asm_policy
    file: "/root/asm_policy.plc"
    active: yes
    state: present
    provider:
      server: lb.mydomain.com
      user: admin
      password: secret
  delegate_to: localhost
s\
active:
  description: Set when activating/deactivating ASM policy
  returned: changed
  type: bool
  sample: yes
state:
  description: Action performed on the target device.
  returned: changed
  type: str
  sample: absent
file:
  description: Local path to ASM policy file.
  returned: changed
  type: str
  sample: /root/some_policy.xml
template:
  description: Name of the built-in ASM policy template
  returned: changed
  type: str
  sample: OWA Exchange 2007 (https)
name:
  description: Name of the ASM policy to be managed/created
  returned: changed
  type: str
  sample: Asm_APP1_Transparent
N(t
AnsibleModule(tenv_fallback(tLooseVersion(tF5RestClient(t
F5ModuleError(tAnsibleF5Parameters(tfq_name(tf5_argument_spec(tupload_file(ttmos_version(tmodule_provisionedt
ParameterscB`soeZdgZddddgZdddgZidd6Zed��Zed��Zd�Z	d�Z
RS(	tactivetnamettemplatetfiletfilenamecC`sm|jddk	r|jdS|j�}x<|dD]0}|d|jj�kr5td|d�Sq5WdS(Nt
template_linktitemsRtlinktselfLink(t_valuestNonet_templates_from_deviceRtuppertdict(tselft
collectiontresource((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyRscC`s
t|j�S(N(RR(R"((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyt	full_path#scC`s�dj|jjd|jjd�}|jjj|�}y|j�}Wn%tk
rr}tt|���nXd|kr�|ddkr�d|kr�t|d��q�t|j	��n|S(Ns-https://{0}:{1}/mgmt/tm/asm/policy-templates/tservertserver_porttcodei�tmessage(
tformattclienttprovidertapitgettjsont
ValueErrorRtstrtcontent(R"turitresptresponsetex((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyR's
cC`s@i}x$|jD]}t||�||<qW|j|�}|S(N(treturnablestgetattrt_filter_params(R"tresultt
returnable((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyt	to_return:s
(t__name__t
__module__t
updatablesR7tapi_attributestapi_maptpropertyRR%RR<(((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyRs			

	tV1ParameterscB`seZed��ZRS(cC`s|jddkrdSidd6dd6dd6dd	6d
d6dd
6dd6dd6dd6dd6dd6dd6dd6dd6dd6d d!6d"d#6d$d%6d&d'6d(d)6d*d+6d,d-6d.d/6d0d16d2d36d4d56d6d76d8d96d:d;6}|jd|kr
||jdStd<��dS(=NRt)POLICY_TEMPLATE_ACTIVESYNC_V1_0_V2_0_HTTPsActiveSync v1.0 v2.0 (http)t*POLICY_TEMPLATE_ACTIVESYNC_V1_0_V2_0_HTTPSsActiveSync v1.0 v2.0 (https)t$POLICY_TEMPLATE_LOTUSDOMINO_6_5_HTTPsLotusDomino 6.5 (http)t%POLICY_TEMPLATE_LOTUSDOMINO_6_5_HTTPSsLotusDomino 6.5 (https)t&POLICY_TEMPLATE_OWA_EXCHANGE_2003_HTTPsOWA Exchange 2003 (http)t'POLICY_TEMPLATE_OWA_EXCHANGE_2003_HTTPSsOWA Exchange 2003 (https)t6POLICY_TEMPLATE_OWA_EXCHANGE_2003_WITH_ACTIVESYNC_HTTPs(OWA Exchange 2003 with ActiveSync (http)t7POLICY_TEMPLATE_OWA_EXCHANGE_2003_WITH_ACTIVESYNC_HTTPSs)OWA Exchange 2003 with ActiveSync (https)t&POLICY_TEMPLATE_OWA_EXCHANGE_2007_HTTPsOWA Exchange 2007 (http)t'POLICY_TEMPLATE_OWA_EXCHANGE_2007_HTTPSsOWA Exchange 2007 (https)t6POLICY_TEMPLATE_OWA_EXCHANGE_2007_WITH_ACTIVESYNC_HTTPs(OWA Exchange 2007 with ActiveSync (http)t7POLICY_TEMPLATE_OWA_EXCHANGE_2007_WITH_ACTIVESYNC_HTTPSs)OWA Exchange 2007 with ActiveSync (https)t&POLICY_TEMPLATE_OWA_EXCHANGE_2010_HTTPsOWA Exchange 2010 (http)t'POLICY_TEMPLATE_OWA_EXCHANGE_2010_HTTPSsOWA Exchange 2010 (https)t&POLICY_TEMPLATE_ORACLE_10G_PORTAL_HTTPsOracle 10g Portal (http)t'POLICY_TEMPLATE_ORACLE_10G_PORTAL_HTTPSsOracle 10g Portal (https)t,POLICY_TEMPLATE_ORACLE_APPLICATIONS_11I_HTTPsOracle Applications 11i (http)t-POLICY_TEMPLATE_ORACLE_APPLICATIONS_11I_HTTPSsOracle Applications 11i (https)t(POLICY_TEMPLATE_PEOPLESOFT_PORTAL_9_HTTPsPeopleSoft Portal 9 (http)t)POLICY_TEMPLATE_PEOPLESOFT_PORTAL_9_HTTPSsPeopleSoft Portal 9 (https)t POLICY_TEMPLATE_RAPID_DEPLOYMENTsRapid Deployment Policyt$POLICY_TEMPLATE_SAP_NETWEAVER_7_HTTPsSAP NetWeaver 7 (http)t%POLICY_TEMPLATE_SAP_NETWEAVER_7_HTTPSsSAP NetWeaver 7 (https)t$POLICY_TEMPLATE_SHAREPOINT_2003_HTTPsSharePoint 2003 (http)t%POLICY_TEMPLATE_SHAREPOINT_2003_HTTPSsSharePoint 2003 (https)t$POLICY_TEMPLATE_SHAREPOINT_2007_HTTPsSharePoint 2007 (http)t%POLICY_TEMPLATE_SHAREPOINT_2007_HTTPSsSharePoint 2007 (https)t$POLICY_TEMPLATE_SHAREPOINT_2010_HTTPsSharePoint 2010 (http)t%POLICY_TEMPLATE_SHAREPOINT_2010_HTTPSsSharePoint 2010 (https)s?The specified template is not valid for this version of BIG-IP.(RRR(R"ttemplate_map((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyRCsH
(R=R>RBR(((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyRCBstV2ParameterscB`seZed��ZRS(cC`s!|jddkrdSi#dd6dd6dd6dd	6d
d6dd
6dd6dd6dd6dd6dd6dd6dd6dd6dd6d d!6d"d#6d$d%6d&d'6d(d)6d*d+6d,d-6d.d/6d0d16d2d36d4d56d6d76d8d96d:d;6d<d=6d>d?6d@dA6dBdC6dDdE6dFdG6}||jdS(HNRRDsActiveSync v1.0 v2.0 (http)REsActiveSync v1.0 v2.0 (https)tPOLICY_TEMPLATE_COMPREHENSIVEt
ComprehensivetPOLICY_TEMPLATE_DRUPALtDrupaltPOLICY_TEMPLATE_FUNDAMENTALtFundamentaltPOLICY_TEMPLATE_JOOMLAtJoomlaRFsLotusDomino 6.5 (http)RGsLotusDomino 6.5 (https)RHsOWA Exchange 2003 (http)RIsOWA Exchange 2003 (https)RJs(OWA Exchange 2003 with ActiveSync (http)RKs)OWA Exchange 2003 with ActiveSync (https)RLsOWA Exchange 2007 (http)RMsOWA Exchange 2007 (https)RNs(OWA Exchange 2007 with ActiveSync (http)ROs)OWA Exchange 2007 with ActiveSync (https)RPsOWA Exchange 2010 (http)RQsOWA Exchange 2010 (https)RRsOracle 10g Portal (http)RSsOracle 10g Portal (https)RTsOracle Applications 11i (http)RUsOracle Applications 11i (https)RVsPeopleSoft Portal 9 (http)RWsPeopleSoft Portal 9 (https)RXsRapid Deployment PolicyRYsSAP NetWeaver 7 (http)RZsSAP NetWeaver 7 (https)R[sSharePoint 2003 (http)R\sSharePoint 2003 (https)R]sSharePoint 2007 (http)R^sSharePoint 2007 (https)R_sSharePoint 2010 (http)R`sSharePoint 2010 (https)t(POLICY_TEMPLATE_VULNERABILITY_ASSESSMENTs!Vulnerability Assessment BaselinetPOLICY_TEMPLATE_WORDPRESSt	Wordpress(RR(R"Ra((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyRosN
(R=R>RBR(((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyRbnstChangescB`seZed��ZRS(cC`s!|jddkrdSi#dd6dd6dd6dd	6d
d6dd
6dd6dd6dd6dd6dd6dd6dd6dd6dd6d d!6d"d#6d$d%6d&d'6d(d)6d*d+6d,d-6d.d/6d0d16d2d36d4d56d6d76d8d96d:d;6d<d=6d>d?6d@dA6dBdC6dDdE6dFdG6}||jdS(HNRsActiveSync v1.0 v2.0 (http)RDsActiveSync v1.0 v2.0 (https)RERdRcRfReRhRgRjRisLotusDomino 6.5 (http)RFsLotusDomino 6.5 (https)RGsOWA Exchange 2003 (http)RHsOWA Exchange 2003 (https)RIs(OWA Exchange 2003 with ActiveSync (http)RJs)OWA Exchange 2003 with ActiveSync (https)RKsOWA Exchange 2007 (http)RLsOWA Exchange 2007 (https)RMs(OWA Exchange 2007 with ActiveSync (http)RNs)OWA Exchange 2007 with ActiveSync (https)ROsOWA Exchange 2010 (http)RPsOWA Exchange 2010 (https)RQsOracle 10g Portal (http)RRsOracle 10g Portal (https)RSsOracle Applications 11i (http)RTsOracle Applications 11i (https)RUsPeopleSoft Portal 9 (http)RVsPeopleSoft Portal 9 (https)RWsRapid Deployment PolicyRXsSAP NetWeaver 7 (http)RYsSAP NetWeaver 7 (https)RZsSharePoint 2003 (http)R[sSharePoint 2003 (https)R\sSharePoint 2007 (http)R]sSharePoint 2007 (https)R^sSharePoint 2010 (http)R_sSharePoint 2010 (https)R`s!Vulnerability Assessment BaselineRkRmRl(RR(R"Ra((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyR�sN
(R=R>RBR(((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyRn�st
DifferencecB`s5eZdd�Zd�Zd�Zed��ZRS(cC`s||_||_dS(N(twantthave(R"RpRq((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyt__init__�s	cC`s9yt||�}|SWntk
r4|j|�SXdS(N(R8tAttributeErrort_Difference__default(R"tparamR:((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pytcompare�s

cC`sQt|j|�}y&t|j|�}||kr7|SWntk
rL|SXdS(N(R8RpRqRs(R"Rutattr1tattr2((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyt	__default�s
cC`sT|jjtkr(|jjtkr(tS|jjtkrP|jjtkrPtSdS(N(RpRtTrueRqtFalse(R"((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyR�s$$N(R=R>RRrRvRtRBR(((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyRo�s			tBaseManagercB`s�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(cO`sC|jdd�|_|jdd�|_d|_t�|_dS(NR+tmodule(R.RR+R}RqRntchanges(R"targstkwargs((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyRr�s	cC`s�t}t�}|jj}|dkr6|j�}n|dkrQ|j�}n|jj�}|j|�|jtd|��|j	|�|S(Ntpresenttabsenttchanged(
R{R!RptstateR�R�R~R<tupdatet_announce_deprecations(R"R�R:R�R~((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pytexec_module�s	

cC`sK|jdg�}x2|D]*}|jjjd|dd|d�qWdS(Nt
__warningstmsgtversion(tpopR+R}t	deprecate(R"R:twarningstwarning((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyR��s


cC`sji}xBtjD]7}t|j|�dk	rt|j|�||<qqW|rftd|�|_ndS(Ntparams(RR7R8RpRRnR~(R"R�tkey((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyt_set_changed_optionsscC`s|j�}|rtStS(N(t_update_changed_optionsRzR{(R"R:((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyt
should_updates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(NR�(RoRpRqRR?R!RvRt
isinstanceR�RnR~RzR{(R"tdiffR?R�tktchange((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyR�s		
cC`s$|j�r|j�S|j�SdS(N(texistsR�tcreate(R"((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyR�$s
cC`s|j�stS|j�SdS(N(R�R{tremove(R"((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyR�*sc`s�dj�jjd�jjd�}�jjj|�}y|j�}Wn%tk
rr}tt|���nXt	�fd�|dD��r�t
StS(Ns%https://{0}:{1}/mgmt/tm/asm/policies/R&R'c3`s;|]1}|d�jjko2|d�jjkVqdS(Rt	partitionN(RpRR�(t.0tp(R"(sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pys	<genexpr>;sR(R*R+R,R-R.R/R0RR1tanyRzR{(R"R3R4R5R6((R"sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyR�0s
 cC`sj|jjr"|jjdkr"tS|jjdkrJ|jjdkrJtStjj|jj�sftStS(N(	RpRRRR{tostpathR�Rz(R"((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyt_file_is_missing?s$cC`s�|jjdkr.|jjtdt��n|j�rItd��n|j�|j	j
rctS|jjdkr�|jj
dkr�|j�n>|jjdk	r�|j�n|jj
dk	r�|j�n|jjr�|j�tStSdS(NRs,The specified ASM policy file does not exist(RpRRR�R!R{R�RR�R}t
check_modeRzRRtcreate_blanktcreate_from_templatetcreate_from_filetactivate(R"((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyR�Hs$
$



cC`sV|j�|_|j�stS|jjr/tS|j�|jj	rR|j
�ntS(N(tread_current_from_deviceRqR�R{R}R�Rztupdate_on_deviceR~RR�(R"((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyR�as

cC`sA|j�|_|j�}|j|d�r1tStd��dS(NtapplysApply policy task failed.(R�Rqtapply_on_devicet
wait_for_taskRzR(R"ttask_id((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyR�ls
cC`sjd}|dkr>dj|jjd|jjd|�}n8|dkrvdj|jjd|jjd|�}nx�tr=|jjj|�}y|j�}Wn%tk
r�}tt	|���nXd|kr|dd	krd
|krt|d
��qt|j
��n|ddkr-Pntjd�qyW|dd
krRt
S|ddkrftSdS(NtR�s2https://{0}:{1}/mgmt/tm/asm/tasks/apply-policy/{2}R&R'timports3https://{0}:{1}/mgmt/tm/asm/tasks/import-policy/{2}R(i�R)Rt	COMPLETEDtFAILUREi(R�sFAILURE(R*R+R,RzR-R.R/R0RR1R2ttimetsleepR{(R"R�ttaskR3R4R5R6((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyR�ts8



	c`s�|jj�|jj�dj|jjd|jjd�}|jjj|�}y|j�}Wn%t	k
r�}t
t|���nXt��fd�|dD�d�}|s�t
d��n|S(Ns%https://{0}:{1}/mgmt/tm/asm/policies/R&R'c3`s9|]/}|d�kr|d�kr|dVqdS(RR�tidN((R�R�(RR�(sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pys	<genexpr>�sRsThe policy was not found(RpRR�R*R+R,R-R.R/R0RR1tnextR(R"R3R4R5R6t	policy_id((RR�sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyt_get_policy_id�s
#cC`s�|jj�}|j�}dj|jjd|jjd|�}|ds�|jjj|d|�}y|j�}Wn%t	k
r�}t
t|���nXd|kr�|ddkr�d|kr�t
|d��q�t
|j��q�ndS(	Ns(https://{0}:{1}/mgmt/tm/asm/policies/{2}R&R'RR/R(i�R)(
R~t
api_paramsR�R*R+R,R-tpatchR/R0RR1R2(R"R�R�R3R4R5R6((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyR��s 

	
cC`s9|j�|j�rtStdj|jj���dS(Ns Failed to create ASM policy: {0}(tcreate_on_deviceR�RzRR*RpR(R"((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyR��s

cC`sH|jjrtS|j�|j�rDtdj|jj���ntS(Ns Failed to delete ASM policy: {0}(	R}R�Rztremove_from_deviceR�RR*RpR(R"((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyR��s
cC`s|jjtkrtStSdS(N(RpRRzR{(R"((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pytis_activated�scC`s�|j�}dj|jjd|jjd|�}|jjj|�}y|j�}Wn%tk
r�}tt	|���nXd|kr�|ddkr�d|kr�t|d��q�t|j
��n|jtd|d��t
d	|�S(
Ns(https://{0}:{1}/mgmt/tm/asm/policies/{2}R&R'R(i�R)t	self_linkRR�(R�R*R+R,R-R.R/R0RR1R2R�R!R(R"R�R3R4R5R6((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyR��s 

	cC`sddj|jjd|jjd�}yt|j|||�Wntk
r_td��nXdS(Ns1https://{0}:{1}/mgmt/shared/file-transfer/uploadsR&R'sFailed to upload the file.(R*R+R,RR(R"R2Rturl((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pytupload_file_to_device�s

c	C`s�tjj|jj�d}|j|jj|�tjd�t|jj	|jj
�}dj||�}dj|jj
d|jj
d�}tddd	d
j|��}|jjj|d|�}yB|j�}d|krd
|dkrt|d��qnWn%tk
r4}tt|���nXd|kr�|ddkr�d|krpt|d��q�t|j��ntS(Niis<tmsh load asm policy {0} file /var/config/rest/downloads/{1}s"https://{0}:{1}/mgmt/tm/util/bash/R&R'tcommandtruntutilCmdArgss-c "{0}"R/t
commandResultsUnexpected ErrorR(i�R)(R�R�tsplitRpRR�R�R�RR�RR*R+R,R!R-tpostR/RR0R1R2Rz(	R"Rt	full_nametcmdR3RR4R5R6((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pytimport_to_devices0

cC`s
tjj|jj�d}dj|�}dj|jjd|jjd�}tddd|�}|jj	j
|d	|�}y|j�}Wn%tk
r�}t
t|���nXd
|kr|d
dkrd|kr�t
|d��qt
|j��ndS(
Nis/var/config/rest/downloads/{0}s%https://{0}:{1}/mgmt/tm/util/unix-rm/R&R'R�R�R�R/R(i�R)(R�R�R�RpRR*R+R,R!R-R�R/R0RR1R2(R"Rt
tpath_nameR3RR4R5R6((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pytremove_temp_policy_from_device#s"
	cC`s�dj|jjd|jjd�}tdi|jjd6�}|jjj|d|�}y|j�}Wn%t	k
r�}t
t|���nXd|kr�|ddkr�d
|kr�t
|d
��q�t
|j��n|dS(
Ns/https://{0}:{1}/mgmt/tm/asm/tasks/apply-policy/R&R'tpolicyReferenceRR/R(i�i�R)R�(i�i�(
R*R+R,R!RqR�R-R�R/R0RR1R2(R"R3R�R4R5R6((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyR�9s
cC`sMt|jj|jj�}dj||jj�}dj|jjd|jjd�}tddddj|��}|jj	j
|d	|�}yB|j�}d
|kr�d|d
kr�t|d
��q�nWn%t
k
r�}tt|���nXd|krI|dd
krId|kr7t|d��qIt|j��ndS(Ns.tmsh create asm policy {0} policy-template {1}s"https://{0}:{1}/mgmt/tm/util/bash/R&R'R�R�R�s-c "{0}"R/R�sUnexpected ErrorR(i�R)(RRpR�RR*RR+R,R!R-R�R/RR0R1R2(R"R�R�R3RR4R5R6((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pytcreate_from_template_on_deviceMs(
cC`s|jj�}|jj|d<|jj|d<|jd�dj|jjd|jjd�}|jj	j
|d|�}y|j�}Wn%tk
r�}t
t|���nXd|kr|ddkrd|kr�t
|d��qt
|j��ntjd
�|dS(NRR�Rs%https://{0}:{1}/mgmt/tm/asm/policies/R&R'R/R(i�i�i�R)iR(i�i�i�(R~R�RpRR�R�R*R+R,R-R�R/R0RR1R2R�R�(R"R�R3R4R5R6((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyR�hs$


cC`sp|j�}dj|jjd|jjd|�}|jjj|�}|jdkr]tSt|j	��dS(Ns(https://{0}:{1}/mgmt/tm/asm/policies/{2}R&R'i�i�(i�i�(
R�R*R+R,R-tdeleteRRzRR2(R"R�R3R5((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyR��s

	(R=R>RrR�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�(((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyR|�s6															%					
				!				t
ModuleManagercB`s,eZd�Zd�Zd�Zd�ZRS(cO`s7|jdd�|_t|jj�|_||_dS(NR}(R.RR}RR�R+R�(R"RR�((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyRr�scC`sXt|jd�s!td��n|j�r?|jd�}n|jd�}|j�S(Ntasms+ASM must be provisioned to use this module.tv1tv2(RR+Rtversion_is_less_than_13tget_managerR�(R"tmanager((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyR��scC`s6|dkrt|j�S|dkr2t|j�SdS(NR�R�(t	V1ManagerR�t	V2Manager(R"ttype((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyR��s
cC`s3t|j�}t|�td�kr+tStSdS(Ns13.0.0(RR+R
RzR{(R"R�((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyR��s(R=R>RrR�R�R�(((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyR��s			R�cB`s#eZd�Zd�Zd�ZRS(cO`s_|jdd�}t|j�}tt|�jd|d|�td|jd|�|_dS(NR}R+R�(	R.RRR�tsuperR�RrRCRp(R"RR�R}R+((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyRr�scC`s|j�|j�dS(N(R�R�(R"((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyR��s
cC`s|j�dS(N(R�(R"((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyR��s(R=R>RrR�R�(((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyR��s		R�cB`s#eZd�Zd�Zd�ZRS(cO`s_|jdd�}t|j�}tt|�jd|d|�td|jd|�|_dS(NR}R+R�(	R.RRR�R�R�RrRbRp(R"RR�R}R+((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyRr�scC`s|j�stSdS(N(R�R{(R"((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyR��scC`s|j�stS|j�dS(N(R�R{R�(R"((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyR��s(R=R>RrR�R�(((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyR��s		tArgumentSpeccB`seZd�ZRS(c#C`s)ddddddddd	d
ddd
ddddddddddddddddddd d!d"d#g#|_t|_td$td%t�d&td'd(�d)td*|j�d+td'd,�d-td.d/d*d/d0g�d1td.d2d3td4gf��}i|_|jjt�|jj|�dS(5NsActiveSync v1.0 v2.0 (http)sActiveSync v1.0 v2.0 (https)RdRfRhRjsLotusDomino 6.5 (http)sLotusDomino 6.5 (https)sOWA Exchange 2003 (http)sOWA Exchange 2003 (https)s(OWA Exchange 2003 with ActiveSync (http)s)OWA Exchange 2003 with ActiveSync (https)sOWA Exchange 2007 (http)sOWA Exchange 2007 (https)s(OWA Exchange 2007 with ActiveSync (http)s)OWA Exchange 2007 with ActiveSync (https)sOWA Exchange 2010 (http)sOWA Exchange 2010 (https)sOracle 10g Portal (http)sOracle 10g Portal (https)sOracle Applications 11i (http)sOracle Applications 11i (https)sPeopleSoft Portal 9 (http)sPeopleSoft Portal 9 (https)sRapid Deployment PolicysSAP NetWeaver 7 (http)sSAP NetWeaver 7 (https)sSharePoint 2003 (http)sSharePoint 2003 (https)sSharePoint 2007 (http)sSharePoint 2007 (https)sSharePoint 2010 (http)sSharePoint 2010 (https)s!Vulnerability Assessment BaselineRmRtrequiredRR�R�RtchoicesRtboolR�tdefaultR�R�R�tCommontfallbacktF5_PARTITION(RaRztsupports_check_modeR!R	t
argument_specR�R(R"R�((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyRr�sj				(R=R>Rr(((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyR��scC`s�t�}td|jd|jdddgg�}t|j�}y,td|�}|j�}|j|�Wn)t	k
r�}|j
dt|��nXdS(NR�R�tmutually_exclusiveRRR}R�(R�RR�R�RR�R�R�t	exit_jsonRt	fail_jsonR1(tspecR}R+tmmtresultsR6((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pytmains			t__main__(-t
__future__RRRR�t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR�R�tansible.module_utils.basicRR	tdistutils.versionR
t%library.module_utils.network.f5.bigipRt&library.module_utils.network.f5.commonRR
RRt(library.module_utils.network.f5.icontrolRRRtImportErrort%ansible.module_utils.network.f5.bigipt&ansible.module_utils.network.f5.commont(ansible.module_utils.network.f5.icontrolRRCRbRntobjectRoR|R�R�R�R�R�R=(((sP/usr/lib/python2.7/site-packages/ansible/modules/network/f5/_bigip_asm_policy.pyt<module>sX


b[
>,--��A	

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