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_irule.pyo

�
�Udac@`saddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlmZdd
lm
Z
yTddlmZddlmZddlmZddlmZddlmZWnaek
r5ddlmZddlmZddlmZddlmZddlmZnXdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZdefd ��YZd!efd"��YZ d#efd$��YZ!d%e!fd&��YZ"d'e!fd(��YZ#d)efd*��YZ$d+�Z%e&d,kr]e%�ndS(-i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontstableinterfacetstatust	certifiedtsupported_bys(
---
module: bigip_irule
short_description: Manage iRules across different modules on a BIG-IP
description:
  - Manage iRules across different modules on a BIG-IP.
version_added: 2.2
options:
  content:
    description:
      - When used instead of 'src', sets the contents of an iRule directly to
        the specified value. This is for simple values, but can be used with
        lookup plugins for anything complex or with formatting. Either one
        of C(src) or C(content) must be provided.
    type: str
  module:
    description:
      - The BIG-IP module to add the iRule to.
    type: str
    required: True
    choices:
      - ltm
      - gtm
  name:
    description:
      - The name of the iRule.
    type: str
    required: True
  src:
    description:
      - The iRule file to interpret and upload to the BIG-IP. Either one
        of C(src) or C(content) must be provided.
    type: path
    required: True
  state:
    description:
      - Whether the iRule should exist or not.
    type: str
    choices:
      - present
      - absent
    default: present
  partition:
    description:
      - Device partition to manage resources on.
    type: str
    default: Common
    version_added: 2.5
extends_documentation_fragment: f5
author:
  - Tim Rupp (@caphrim007)
  - Wojciech Wypior (@wojtek0806)
sA
- name: Add the iRule contained in template irule.tcl to the LTM module
  bigip_irule:
    content: "{{ lookup('template', 'irule.tcl') }}"
    module: ltm
    name: MyiRule
    state: present
    provider:
      user: admin
      password: secret
      server: lb.mydomain.com
  delegate_to: localhost

- name: Add the iRule contained in static file irule.tcl to the LTM module
  bigip_irule:
    module: ltm
    name: MyiRule
    src: irule.tcl
    state: present
    provider:
      user: admin
      password: secret
      server: lb.mydomain.com
  delegate_to: localhost
s�
module:
  description: The module that the iRule was added to
  returned: changed and success
  type: str
  sample: gtm
src:
  description: The filename that included the iRule source
  returned: changed and success, when provided
  type: str
  sample: /opt/src/irules/example1.tcl
content:
  description: The content of the iRule that was managed
  returned: changed and success
  type: str
  sample: "when LB_FAILED { set wipHost [LB::server addr] }"
N(t
AnsibleModule(tenv_fallback(tF5RestClient(t
F5ModuleError(tAnsibleF5Parameters(tf5_argument_spec(ttransform_namet
ParameterscB`s6eZidd6ZdgZdgZdddgZRS(tcontenttapiAnonymoustsrctmodule(t__name__t
__module__tapi_mapt
updatablestapi_attributestreturnables(((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pyR�s

		t
ApiParameterscB`seZRS((RR(((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pyR�stModuleParameterscB`s5eZed��Zed��Zed��ZRS(cC`s<|jddkr|j}n
|jd}t|�j�S(NR(t_valuestNonetsrc_contenttstrtstrip(tselftresult((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pyR�s
cC`s"|jddkrdS|jdS(NR(RR(R!((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pyR�scC`sTtjj|jd�s(td��nt|jd��}|j�}WdQX|S(NRs"The specified 'src' was not found.(tostpathtexistsRRtopentread(R!tfR"((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pyR�s(RRtpropertyRRR(((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pyR�s	tChangescB`seZd�ZRS(cC`s@i}x$|jD]}t||�||<qW|j|�}|S(N(Rtgetattrt_filter_params(R!R"t
returnable((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pyt	to_return�s
(RRR.(((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pyR*�st
UsableChangescB`seZRS((RR(((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pyR/�stReportableChangescB`seZRS((RR(((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pyR0�st
DifferencecB`s&eZdd�Zd�Zd�ZRS(cC`s||_||_dS(N(twantthave(R!R2R3((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pyt__init__�s	cC`s9yt||�}|SWntk
r4|j|�SXdS(N(R+tAttributeErrort_Difference__default(R!tparamR"((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pytcompare�s

cC`sQt|j|�}y&t|j|�}||kr7|SWntk
rL|SXdS(N(R+R2R3R5(R!R7tattr1tattr2((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pyt	__default�s
N(RRRR4R8R6(((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pyR1�s	t
ModuleManagercB`s#eZd�Zd�Zd�ZRS(cO`s7|jdd�|_|jdd�|_||_dS(NtclientR(tgetRR=Rtkwargs(R!targsR?((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pyR4�scC`sf|jjddkr(|jd�}n4|jjddkrP|jd�}ntd��|j�S(NRtltmtgtms*An unknown iRule module type was specified(Rtparamstget_managerRtexec_module(R!tmanager((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pyRE�s	cC`s6|dkrt|j�S|dkr2t|j�SdS(NRARB(t
LtmManagerR?t
GtmManager(R!ttype((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pyRD�s
(RRR4RERD(((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pyR<�s		tBaseManagercB`skeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�ZRS(cO`s[|jdd�|_t|jj�|_d|_td|jj�|_t	�|_
dS(NRRC(R>RRR
RCR=R3RR2R/tchanges(R!R@R?((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pyR4�s
	cC`sji}xBtjD]7}t|j|�dk	rt|j|�||<qqW|rftd|�|_ndS(NRC(RRR+R2RR/RK(R!tchangedtkey((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pyt_set_changed_options�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(NRC(R1R2R3RRtdictR8Rt
isinstancetupdateR/RKtTruetFalse(R!tdiffRRLtktchange((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pyt_update_changed_optionss		
cC`sH|jdg�}x/|D]'}|jjd|dd|d�qWdS(Nt
__warningstmsgtversion(tpopRt	deprecate(R!R"twarningstwarning((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pyt_announce_deprecationss


cC`s�t}t�}|jj}|dkr6|j�}n|dkrQ|j�}ntd|jj��}|j�}|j	|�|j	td|��|j
|�|S(NtpresenttabsentRCRL(spresent(RSROR2tstateR`RaR0RKR.RQR_(R!RLR"Rbt
reportableRK((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pyREs	

cC`sM|jjr)|jjr)td��n|j�r?|j�S|j�SdS(Ns*Either 'content' or 'src' must be provided(R2RRRR%RQtcreate(R!((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pyR`/s
cC`sC|j�|jjrtS|j�|j�s?td��ntS(NsFailed to create the iRule(RNRt
check_modeRRtcreate_on_deviceR%R(R!((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pyRd9s

cC`s|j�}|rtStS(N(RWRRRS(R!R"((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pyt
should_updateBscC`s=|j�|_|j�stS|jjr/tS|j�tS(N(tread_current_from_deviceR3RgRSRReRRtupdate_on_device(R!((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pyRQHs
cC`s|j�r|j�StS(N(R%tremoveRS(R!((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pyRaQs
cC`s9|jjrtS|j�|j�r5td��ntS(NsFailed to delete the iRule(RReRRtremove_from_deviceR%R(R!((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pyRjVs
(
RRR4RNRWR_RER`RdRgRQRaRj(((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pyRJ�s						
						RGcB`s5eZd�Zd�Zd�Zd�Zd�ZRS(cC`s�dj|jjd|jjdt|jj|jj��}|jjj|�}y|j	�}Wnt
k
rwtSX|jdks�d|kr�|ddkr�tSt
S(Ns$https://{0}:{1}/mgmt/tm/ltm/rule/{2}tservertserver_porti�tcode(tformatR=tproviderRR2t	partitiontnametapiR>tjsont
ValueErrorRSRRR(R!turitresptresponse((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pyR%`s


+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(Ns$https://{0}:{1}/mgmt/tm/ltm/rule/{2}RlRmRtRni�tmessage(RKt
api_paramsRoR=RpRR2RqRrRstpatchRtRuRRR(R!RCRvRwRxtex((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pyRios

cC`s�|jj�}|jj|d<|jj|d<dj|jjd|jjd�}|jjj	|d|�}y|j
�}Wn%tk
r�}tt
|���nXd|kr�|ddkr�d
|kr�t|d
��q�t|j��n|dS(
NRrRqs!https://{0}:{1}/mgmt/tm/ltm/rule/RlRmRtRni�i�RytselfLink(i�i�(RKRzR2RrRqRoR=RpRstpostRtRuRRR(R!RCRvRwRxR|((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pyRf�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(Ns$https://{0}:{1}/mgmt/tm/ltm/rule/{2}RlRmRni�RyRC(RoR=RpRR2RqRrRsR>RtRuRRRR(R!RvRwRxR|((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pyRh�s

cC`sydj|jjd|jjdt|jj|jj��}|jjj|�}|j	dkrft
St|j��dS(Ns$https://{0}:{1}/mgmt/tm/ltm/rule/{2}RlRmi�(
RoR=RpRR2RqRrRstdeleteRRRRR(R!RvRx((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pyRk�s

(RRR%RiRfRhRk(((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pyRG_s
				RHcB`s5eZd�Zd�Zd�Zd�Zd�ZRS(cC`s�dj|jjd|jjdt|jj|jj��}|jjj|�}y|j	�}Wnt
k
rwtSX|jdks�d|kr�|ddkr�tSt
S(Ns$https://{0}:{1}/mgmt/tm/gtm/rule/{2}RlRmi�Rn(RoR=RpRR2RqRrRsR>RtRuRSRRR(R!RvRwRx((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pyR%�s


+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(Ns$https://{0}:{1}/mgmt/tm/gtm/rule/{2}RlRmRtRni�Ry(RKRzRoR=RpRR2RqRrRsR{RtRuRRR(R!RCRvRwRxR|((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pyRi�s

cC`s�|jj�}|jj|d<|jj|d<dj|jjd|jjd�}|jjj	|d|�}y|j
�}Wn%tk
r�}tt
|���nXd|kr�|ddkr�d
|kr�t|d
��q�t|j��n|dS(
NRrRqs!https://{0}:{1}/mgmt/tm/gtm/rule/RlRmRtRni�i�RyR}(i�i�(RKRzR2RrRqRoR=RpRsR~RtRuRRR(R!RCRvRwRxR|((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pyRf�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(Ns$https://{0}:{1}/mgmt/tm/gtm/rule/{2}RlRmRni�RyRC(RoR=RpRR2RqRrRsR>RtRuRRRR(R!RvRwRxR|((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pyRh�s

cC`sydj|jjd|jjdt|jj|jj��}|jjj|�}|j	dkrft
St|j��dS(Ns$https://{0}:{1}/mgmt/tm/gtm/rule/{2}RlRmi�(
RoR=RpRR2RqRrRsRRRRRR(R!RvRx((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pyRks

(RRR%RiRfRhRk(((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pyRH�s
				tArgumentSpeccB`seZd�ZRS(cC`s�t|_tdt�dtdd�dtdt�dtdtdd	d
g�dtdd
dd
dg�dtdddtdgf��}i|_|jjt�|jj|�ddgg|_dS(NRRRIR$RrtrequiredRtchoicesRBRARbtdefaultR`RaRqtCommontfallbacktF5_PARTITION(RRtsupports_check_modeROR	t
argument_specRQR
tmutually_exclusive(R!R�((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pyR4s&				(RRR4(((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pyR�scC`s�t�}td|jd|jd|j�}y,td|�}|j�}|j|�Wn)tk
r�}|j	dt
|��nXdS(NR�R�R�RRY(R�RR�R�R�R<REt	exit_jsonRt	fail_jsonR(tspecRtmmtresultsR|((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pytmain/s			t__main__('t
__future__RRRRIt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR#tansible.module_utils.basicRR	t%library.module_utils.network.f5.bigipR
t&library.module_utils.network.f5.commonRRR
RtImportErrort%ansible.module_utils.network.f5.bigipt&ansible.module_utils.network.f5.commonRRRR*R/R0tobjectR1R<RJRGRHR�R�R(((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_irule.pyt<module>sJ


6
	kYY	

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