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

�
�Udac@`sddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlmZdd
lm
Z
y�ddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZWn�ek
r�ddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZnXdefd��YZdefd��YZ defd��YZ!defd��YZ"de"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_versiontpreviewtstatust	certifiedtsupported_bys�
---
module: bigip_gtm_monitor_bigip
short_description: Manages F5 BIG-IP GTM BIG-IP monitors
description:
  - Manages F5 BIG-IP GTM BIG-IP monitors. This monitor is used by GTM to monitor
    BIG-IPs themselves.
version_added: 2.6
options:
  name:
    description:
      - Monitor name.
    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(bigip)
        parent on the C(Common) partition.
    type: str
    default: "/Common/bigip"
  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
  interval:
    description:
      - Specifies, in seconds, the frequency at which the system issues the monitor
        check when either the resource is down or the status of the resource is unknown.
      - When creating a new monitor, if this parameter is not provided, then the
        default value will be C(30). This value B(must) be less than the C(timeout) value.
    type: int
  timeout:
    description:
      - Specifies the number of seconds the target has in which to 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.
      - When this value is set to 0 (zero), the system uses the interval from the parent monitor.
      - When creating a new monitor, if this parameter is not provided, then
        the default value will be C(90).
    type: int
  ignore_down_response:
    description:
      - Specifies that the monitor allows more than one probe attempt per interval.
      - When C(yes), specifies that the monitor ignores down responses for the duration of
        the monitor timeout. Once the monitor timeout is reached without the system receiving
        an up response, the system marks the object down.
      - When C(no), specifies that the monitor immediately marks an object down when it
        receives a down response.
      - When creating a new monitor, if this parameter is not provided, then the default
        value will be C(no).
    type: bool
  aggregate_dynamic_ratios:
    description:
      - Specifies how the system combines the module values to create the proportion
        (score) for the load balancing operation.
      - The score represents the module's estimated capacity for handing traffic.
      - Averaged values are appropriate for downstream Web Accelerator or Application
        Security Manager virtual servers.
      - When creating a new monitor, if this parameter is not specified, the default
        of C(none) is used, meaning that the system does not use the scores in the load
        balancing operation.
      - When C(none), specifies that the monitor ignores the nodes and pool member scores.
      - When C(average-nodes), specifies that the system averages the dynamic ratios
        on the nodes associated with the monitor's target virtual servers and returns
        that average as the virtual servers' score.
      - When C(sum-nodes), specifies that the system adds together the scores of the
        nodes associated with the monitor's target virtual servers and uses that value
        in the load balancing operation.
      - When C(average-members), specifies that the system averages the dynamic ratios
        on the pool members associated with the monitor's target virtual servers and
        returns that average as the virtual servers' score.
      - When C(sum-members), specifies that the system adds together the scores of the
        pool members associated with the monitor's target virtual servers and uses
        that value in the load balancing operation.
    type: str
    choices:
      - none
      - average-nodes
      - sum-nodes
      - average-members
      - sum-members
  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
notes:
  - Requires BIG-IP software version >= 12
extends_documentation_fragment: f5
author:
  - Tim Rupp (@caphrim007)
  - Wojciech Wypior (@wojtek0806)
s�
- name: Create BIG-IP Monitor
  bigip_gtm_monitor_bigip:
    state: present
    ip: 10.10.10.10
    name: my_monitor
    provider:
      user: admin
      password: secret
      server: lb.mydomain.com
  delegate_to: localhost

- name: Remove BIG-IP Monitor
  bigip_gtm_monitor_bigip:
    state: absent
    name: my_monitor
    provider:
      user: admin
      password: secret
      server: lb.mydomain.com
  delegate_to: localhost

- name: Add BIG-IP monitor for all addresses, port 514
  bigip_gtm_monitor_bigip:
    port: 514
    name: my_monitor
    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: bigip
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
aggregate_dynamic_ratios:
  description: The new aggregate of to the monitor.
  returned: changed
  type: str
  sample: sum-members
ignore_down_response:
  description: Whether to ignore the down response or not.
  returned: changed
  type: bool
  sample: True
N(t
AnsibleModule(tenv_fallback(tF5RestClient(t
F5ModuleError(tAnsibleF5Parameters(tfq_name(tf5_argument_spec(ttransform_name(tmodule_provisioned(tis_valid_ipt
ParameterscB`s�eZidd6dd6dd6ZddddddgZdd	d
ddddgZdddddgZed��Zed��Zed
��Z	RS(tparenttdefaultsFromtignore_down_responsetignoreDownResponsetaggregate_dynamic_ratiostaggregateDynamicRatiostintervalttimeouttdestinationtiptportcC`s`|jddkrdSdt|jd�ko;dknrOtd��nt|jd�S(NRii�Qs*Interval value must be between 1 and 86400(t_valuestNonetintR(tself((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pyR�s)cC`s(|jddkrdSt|jd�S(NR(RRR (R!((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pyR�scC`sdS(Ntbigip((R!((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pyttypes(
t__name__t
__module__tapi_maptapi_attributestreturnablest
updatablestpropertyRRR#(((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pyR�s
			t
ApiParameterscB`s5eZed��Zed��Zed��ZRS(cC`s |jdjd�\}}|S(NRt:(Rtsplit(R!RR((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pyR	scC`s&|jdjd�\}}t|�S(NRR,(RR-R (R!RR((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pyRscC`s2|jddkrdS|jddkr.tStS(NRtdisabled(RRtFalsetTrue(R!((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pyRs
(R$R%R*RRR(((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pyR+stModuleParameterscB`sDeZed��Zed��Zed��Zed��ZRS(cC`s>|jdkr"|jdkr"dSdj|j|j�}|S(Ns{0}:{1}(RRRtformat(R!R((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pyRscC`s~|jddkrdS|jdjd�r^tjj|jd�}dj|j|�}ndj|j|jd�}|S(NRt/s/{0}/{1}(RRt
startswithtostpathtbasenameR2t	partition(R!Rtresult((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pyR$scC`s\|jddkrdS|jddkr.dSt|jd�rL|jdStd��dS(NRt*s0.0.0.0s1The provided 'ip' parameter is not an IP address.(R:s0.0.0.0(RRRR(R!((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pyR/scC`s?|jddkrdS|jddkr.dSt|jd�S(NRR:(RRR (R!((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pyR<s
(R$R%R*RRRR(((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pyR1s
tChangescB`seZd�ZRS(cC`s]i}y>x$|jD]}t||�||<qW|j|�}|SWntk
rX|SXdS(N(R(tgetattrt_filter_paramst	Exception(R!R9t
returnable((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pyt	to_returnFs
(R$R%R@(((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pyR;Est
UsableChangescB`seZed��ZRS(cC`s|jdrdSdS(NRtenabledR.(R(R!((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pyRRs
(R$R%R*R(((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pyRAQstReportableChangescB`seZRS((R$R%(((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pyRCYst
DifferencecB`sSeZdd�Zd�Zed��Zed��Zed��Zd�Z	RS(cC`s||_||_dS(N(twantthave(R!RERF((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pyt__init__^s	cC`s?yt||�}|SWn!tk
r:|j|�}|SXdS(N(R<tAttributeErrort_Difference__default(R!tparamR9((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pytcomparebs
cC`s+|jj|jjkr'td��ndS(Ns$The parent monitor cannot be changed(RERRFR(R!((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pyRjscC`s�|jjdkr(|jjdkr(dS|jjdkrZ|jji|jjd6�n|jjdkr�|jji|jjd6�n|jjdkr�|jjdkr�td��n|jj|jjkr�|jjSdS(NRRR:sASpecifying an IP address requires that a port number be specified(NR:(RERRRtupdateRFRR(R!((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pyRqs$  $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'.(RERRRRRF(R!((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pyR�s$cC`sQt|j|�}y&t|j|�}||kr7|SWntk
rL|SXdS(N(R<RERFRH(R!RJtattr1tattr2((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pyt	__default�s
N(
R$R%RRGRKR*RRRRI(((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pyRD]s	t
ModuleManagercB`s�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�ZRS(cO`s[|jdd�|_t|jj�|_d|_td|jj�|_t	�|_
dS(Ntmoduletparams(tgetRRQR
RRtclientRFR1RERAtchanges(R!targstkwargs((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pyRG�s
	cC`sji}xBtjD]7}t|j|�dk	rt|j|�||<qqW|rftd|�|_ndS(NRR(RR(R<RERRARU(R!tchangedtkey((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pyt_set_changed_options�scC`s�t|j|j�}tj}t�}x9|D]1}|j|�}|dkrUq.q.|||<q.W|rtd|�|_	t
StS(NRR(RDRERFRR)tdictRKRRARUR0R/(R!tdiffR)RXtktchange((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pyt_update_changed_options�s		
cC`sH|jdg�}x/|D]'}|jjd|dd|d�qWdS(Nt
__warningstmsgtversion(tpopRQt	deprecate(R!R9twarningstwarning((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pyt_announce_deprecations�s


cC`s|jjdkr,|jjidd6�n|jjdkrX|jjidd6�n|jjdkr�|jjidd6�n|jjdkr�|jjidd6�n|jjdkr�|jjitd6�n|jj	dkr|jjid	d
6�ndS(NixRiRR:RRRtnoneR(
RERRRLRRRRR/R(R!((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.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.tpresentR.tabsentRRRX(spresentsdisabled(RRTRR/R[REtstateRkRlRCRUR@RLRg(R!RXR9Rmt
reportableRU((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pytexec_module�s 	

cC`s$|j�r|j�S|j�SdS(N(texistsRLtcreate(R!((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pyRk�s
cC`s2|j�|j�|jjr$tS|j�tS(N(RZRiRQt
check_modeR0tcreate_on_device(R!((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pyRq�s


cC`s|j�}|rtStS(N(R_R0R/(R!R9((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pyt
should_update�scC`s=|j�|_|j�stS|jjr/tS|j�tS(N(tread_current_from_deviceRFRtR/RQRrR0tupdate_on_device(R!((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pyRL�s
cC`s|j�r|j�StS(N(RptremoveR/(R!((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pyRls
cC`s9|jjrtS|j�|j�r5td��ntS(NsFailed to delete the monitor.(RQRrR0tremove_from_deviceRpR(R!((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pyRws
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/monitor/bigip/{2}tservertserver_porti�tcode(R2RTtproviderRRER8tnametapiRStjsont
ValueErrorR/RR0(R!turitresptresponse((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pyRps


+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}R8s*https://{0}:{1}/mgmt/tm/gtm/monitor/bigip/RyRzRR{i�i�tmessage(i�i�(RUt
api_paramsRER}R8R2RTR|R~tpostRR�Rtstrtcontent(R!RRR�R�R�tex((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pyRs#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/monitor/bigip/{2}RyRzRR{i�R�(RUR�R2RTR|RRER8R}R~tpatchRR�RR�R�(R!RRR�R�R�R�((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pyRv7s

cC`sjdj|jjd|jjdt|jj|jj��}|jjj|�}|j	dkrft
SdS(Ns-https://{0}:{1}/mgmt/tm/gtm/monitor/bigip/{2}RyRzi�(R2RTR|RRER8R}R~tdeleteRR0(R!R�R�((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pyRxJs

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/monitor/bigip/{2}RyRzR{i�R�RR(R2RTR|RRER8R}R~RSRR�RR�R�R+(R!R�R�R�R�((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pyRuTs

(R$R%RGRZR_RgRiRoRkRqRtRLRlRwRpRsRvRxRu(((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pyRP�s"																	
tArgumentSpeccB`seZd�ZRS(cC`s�t|_tdtdt�dtdd�dt�dt�dtd	d
�dtd	d
�dtd	d
�dtddddddg�dtdddddg�dtdddtdgf��
}i|_|jjt�|jj|�dS(NR}trequiredRtdefaults
/Common/bigipRRRR#R RRtboolRtchoicesRhs
average-nodess	sum-nodessaverage-membersssum-membersRmRkRlR8tCommontfallbacktF5_PARTITION(R0tsupports_check_modeR[R	t
argument_specRLR(R!R�((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pyRGis(				(R$R%RG(((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pyR�hscC`s�t�}td|jd|j�}y,td|�}|j�}|j|�Wn)tk
r{}|jdt	|��nXdS(NR�R�RQRa(
R�RR�R�RPRot	exit_jsonRt	fail_jsonR�(tspecRQtmmtresultsR�((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pytmain�s		t__main__(+t
__future__RRRR#t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR5tansible.module_utils.basicRR	t%library.module_utils.network.f5.bigipR
t&library.module_utils.network.f5.commonRRR
RRt(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.icontrolt)ansible.module_utils.network.f5.ipaddressRR+R1R;RARCtobjectRDRPR�R�R$(((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_gtm_monitor_bigip.pyt<module>sP


r!!
,)C�	

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