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