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

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
mZddl
mZy�dd
l
mZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZWn�ek
r�dd
lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZnXdefd��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)�nd*S(+i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	certifiedtsupported_bys�
---
module: bigip_monitor_http
short_description: Manages F5 BIG-IP LTM http monitors
description: Manages F5 BIG-IP LTM http monitors.
version_added: 2.5
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(http)
        parent on the C(Common) partition.
    type: str
    default: /Common/http
  description:
    description:
      - The description of the monitor.
    type: str
    version_added: 2.7
  send:
    description:
      - The send string for the monitor call. When creating a new monitor, if
        this value is not provided, the default C(GET /\r\n) will be used.
    type: str
  receive:
    description:
      - The receive string for the monitor call.
    type: str
  receive_disable:
    description:
      - This setting works like C(receive), except that the system marks the node
        or pool member disabled when its response matches the C(receive_disable)
        string but not C(receive). To use this setting, you must specify both
        C(receive_disable) and C(receive).
    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
  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 5. 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 16.
    type: int
  time_until_up:
    description:
      - Specifies the amount of time in seconds after the first successful
        response before a node will be marked up. A value of 0 will cause a
        node to be marked up immediately after a valid response is received
        from the node. If this parameter is not provided when creating
        a new monitor, then the default value will be 0.
    type: int
  target_username:
    description:
      - Specifies the user name, if the monitored target requires authentication.
    type: str
  target_password:
    description:
      - Specifies the password, if the monitored target requires authentication.
    type: str
  reverse:
    description:
      - Specifies whether the monitor operates in reverse mode.
      - When the monitor is in reverse mode, a successful receive string match
        marks the monitored object down instead of up. You can use the
        this mode only if you configure the C(receive) option.
      - This parameter is not compatible with the C(time_until_up) parameter. If
        C(time_until_up) is specified, it must be C(0). Or, if it already exists, it
        must be C(0).
    type: bool
    version_added: 2.8
  partition:
    description:
      - Device partition to manage resources on.
    type: str
    default: Common
    version_added: 2.5
  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
    version_added: 2.5
notes:
  - Requires BIG-IP software version >= 12
extends_documentation_fragment: f5
author:
  - Tim Rupp (@caphrim007)
  - Wojciech Wypior (@wojtek0806)
s�
- name: Create HTTP Monitor
  bigip_monitor_http:
    state: present
    ip: 10.10.10.10
    name: my_http_monitor
    provider:
      server: lb.mydomain.com
      user: admin
      password: secret
  delegate_to: localhost

- name: Remove HTTP Monitor
  bigip_monitor_http:
    state: absent
    name: my_http_monitor
    provider:
      server: lb.mydomain.com
      user: admin
      password: secret
  delegate_to: localhost

- name: Include a username and password in the HTTP monitor
  bigip_monitor_http:
    state: absent
    name: my_http_monitor
    target_username: monitor_user
    target_password: monitor_pass
    provider:
      server: lb.mydomain.com
      user: admin
      password: secret
  delegate_to: localhost
sa
parent:
  description: New parent template of the monitor.
  returned: changed
  type: str
  sample: http
description:
  description: The description of the monitor.
  returned: changed
  type: str
  sample: Important_Monitor
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
time_until_up:
  description: The new time in which to mark a system as up after first successful response.
  returned: changed
  type: int
  sample: 2
reverse:
  description: Whether the monitor operates in reverse mode.
  returned: changed
  type: bool
  sample: yes
(t
AnsibleModule(tenv_fallback(tF5RestClient(t
F5ModuleError(tAnsibleF5Parameters(tfq_name(tf5_argument_spec(ttransform_name(tflatten_boolean(tis_valid_ip(tcmp_str_with_nonet
ParameterscB`sYeZidd6dd6dd6dd6Zdddd	dd
ddd
dddgZdd
ddddd	ddddgZdd
ddd	ddddddgZed��Zejd��Zed��Z	ed��Z
ed��Zed��Zed��Z
ed��Zed��Zed��Zed��Zed��ZRS( t
time_until_upttimeUntilUptparenttdefaultsFromtreceivetrecvtreceive_disabletrecvDisabletintervalttimeouttsendtdestinationtusernametpasswordtdescriptiontreversetiptportttarget_usernamettarget_passwordcC`s>|jdkr"|jdkr"dSdj|j|j�}|S(Ns{0}:{1}(R$tNoneR%tformat(tselfR((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyRscC`s3|jd�\}}||jd<||jd<dS(Nt:R$R%(tsplitt_values(R*tvalueR$R%((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.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*((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyR*s)cC`s(|jddkrdSt|jd�S(NR(R-R(R/(R*((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyR7scC`s\|jddkrdS|jddkr.dSt|jd�rL|jdStd��dS(NR$t*s0.0.0.0s1The provided 'ip' parameter is not an IP address.(R0s0.0.0.0(R-R(RR(R*((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyR$=scC`s?|jddkrdS|jddkr.dSt|jd�S(NR%R0(R-R(R/(R*((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyR%Js
cC`s(|jddkrdSt|jd�S(NR(R-R(R/(R*((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyRRscC`s4|jddkrdSt|j|jd�}|S(NR(R-R(R
t	partition(R*tresult((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyRXscC`sdS(Nthttp((R*((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyttype_scC`s|jdS(NR&(R-(R*((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyR cscC`s|jdS(NR'(R-(R*((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyR!gscC`st|jd�S(NR#(RR-(R*((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyR#ks(t__name__t
__module__tapi_maptapi_attributestreturnablest
updatablestpropertyRtsetterRRR$R%RRR4R R!R#(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyR�sf
			

t
ApiParameterscB`seZed��ZRS(cC`s"|jddkrdS|jdS(NR"tnone(NR>(R-R((R*((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyR"qs(R5R6R;R"(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyR=pstModuleParameterscB`seZed��ZRS(cC`s9|jddkrdS|jddkr.dS|jdS(NR"R>t(snoneR@(R-R((R*((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyR"ys
(R5R6R;R"(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyR?xstChangescB`seZd�ZRS(cC`sXi}y:x$|jD]}t||�||<qW|j|�}Wntk
rSnX|S(N(R9tgetattrt_filter_paramst	Exception(R*R2t
returnable((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyt	to_return�s
(R5R6RF(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyRA�st
UsableChangescB`seZed��ZRS(cC`s2|jddkrdS|jddkr.dSdS(NR#tyestenabledtdisabled(R-R((R*((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyR#�s
(R5R6R;R#(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyRG�stReportableChangescB`seZed��ZRS(cC`st|jd�S(NR#(RR-(R*((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyR#�s(R5R6R;R#(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyRK�st
DifferencecB`s�eZd	d�Zd�Zed��Zed��Zed��Zd�Z	ed��Z
ed��Zed��ZRS(
cC`s||_||_dS(N(twantthave(R*RMRN((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyt__init__�s	cC`s?yt||�}|SWn!tk
r:|j|�}|SXdS(N(RBtAttributeErrort_Difference__default(R*tparamR2((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pytcompare�s
cC`s+|jj|jjkr'td��ndS(Ns$The parent monitor cannot be changed(RMRRNR(R*((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyR�scC`s�|jjdkr(|jjdkr(dS|jjdkrZ|jji|jjd6�n|jjdkr�|jji|jjd6�n|jjdkr�|jjdkr�td��n|jj|jjkr�|jjSdS(NR%R$R0sASpecifying an IP address requires that a port number be specified(NR0(RMR$R(R%tupdateRNRR(R*((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyR�s$  $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'.(RMRR(RRRN(R*((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyR�s$cC`sQt|j|�}y&t|j|�}||kr7|SWntk
rL|SXdS(N(RBRMRNRP(R*RRtattr1tattr2((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyt	__default�s
cC`st|jj|jj�S(N(RRMR"RN(R*((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyR"�scC`st|jj|jj�S(N(RRMRRN(R*((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyR�scC`st|jj|jj�S(N(RRMRRN(R*((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyR�sN(
R5R6R(RORSR;RRRRQR"RR(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyRL�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�|_td|jj�|_t�|_	t
�|_dS(Ntmoduletparams(tgetR(RYR
RZtclientR?RMR=RNRGtchanges(R*targstkwargs((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyRO�s
cC`sji}xBtjD]7}t|j|�dk	rt|j|�||<qqW|rftd|�|_ndS(NRZ(RR9RBRMR(RGR](R*tchangedtkey((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.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(NRZ(RLRMRNRR:tdictRSR(t
isinstanceRTRGR]tTruetFalse(R*tdiffR:R`tktchange((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyt_update_changed_options�s		
cC`s|j�}|rtStS(N(RjReRf(R*R2((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyt
should_updatescC`s�t}t�}|jj}|dkr6|j�}n|dkrQ|j�}ntd|jj��}|j�}|j	|�|j	td|��|j
|�|S(NtpresenttabsentRZR`(RfRcRMtstateRlRmRKR]RFRTt_announce_deprecations(R*R`R2Rnt
reportableR]((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pytexec_modules	

cC`sK|jdg�}x2|D]*}|jjjd|dd|d�qWdS(Nt
__warningstmsgtversion(tpopR\RYt	deprecate(R*R2twarningstwarning((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyRo&s


cC`s$|j�r|j�S|j�SdS(N(texistsRTtcreate(R*((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyRl.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/ltm/monitor/http/{2}tservertserver_porti�tcode(R)R\tproviderRRMR1tnametapiR[tjsont
ValueErrorRfRRe(R*turitresptresponse((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyRy4s


+cC`s�|j�|_|j�stS|jjdkr�|jjrZ|jjrZtd��n|jjdkr�|jjdkr�td��q�n|j	j
r�tS|j�tS(NRIs<A 'receive' string must be specified when setting 'reverse'.isXMonitors with the 'reverse' attribute are not currently compatible with 'time_until_up'.(
tread_current_from_deviceRNRkRfRMR#RRRRYt
check_modeRetupdate_on_device(R*((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyRTCs$
cC`s9|jjrtS|j�|j�r5td��ntS(NsFailed to delete the monitor.(RYR�Retremove_from_deviceRyR(R*((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pytremoveUs
cC`s�|j�|jjdkr[|jjdkr=td��n|jjs[td��q[n|j�|jjrut	S|j
�t	S(NRIisXMonitors with the 'reverse' attribute are not currently compatible with 'time_until_up'.s<A 'receive' string must be specified when setting 'reverse'.(RbRMR#RRRt_set_default_creation_valuesRYR�Retcreate_on_device(R*((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyRz]s


cC`s|jjdkr,|jjidd6�n|jjdkrX|jjidd6�n|jjdkr�|jjidd6�n|jjdkr�|jjidd6�n|jjdkr�|jjidd	6�n|jjdkr|jjid
d6�ndS(NiRiRiRR0R$R%sGET /
R(	RMRR(RTRRR$R%R(R*((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyR�nscC`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(NRR1s)https://{0}:{1}/mgmt/tm/ltm/monitor/http/R{R|R�R}i�i�tmessage(i�i�(R]t
api_paramsRMRR1R)R\R~R�tpostR�R�Rtstrtcontent(R*RZR�R�R�tex((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.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/monitor/http/{2}R{R|R�R}i�R�(R]R�R)R\R~RRMR1RR�tpatchR�R�RR�R�(R*RZR�R�R�R�((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyR��s

cC`s|j�r|j�StS(N(RyR�Rf(R*((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyRm�s
cC`sjdj|jjd|jjdt|jj|jj��}|jjj|�}|j	dkrft
SdS(Ns,https://{0}:{1}/mgmt/tm/ltm/monitor/http/{2}R{R|i�(R)R\R~RRMR1RR�tdeleteRRe(R*R�R�((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.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(Ns,https://{0}:{1}/mgmt/tm/ltm/monitor/http/{2}R{R|R}i�R�RZ(R)R\R~RRMR1RR�R[R�R�RR�R�R=(R*R�R�R�R�((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyR��s

(R5R6RORbRjRkRqRoRlRyRTR�RzR�R�R�RmR�R�(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyRX�s"																
tArgumentSpeccB`seZd�ZRS(c&C`s t|_tdtdt�dtdd�dt�dt�dt�d	t�d
t�dt�dtd
d�dtd
d�dtd
d�dtd
d�dt�dtdt�dtdddddg�dtdddtdgf��}i|_|jjt�|jj|�dS(NRtrequiredRtdefaults/Common/httpR"RRRR$R%RR4R/R#tboolRRR&R'tno_logRnRltchoicesRmR1tCommontfallbacktF5_PARTITION(Retsupports_check_modeRcR	t
argument_specRTR(R*R�((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyRO�s2									(R5R6RO(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyR��scC`s�t�}td|jd|j�}y,td|�}|j�}|j|�Wn)tk
r{}|jdt	|��nXdS(NR�R�RYRs(
R�RR�R�RXRqt	exit_jsonRt	fail_jsonR�(tspecRYtmmtresultsR�((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pytmain�s		t__main__N(+t
__future__RRRR4t
__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.ipaddressRt'library.module_utils.network.f5.compareRtImportErrort%ansible.module_utils.network.f5.bigipt&ansible.module_utils.network.f5.commont)ansible.module_utils.network.f5.ipaddresst'ansible.module_utils.network.f5.compareRR=R?RARGRKtobjectRLRXR�R�R5(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_http.pyt<module>sR


y#&
�

O� 	

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