|
|
|
@ -24,12 +24,16 @@ options:
|
|
|
|
|
description:
|
|
|
|
|
- Specifies the name of the monitor.
|
|
|
|
|
required: True
|
|
|
|
|
description:
|
|
|
|
|
description:
|
|
|
|
|
- The description of the monitor.
|
|
|
|
|
version_added: 2.7
|
|
|
|
|
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.
|
|
|
|
|
default: "/Common/external"
|
|
|
|
|
default: /Common/external
|
|
|
|
|
arguments:
|
|
|
|
|
description:
|
|
|
|
|
- Specifies any command-line arguments that the script requires.
|
|
|
|
@ -59,12 +63,14 @@ options:
|
|
|
|
|
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.
|
|
|
|
|
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 C(16).
|
|
|
|
|
variables:
|
|
|
|
|
description:
|
|
|
|
|
- Specifies any variables that the script requires.
|
|
|
|
@ -84,6 +90,7 @@ options:
|
|
|
|
|
extends_documentation_fragment: f5
|
|
|
|
|
author:
|
|
|
|
|
- Tim Rupp (@caphrim007)
|
|
|
|
|
- Wojciech Wypior (@wojtek0806)
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
EXAMPLES = r'''
|
|
|
|
@ -130,6 +137,11 @@ parent:
|
|
|
|
|
returned: changed
|
|
|
|
|
type: string
|
|
|
|
|
sample: external
|
|
|
|
|
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
|
|
|
|
@ -163,6 +175,7 @@ try:
|
|
|
|
|
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 compare_dictionary
|
|
|
|
|
from library.module_utils.network.f5.ipaddress import is_valid_ip
|
|
|
|
|
try:
|
|
|
|
|
from library.module_utils.network.f5.common import iControlUnexpectedHTTPError
|
|
|
|
|
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 f5_argument_spec
|
|
|
|
|
from ansible.module_utils.network.f5.common import compare_dictionary
|
|
|
|
|
from ansible.module_utils.network.f5.ipaddress import is_valid_ip
|
|
|
|
|
try:
|
|
|
|
|
from ansible.module_utils.network.f5.common import iControlUnexpectedHTTPError
|
|
|
|
|
except ImportError:
|
|
|
|
|
HAS_F5SDK = False
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
import netaddr
|
|
|
|
|
HAS_NETADDR = True
|
|
|
|
|
except ImportError:
|
|
|
|
|
HAS_NETADDR = False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Parameters(AnsibleF5Parameters):
|
|
|
|
|
api_map = {
|
|
|
|
@ -197,17 +205,17 @@ class Parameters(AnsibleF5Parameters):
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
api_attributes = [
|
|
|
|
|
'defaultsFrom', 'interval', 'timeout', 'destination', 'run', 'args'
|
|
|
|
|
'defaultsFrom', 'interval', 'timeout', 'destination', 'run', 'args', 'description'
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
returnables = [
|
|
|
|
|
'parent', 'ip', 'port', 'interval', 'timeout', 'variables', 'external_program',
|
|
|
|
|
'arguments'
|
|
|
|
|
'arguments', 'description'
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
updatables = [
|
|
|
|
|
'destination', 'interval', 'timeout', 'variables', 'external_program',
|
|
|
|
|
'arguments'
|
|
|
|
|
'arguments', 'description'
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
def to_return(self):
|
|
|
|
@ -256,12 +264,11 @@ class Parameters(AnsibleF5Parameters):
|
|
|
|
|
def ip(self):
|
|
|
|
|
if self._values['ip'] is None:
|
|
|
|
|
return None
|
|
|
|
|
try:
|
|
|
|
|
if self._values['ip'] in ['*', '0.0.0.0']:
|
|
|
|
|
return '*'
|
|
|
|
|
result = str(netaddr.IPAddress(self._values['ip']))
|
|
|
|
|
return result
|
|
|
|
|
except netaddr.core.AddrFormatError:
|
|
|
|
|
if self._values['ip'] in ['*', '0.0.0.0']:
|
|
|
|
|
return '*'
|
|
|
|
|
elif is_valid_ip(self._values['ip']):
|
|
|
|
|
return self._values['ip']
|
|
|
|
|
else:
|
|
|
|
|
raise F5ModuleError(
|
|
|
|
|
"The provided 'ip' parameter is not an IP address."
|
|
|
|
|
)
|
|
|
|
@ -609,6 +616,7 @@ class ArgumentSpec(object):
|
|
|
|
|
argument_spec = dict(
|
|
|
|
|
name=dict(required=True),
|
|
|
|
|
parent=dict(default='/Common/external'),
|
|
|
|
|
description=dict(),
|
|
|
|
|
arguments=dict(),
|
|
|
|
|
ip=dict(),
|
|
|
|
|
port=dict(type='int'),
|
|
|
|
|