|
|
|
@ -4,15 +4,19 @@
|
|
|
|
|
# Copyright (c) 2017 F5 Networks Inc.
|
|
|
|
|
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
|
|
|
|
|
|
|
|
from __future__ import absolute_import, division, print_function
|
|
|
|
|
__metaclass__ = type
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|
|
|
|
'status': ['preview'],
|
|
|
|
|
'supported_by': 'community'}
|
|
|
|
|
|
|
|
|
|
DOCUMENTATION = '''
|
|
|
|
|
DOCUMENTATION = r'''
|
|
|
|
|
---
|
|
|
|
|
module: bigip_monitor_tcp_half_open
|
|
|
|
|
short_description: Manages F5 BIG-IP LTM tcp monitors.
|
|
|
|
|
description: Manages F5 BIG-IP LTM tcp monitors via iControl SOAP API.
|
|
|
|
|
short_description: Manages F5 BIG-IP LTM tcp half-open monitors
|
|
|
|
|
description: Manages F5 BIG-IP LTM tcp half-open monitors.
|
|
|
|
|
version_added: "2.4"
|
|
|
|
|
options:
|
|
|
|
|
name:
|
|
|
|
@ -24,9 +28,9 @@ options:
|
|
|
|
|
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(tcp)
|
|
|
|
|
been set, it cannot be changed. By default, this value is the C(tcp_half_open)
|
|
|
|
|
parent on the C(Common) partition.
|
|
|
|
|
default: "/Common/tcp"
|
|
|
|
|
default: "/Common/tcp_half_open"
|
|
|
|
|
ip:
|
|
|
|
|
description:
|
|
|
|
|
- IP address part of the IP/port definition. If this parameter is not
|
|
|
|
@ -34,6 +38,13 @@ options:
|
|
|
|
|
'*'.
|
|
|
|
|
- If this value is an IP address, and the C(type) is C(tcp) (the default),
|
|
|
|
|
then a C(port) number must be specified.
|
|
|
|
|
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
|
|
|
|
|
version_added: 2.5
|
|
|
|
|
interval:
|
|
|
|
|
description:
|
|
|
|
|
- The interval specifying how frequently the monitor instance of this
|
|
|
|
@ -56,6 +67,11 @@ options:
|
|
|
|
|
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.
|
|
|
|
|
partition:
|
|
|
|
|
description:
|
|
|
|
|
- Device partition to manage resources on.
|
|
|
|
|
default: Common
|
|
|
|
|
version_added: 2.5
|
|
|
|
|
notes:
|
|
|
|
|
- Requires the f5-sdk Python package on the host. This is as easy as pip
|
|
|
|
|
install f5-sdk.
|
|
|
|
@ -67,53 +83,62 @@ author:
|
|
|
|
|
- Tim Rupp (@caphrim007)
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
EXAMPLES = '''
|
|
|
|
|
EXAMPLES = r'''
|
|
|
|
|
- name: Create TCP Monitor
|
|
|
|
|
bigip_monitor_tcp_half_open:
|
|
|
|
|
state: "present"
|
|
|
|
|
ip: "10.10.10.10"
|
|
|
|
|
server: "lb.mydomain.com"
|
|
|
|
|
user: "admin"
|
|
|
|
|
password: "secret"
|
|
|
|
|
name: "my_tcp_monitor"
|
|
|
|
|
state: present
|
|
|
|
|
ip: 10.10.10.10
|
|
|
|
|
server: lb.mydomain.com
|
|
|
|
|
user: admin
|
|
|
|
|
password: secret
|
|
|
|
|
name: my_tcp_monitor
|
|
|
|
|
delegate_to: localhost
|
|
|
|
|
|
|
|
|
|
- name: Remove TCP Monitor
|
|
|
|
|
bigip_monitor_tcp_half_open:
|
|
|
|
|
state: "absent"
|
|
|
|
|
server: "lb.mydomain.com"
|
|
|
|
|
user: "admin"
|
|
|
|
|
password: "secret"
|
|
|
|
|
name: "my_tcp_monitor"
|
|
|
|
|
state: absent
|
|
|
|
|
server: lb.mydomain.com
|
|
|
|
|
user: admin
|
|
|
|
|
password: secret
|
|
|
|
|
name: my_tcp_monitor
|
|
|
|
|
delegate_to: localhost
|
|
|
|
|
|
|
|
|
|
- name: Add half-open monitor for all addresses, port 514
|
|
|
|
|
bigip_monitor_tcp_half_open:
|
|
|
|
|
server: lb.mydomain.com
|
|
|
|
|
user: admin
|
|
|
|
|
port: 514
|
|
|
|
|
password: secret
|
|
|
|
|
name: my_tcp_monitor
|
|
|
|
|
delegate_to: localhost
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
RETURN = '''
|
|
|
|
|
RETURN = r'''
|
|
|
|
|
parent:
|
|
|
|
|
description: New parent template of the monitor.
|
|
|
|
|
returned: changed
|
|
|
|
|
type: string
|
|
|
|
|
sample: "tcp"
|
|
|
|
|
description: New parent template of the monitor.
|
|
|
|
|
returned: changed
|
|
|
|
|
type: string
|
|
|
|
|
sample: tcp
|
|
|
|
|
ip:
|
|
|
|
|
description: The new IP of IP/port definition.
|
|
|
|
|
returned: changed
|
|
|
|
|
type: string
|
|
|
|
|
sample: "10.12.13.14"
|
|
|
|
|
description: The new IP of IP/port definition.
|
|
|
|
|
returned: changed
|
|
|
|
|
type: string
|
|
|
|
|
sample: 10.12.13.14
|
|
|
|
|
interval:
|
|
|
|
|
description: The new interval in which to run the monitor check.
|
|
|
|
|
returned: changed
|
|
|
|
|
type: int
|
|
|
|
|
sample: 2
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
description: The new time in which to mark a system as up after first successful response.
|
|
|
|
|
returned: changed
|
|
|
|
|
type: int
|
|
|
|
|
sample: 2
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
import os
|
|
|
|
@ -128,8 +153,8 @@ from ansible.module_utils.f5_utils import AnsibleF5Client
|
|
|
|
|
from ansible.module_utils.f5_utils import AnsibleF5Parameters
|
|
|
|
|
from ansible.module_utils.f5_utils import HAS_F5SDK
|
|
|
|
|
from ansible.module_utils.f5_utils import F5ModuleError
|
|
|
|
|
from ansible.module_utils.f5_utils import iteritems
|
|
|
|
|
from ansible.module_utils.f5_utils import defaultdict
|
|
|
|
|
from ansible.module_utils.six import iteritems
|
|
|
|
|
from collections import defaultdict
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError
|
|
|
|
@ -508,7 +533,7 @@ class ArgumentSpec(object):
|
|
|
|
|
self.supports_check_mode = True
|
|
|
|
|
self.argument_spec = dict(
|
|
|
|
|
name=dict(required=True),
|
|
|
|
|
parent=dict(),
|
|
|
|
|
parent=dict(default='tcp_half_open'),
|
|
|
|
|
ip=dict(),
|
|
|
|
|
port=dict(type='int'),
|
|
|
|
|
interval=dict(type='int'),
|
|
|
|
|