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

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlZddlm
Z
dd
lmZddlmZy�ddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZWn�ek
r�ddl mZddl!mZddl!mZddl!mZddl!mZddl!mZddl"mZddl#mZddl$mZnXdefd��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/e0d+kr�e/�ndS(,i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	certifiedtsupported_bys�
---
module: bigip_gtm_monitor_external
short_description: Manages external GTM monitors on a BIG-IP
description:
  - Manages external GTM monitors on a BIG-IP.
version_added: 2.6
options:
  name:
    description:
      - Specifies the name of the monitor.
    type: str
    required: True
  parent:
    description:
      - The parent template of this monitor template. Once this value has
        been set, it cannot be changed. By default, this value is the C(http)
        parent on the C(Common) partition.
    type: str
    default: "/Common/external"
  arguments:
    description:
      - Specifies any command-line arguments that the script requires.
    type: str
  ip:
    description:
      - IP address part of the IP/port definition. If this parameter is not
        provided when creating a new monitor, then the default value will be
        '*'.
    type: str
  port:
    description:
      - Port address part of the IP/port definition. If this parameter is not
        provided when creating a new monitor, then the default value will be
        '*'. Note that if specifying an IP address, a value between 1 and 65535
        must be specified.
    type: str
  external_program:
    description:
      - Specifies the name of the file for the monitor to use. In order to reference
        a file, you must first import it using options on the System > File Management > External
        Monitor Program File List > Import screen. The BIG-IP system automatically
        places the file in the proper location on the file system.
    type: str
  interval:
    description:
      - The interval specifying how frequently the monitor instance of this
        template will run. If this parameter is not provided when creating
        a new monitor, then the default value will be 30. This value B(must)
        be less than the C(timeout) value.
    type: int
  timeout:
    description:
      - The number of seconds in which the node or service must respond to
        the monitor request. If the target responds within the set time
        period, it is considered up. If the target does not respond within
        the set time period, it is considered down. You can change this
        number to any number you want, however, it should be 3 times the
        interval number of seconds plus 1 second. If this parameter is not
        provided when creating a new monitor, then the default value will be 120.
    type: int
  variables:
    description:
      - Specifies any variables that the script requires.
      - Note that double quotes in values will be suppressed.
    type: dict
  partition:
    description:
      - Device partition to manage resources on.
    type: str
    default: Common
  state:
    description:
      - When C(present), ensures that the monitor exists.
      - When C(absent), ensures the monitor is removed.
    type: str
    choices:
      - present
      - absent
    default: present
extends_documentation_fragment: f5
author:
  - Tim Rupp (@caphrim007)
  - Wojciech Wypior (@wojtek0806)
s
- name: Create an external monitor
  bigip_gtm_monitor_external:
    name: foo
    state: present
    provider:
      user: admin
      password: secret
      server: lb.mydomain.com
  delegate_to: localhost

- name: Create an external monitor with variables
  bigip_gtm_monitor_external:
    name: foo
    timeout: 10
    variables:
      var1: foo
      var2: bar
    state: present
    provider:
      user: admin
      password: secret
      server: lb.mydomain.com
  delegate_to: localhost

- name: Add a variable to an existing set
  bigip_gtm_monitor_external:
    name: foo
    timeout: 10
    variables:
      var1: foo
      var2: bar
      cat: dog
    state: present
    provider:
      user: admin
      password: secret
      server: lb.mydomain.com
  delegate_to: localhost
s�
parent:
  description: New parent template of the monitor.
  returned: changed
  type: str
  sample: external
ip:
  description: The new IP of IP/port definition.
  returned: changed
  type: str
  sample: 10.12.13.14
interval:
  description: The new interval in which to run the monitor check.
  returned: changed
  type: int
  sample: 2
timeout:
  description: The new timeout in which the remote system must respond to the monitor.
  returned: changed
  type: int
  sample: 10
N(t
AnsibleModule(tenv_fallback(t	iteritems(tF5RestClient(t
F5ModuleError(tAnsibleF5Parameters(tfq_name(tf5_argument_spec(ttransform_name(tcompare_dictionary(tmodule_provisioned(tis_valid_ipt
ParameterscB`s�eZidd6dd6dd6dd6Zddd	d
ddgZddddd	dddgZd
dd	dddgZed
��Zejd��Zed��Z	ed��Z
ed��Zed��Zed��Z
ed��ZRS(tparenttdefaultsFromt	variablestapiRawValuestexternal_programtrunt	argumentstargstintervalttimeouttdestinationtiptportcC`s>|jdkr"|jdkr"dSdj|j|j�}|S(Ns{0}:{1}(R tNoneR!tformat(tselfR((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pyR�scC`s3|jd�\}}||jd<||jd<dS(Nt:R R!(tsplitt_values(R$tvalueR R!((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pyR�s
cC`s`|jddkrdSdt|jd�ko;dknrOtd��nt|jd�S(NRii�Qs*Interval value must be between 1 and 86400(R'R"tintR(R$((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pyR�s)cC`s(|jddkrdSt|jd�S(NR(R'R"R)(R$((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pyR�scC`s\|jddkrdS|jddkr.dSt|jd�rL|jdStd��dS(NR t*s0.0.0.0s1The provided 'ip' parameter is not an IP address.(R*s0.0.0.0(R'R"RR(R$((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pyR �scC`s?|jddkrdS|jddkr.dSt|jd�S(NR!R*(R'R"R)(R$((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pyR!s
cC`s~|jddkrdS|jdjd�r^tjj|jd�}dj|j|�}ndj|j|jd�}|S(NRt/s/{0}/{1}(R'R"t
startswithtostpathtbasenameR#t	partition(R$Rtresult((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pyR
scC`sdS(Ntexternal((R$((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pyttypes(t__name__t
__module__tapi_maptapi_attributestreturnablest
updatablestpropertyRtsetterRRR R!RR3(((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pyR�s$
		

t
ApiParameterscB`seZed��ZRS(cC`s�|jddkrdSd}i}xat|jd�D]L\}}tj||�}|sjtd��n|jd�}|||<q7W|S(NRs^userDefined\s(?P<key>.*)s5Unable to find the variable 'key' in the API payload.tkey(R'R"R
tretmatchRtgroup(R$tpatternR1tktvtmatchesR=((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pyRs (R4R5R:R(((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pyR<stModuleParameterscB`s&eZed��Zed��ZRS(cC`sa|jddkrdSi}x=t|jd�D](\}}t|�jdd�||<q1W|S(NRt"t(R'R"R
tstrtreplace(R$R1RBRC((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pyR0s  cC`s.|jddkrdSt|j|jd�S(NR(R'R"RR0(R$((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pyR9s(R4R5R:RR(((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pyRE/s	tChangescB`seZd�ZRS(cC`sXi}y:x$|jD]}t||�||<qW|j|�}Wntk
rSnX|S(N(R8tgetattrt_filter_paramst	Exception(R$R1t
returnable((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pyt	to_returnAs
(R4R5RO(((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pyRJ@st
UsableChangescB`seZRS((R4R5(((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pyRPLstReportableChangescB`seZRS((R4R5(((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pyRQPst
DifferencecB`sbeZdd�Zd�Zd�Zed��Zed��Zed��Z	ed��Z
RS(cC`s||_||_dS(N(twantthave(R$RSRT((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pyt__init__Us	cC`s9yt||�}|SWntk
r4|j|�SXdS(N(RKtAttributeErrort_Difference__default(R$tparamR1((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pytcompareYs

cC`sQt|j|�}y&t|j|�}||kr7|SWntk
rL|SXdS(N(RKRSRTRV(R$RXtattr1tattr2((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pyt	__default`s
cC`s+|jj|jjkr'td��ndS(Ns$The parent monitor cannot be changed(RSRRTR(R$((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pyRiscC`s�|jjdkr(|jjdkr(dS|jjdkrZ|jji|jjd6�n|jjdkr�|jji|jjd6�n|jjdkr�|jjdkr�td��n|jj|jjkr�|jjSdS(NR!R R*sASpecifying an IP address requires that a port number be specified(NR*(RSR R"R!tupdateRTRR(R$((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pyRps$  $cC`s�|jjdk	rN|jjdk	rN|jj|jjkr�td��q�nx|jjdk	r�|jj|jjkr�td��q�n<|jjdk	r�|jj|jjkr�td��q�n|jj|jjkr�|jjSdS(Ns1Parameter 'interval' must be less than 'timeout'.(RSRR"RRRT(R$((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pyR�s$cC`s?|jjdkrdS|jjdkr;td|jj�St�}t|jj|jj�}|sidSxtt|jj�D]`\}}||jjkr�||jj|kr�|||<q|||jjkr||||<q|q|Wx?t|jj�D]+\}}||jjkr�d||<q�q�W|r;td|�}|SdS(NRtnone(RSRR"RTtdictRR
(R$R1t	differentRBRC((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pyR�s*
	(
	N(R4R5R"RURYRWR:RRRR(((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pyRRTs			t
ModuleManagercB`s�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�ZRS(cO`s^|jdd�|_t|jj�|_td|jj�|_t�|_	t
�|_dS(Ntmoduletparams(tgetR"RbRRctclientRERSR<RTRPtchanges(R$Rtkwargs((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pyRU�s
cC`sji}xBtjD]7}t|j|�dk	rt|j|�||<qqW|rftd|�|_ndS(NRc(RR8RKRSR"RPRf(R$tchangedR=((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.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(RRRSRTRR9R_RYR"t
isinstanceR]RPRftTruetFalse(R$tdiffR9RhRBtchange((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pyt_update_changed_options�s		
cC`sK|jdg�}x2|D]*}|jjjd|dd|d�qWdS(Nt
__warningstmsgtversion(tpopReRbt	deprecate(R$R1twarningstwarning((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pyt_announce_deprecations�s


cC`s�|jjdkr,|jjidd6�n|jjdkrX|jjidd6�n|jjdkr�|jjidd6�n|jjdkr�|jjidd6�ndS(NixRiRR*R R!(RSRR"R]RR R!(R$((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pyt_set_default_creation_values�scC`s�t|jd�s!td��nt}t�}|jj}|dkrW|j�}n|dkrr|j�}nt	d|j
j��}|j�}|j|�|jtd|��|j
|�|S(Ntgtms+GTM must be provisioned to use this module.tpresenttabsentRcRh(RReRRlR_RStstateRzR{RQRfROR]Rw(R$RhR1R|t
reportableRf((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pytexec_module�s 	

cC`s$|j�r|j�S|j�SdS(N(texistsR]tcreate(R$((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pyRz�s
cC`s|j�r|j�StS(N(RtremoveRl(R$((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pyR{s
cC`s2|j�|j�|jjr$tS|j�tS(N(RiRxRbt
check_modeRktcreate_on_device(R$((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pyR�s


cC`s|j�}|rtStS(N(RoRkRl(R$R1((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pyt
should_updatescC`s=|j�|_|j�stS|jjr/tS|j�tS(N(tread_current_from_deviceRTR�RlRbR�Rktupdate_on_device(R$((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pyR]s
cC`s9|jjrtS|j�|j�r5td��ntS(NsFailed to delete the monitor.(RbR�Rktremove_from_deviceRR(R$((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pyR�s
cC`s�dj|jjd|jjdt|jj|jj��}|jjj|�}y|j	�}Wnt
k
rwtSX|jdks�d|kr�|ddkr�tSt
S(Ns0https://{0}:{1}/mgmt/tm/gtm/monitor/external/{2}tservertserver_porti�tcode(R#RetproviderRRSR0tnametapiRdtjsont
ValueErrorRlRRk(R$turitresptresponse((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pyR%s


+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��n|jjr|j|jj�ndS(NR�R0s-https://{0}:{1}/mgmt/tm/gtm/monitor/external/R�R�R�R�i�i�tmessage(i�i�(Rft
api_paramsRSR�R0R#ReR�R�tpostR�R�RRHtcontentRtset_variable_on_device(R$RcR�R�R�tex((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pyR�4s"
cC`s|jj�}|r�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��q�n|jjr|j|jj�ndS(Ns0https://{0}:{1}/mgmt/tm/gtm/monitor/external/{2}R�R�R�R�i�R�(RfR�R#ReR�RRSR0R�R�tpatchR�R�RRHR�RR�(R$RcR�R�R�R�((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pyR�Ks"

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(Ns0https://{0}:{1}/mgmt/tm/gtm/monitor/external/{2}R�R�R�i�R�Rc(R#ReR�RRSR0R�R�RdR�R�RRHR�R<(R$R�R�R�R�((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pyR�as

cC`sydj|jjd|jjdt|jj|jj��}|jjj|�}|j	dkrft
St|j��dS(Ns0https://{0}:{1}/mgmt/tm/gtm/monitor/external/{2}R�R�i�(
R#ReR�RRSR0R�R�tdeleteRRkRR�(R$R�R�((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pyR�ts

c
C`s:djgt|�D]\}}dj||�^q�}dj|jj|�}dj|jjd|jjd�}tddd	d
j|��}|jjj	|d|�}y|j
�}Wn%tk
r�}	tt
|	���nXd|kr6|dd
kr6d|kr$t|d��q6t|j��ndS(Nt suser-defined {0} \"{1}\"s(tmsh modify gtm monitor external {0} {1}s!https://{0}:{1}/mgmt/tm/util/bashR�R�tcommandRtutilCmdArgss-c "{0}"R�R�i�R�(tjoinR
R#RSR�ReR�R_R�R�R�R�RRHR�(
R$tcommandsRBRCR�R�RR�R�R�((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pyR�s":
(R4R5RURiRoRwRxR~RzR{R�R�R]R�RR�R�R�R�R�(((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pyRa�s$					
													tArgumentSpeccB`seZd�ZRS(cC`s�t|_tdtdt�dtdd�dt�dt�dt�d	t�d
tdd�d
tdd�dtdddddg�dtdd�dtdddtdgf��}i|_|jjt�|jj|�dS(NR�trequiredRtdefaults/Common/externalRR R!RRR3R)RR|RztchoicesR{RR_R0tCommontfallbacktF5_PARTITION(Rktsupports_check_modeR_R	t
argument_specR]R(R$R�((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pyRU�s(						(R4R5RU(((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pyR��scC`s�t�}td|jd|j�}y,td|�}|j�}|j|�Wn)tk
r{}|jdt	|��nXdS(NR�R�RbRq(
R�RR�R�RaR~t	exit_jsonRt	fail_jsonRH(tspecRbtmmtresultsR�((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pytmain�s		t__main__(1t
__future__RRRR3t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR-R>tansible.module_utils.basicRR	tansible.module_utils.sixR
t%library.module_utils.network.f5.bigipRt&library.module_utils.network.f5.commonRR
RRRt'library.module_utils.network.f5.compareRt(library.module_utils.network.f5.icontrolRt)library.module_utils.network.f5.ipaddressRtImportErrort%ansible.module_utils.network.f5.bigipt&ansible.module_utils.network.f5.commont'ansible.module_utils.network.f5.comparet(ansible.module_utils.network.f5.icontrolt)ansible.module_utils.network.f5.ipaddressRR<RERJRPRQtobjectRRRaR�R�R4(((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_external.pyt<module>sX


V)
[^�	

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