|
|
@ -24,12 +24,16 @@ options:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Specifies the name of the monitor.
|
|
|
|
- Specifies the name of the monitor.
|
|
|
|
required: True
|
|
|
|
required: True
|
|
|
|
|
|
|
|
description:
|
|
|
|
|
|
|
|
description:
|
|
|
|
|
|
|
|
- The description of the monitor.
|
|
|
|
|
|
|
|
version_added: 2.7
|
|
|
|
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(http)
|
|
|
|
been set, it cannot be changed. By default, this value is the C(http)
|
|
|
|
parent on the C(Common) partition.
|
|
|
|
parent on the C(Common) partition.
|
|
|
|
default: "/Common/external"
|
|
|
|
default: /Common/external
|
|
|
|
arguments:
|
|
|
|
arguments:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Specifies any command-line arguments that the script requires.
|
|
|
|
- Specifies any command-line arguments that the script requires.
|
|
|
@ -59,12 +63,14 @@ options:
|
|
|
|
timeout:
|
|
|
|
timeout:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- The number of seconds in which the node or service must respond to
|
|
|
|
- The number of seconds in which the node or service must respond to
|
|
|
|
the monitor request. If the target responds within the set time
|
|
|
|
the monitor request.
|
|
|
|
period, it is considered up. If the target does not respond within
|
|
|
|
- If the target responds within the set time period, it is considered up.
|
|
|
|
the set time period, it is considered down. You can change this
|
|
|
|
- If the target does not respond within the set time period, it is considered
|
|
|
|
number to any number you want, however, it should be 3 times the
|
|
|
|
down.
|
|
|
|
interval number of seconds plus 1 second. If this parameter is not
|
|
|
|
- You can change this number to any number you want, however, it should be
|
|
|
|
provided when creating a new monitor, then the default value will be 16.
|
|
|
|
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 C(16).
|
|
|
|
variables:
|
|
|
|
variables:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Specifies any variables that the script requires.
|
|
|
|
- Specifies any variables that the script requires.
|
|
|
@ -84,6 +90,7 @@ options:
|
|
|
|
extends_documentation_fragment: f5
|
|
|
|
extends_documentation_fragment: f5
|
|
|
|
author:
|
|
|
|
author:
|
|
|
|
- Tim Rupp (@caphrim007)
|
|
|
|
- Tim Rupp (@caphrim007)
|
|
|
|
|
|
|
|
- Wojciech Wypior (@wojtek0806)
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
|
|
EXAMPLES = r'''
|
|
|
|
EXAMPLES = r'''
|
|
|
@ -130,6 +137,11 @@ parent:
|
|
|
|
returned: changed
|
|
|
|
returned: changed
|
|
|
|
type: string
|
|
|
|
type: string
|
|
|
|
sample: external
|
|
|
|
sample: external
|
|
|
|
|
|
|
|
description:
|
|
|
|
|
|
|
|
description: The description of the monitor.
|
|
|
|
|
|
|
|
returned: changed
|
|
|
|
|
|
|
|
type: str
|
|
|
|
|
|
|
|
sample: Important Monitor
|
|
|
|
ip:
|
|
|
|
ip:
|
|
|
|
description: The new IP of IP/port definition.
|
|
|
|
description: The new IP of IP/port definition.
|
|
|
|
returned: changed
|
|
|
|
returned: changed
|
|
|
@ -163,6 +175,7 @@ try:
|
|
|
|
from library.module_utils.network.f5.common import fq_name
|
|
|
|
from library.module_utils.network.f5.common import fq_name
|
|
|
|
from library.module_utils.network.f5.common import f5_argument_spec
|
|
|
|
from library.module_utils.network.f5.common import f5_argument_spec
|
|
|
|
from library.module_utils.network.f5.common import compare_dictionary
|
|
|
|
from library.module_utils.network.f5.common import compare_dictionary
|
|
|
|
|
|
|
|
from library.module_utils.network.f5.ipaddress import is_valid_ip
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
from library.module_utils.network.f5.common import iControlUnexpectedHTTPError
|
|
|
|
from library.module_utils.network.f5.common import iControlUnexpectedHTTPError
|
|
|
|
except ImportError:
|
|
|
|
except ImportError:
|
|
|
@ -176,17 +189,12 @@ except ImportError:
|
|
|
|
from ansible.module_utils.network.f5.common import fq_name
|
|
|
|
from ansible.module_utils.network.f5.common import fq_name
|
|
|
|
from ansible.module_utils.network.f5.common import f5_argument_spec
|
|
|
|
from ansible.module_utils.network.f5.common import f5_argument_spec
|
|
|
|
from ansible.module_utils.network.f5.common import compare_dictionary
|
|
|
|
from ansible.module_utils.network.f5.common import compare_dictionary
|
|
|
|
|
|
|
|
from ansible.module_utils.network.f5.ipaddress import is_valid_ip
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
from ansible.module_utils.network.f5.common import iControlUnexpectedHTTPError
|
|
|
|
from ansible.module_utils.network.f5.common import iControlUnexpectedHTTPError
|
|
|
|
except ImportError:
|
|
|
|
except ImportError:
|
|
|
|
HAS_F5SDK = False
|
|
|
|
HAS_F5SDK = False
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
import netaddr
|
|
|
|
|
|
|
|
HAS_NETADDR = True
|
|
|
|
|
|
|
|
except ImportError:
|
|
|
|
|
|
|
|
HAS_NETADDR = False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Parameters(AnsibleF5Parameters):
|
|
|
|
class Parameters(AnsibleF5Parameters):
|
|
|
|
api_map = {
|
|
|
|
api_map = {
|
|
|
@ -197,17 +205,17 @@ class Parameters(AnsibleF5Parameters):
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
api_attributes = [
|
|
|
|
api_attributes = [
|
|
|
|
'defaultsFrom', 'interval', 'timeout', 'destination', 'run', 'args'
|
|
|
|
'defaultsFrom', 'interval', 'timeout', 'destination', 'run', 'args', 'description'
|
|
|
|
]
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
returnables = [
|
|
|
|
returnables = [
|
|
|
|
'parent', 'ip', 'port', 'interval', 'timeout', 'variables', 'external_program',
|
|
|
|
'parent', 'ip', 'port', 'interval', 'timeout', 'variables', 'external_program',
|
|
|
|
'arguments'
|
|
|
|
'arguments', 'description'
|
|
|
|
]
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
updatables = [
|
|
|
|
updatables = [
|
|
|
|
'destination', 'interval', 'timeout', 'variables', 'external_program',
|
|
|
|
'destination', 'interval', 'timeout', 'variables', 'external_program',
|
|
|
|
'arguments'
|
|
|
|
'arguments', 'description'
|
|
|
|
]
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
def to_return(self):
|
|
|
|
def to_return(self):
|
|
|
@ -256,12 +264,11 @@ class Parameters(AnsibleF5Parameters):
|
|
|
|
def ip(self):
|
|
|
|
def ip(self):
|
|
|
|
if self._values['ip'] is None:
|
|
|
|
if self._values['ip'] is None:
|
|
|
|
return None
|
|
|
|
return None
|
|
|
|
try:
|
|
|
|
|
|
|
|
if self._values['ip'] in ['*', '0.0.0.0']:
|
|
|
|
if self._values['ip'] in ['*', '0.0.0.0']:
|
|
|
|
return '*'
|
|
|
|
return '*'
|
|
|
|
result = str(netaddr.IPAddress(self._values['ip']))
|
|
|
|
elif is_valid_ip(self._values['ip']):
|
|
|
|
return result
|
|
|
|
return self._values['ip']
|
|
|
|
except netaddr.core.AddrFormatError:
|
|
|
|
else:
|
|
|
|
raise F5ModuleError(
|
|
|
|
raise F5ModuleError(
|
|
|
|
"The provided 'ip' parameter is not an IP address."
|
|
|
|
"The provided 'ip' parameter is not an IP address."
|
|
|
|
)
|
|
|
|
)
|
|
|
@ -609,6 +616,7 @@ class ArgumentSpec(object):
|
|
|
|
argument_spec = dict(
|
|
|
|
argument_spec = dict(
|
|
|
|
name=dict(required=True),
|
|
|
|
name=dict(required=True),
|
|
|
|
parent=dict(default='/Common/external'),
|
|
|
|
parent=dict(default='/Common/external'),
|
|
|
|
|
|
|
|
description=dict(),
|
|
|
|
arguments=dict(),
|
|
|
|
arguments=dict(),
|
|
|
|
ip=dict(),
|
|
|
|
ip=dict(),
|
|
|
|
port=dict(type='int'),
|
|
|
|
port=dict(type='int'),
|
|
|
|