Add new parameters to bigip monitor modules (#48520)

This commit is contained in:
Tim Rupp 2018-11-10 20:34:48 -08:00 committed by GitHub
parent 240d2baebd
commit 1e57b91c35
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 642 additions and 172 deletions

View file

@ -355,12 +355,13 @@ 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 transform_name
from library.module_utils.network.f5.common import flatten_boolean
from library.module_utils.network.f5.common import exit_json
from library.module_utils.network.f5.common import fail_json
from library.module_utils.network.f5.common import flatten_boolean
from library.module_utils.network.f5.ipaddress import is_valid_ip
from library.module_utils.network.f5.ipaddress import validate_ip_v6_address
from library.module_utils.network.f5.ipaddress import validate_ip_address
from library.module_utils.network.f5.compare import cmp_str_with_none
except ImportError:
from ansible.module_utils.network.f5.bigip import F5RestClient
from ansible.module_utils.network.f5.common import F5ModuleError
@ -369,12 +370,13 @@ 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 transform_name
from ansible.module_utils.network.f5.common import flatten_boolean
from ansible.module_utils.network.f5.common import exit_json
from ansible.module_utils.network.f5.common import fail_json
from ansible.module_utils.network.f5.common import flatten_boolean
from ansible.module_utils.network.f5.ipaddress import is_valid_ip
from ansible.module_utils.network.f5.ipaddress import validate_ip_v6_address
from ansible.module_utils.network.f5.ipaddress import validate_ip_address
from ansible.module_utils.network.f5.compare import cmp_str_with_none
class Parameters(AnsibleF5Parameters):
@ -549,10 +551,22 @@ class Parameters(AnsibleF5Parameters):
class ApiParameters(Parameters):
pass
@property
def description(self):
if self._values['description'] in [None, 'none']:
return None
return self._values['description']
class ModuleParameters(Parameters):
@property
def description(self):
if self._values['description'] is None:
return None
elif self._values['description'] in ['none', '']:
return ''
return self._values['description']
@property
def manual_resume(self):
if self._values['manual_resume'] is None:
@ -605,35 +619,19 @@ class UsableChanges(Changes):
class ReportableChanges(Changes):
@property
def manual_resume(self):
if self._values['manual_resume'] is None:
return None
elif self._values['manual_resume'] == 'enabled':
return 'yes'
return 'no'
return flatten_boolean(self._values['manual_resume'])
@property
def reverse(self):
if self._values['reverse'] is None:
return None
elif self._values['reverse'] == 'enabled':
return 'yes'
return 'no'
return flatten_boolean(self._values['reverse'])
@property
def transparent(self):
if self._values['transparent'] is None:
return None
elif self._values['transparent'] == 'enabled':
return 'yes'
return 'no'
return flatten_boolean(self._values['transparent'])
@property
def adaptive(self):
if self._values['adaptive'] is None:
return None
elif self._values['adaptive'] == 'enabled':
return 'yes'
return 'no'
return flatten_boolean(self._values['adaptive'])
class Difference(object):
@ -701,6 +699,10 @@ class Difference(object):
except AttributeError:
return attr1
@property
def description(self):
return cmp_str_with_none(self.want.description, self.have.description)
class ModuleManager(object):
def __init__(self, *args, **kwargs):
@ -998,6 +1000,7 @@ def main():
argument_spec=spec.argument_spec,
supports_check_mode=spec.supports_check_mode,
)
client = F5RestClient(**module.params)
try:

View file

@ -7,6 +7,7 @@
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'certified'}
@ -176,6 +177,7 @@ try:
from library.module_utils.network.f5.common import fail_json
from library.module_utils.network.f5.common import compare_dictionary
from library.module_utils.network.f5.ipaddress import is_valid_ip
from library.module_utils.network.f5.compare import cmp_str_with_none
except ImportError:
from ansible.module_utils.network.f5.bigip import F5RestClient
from ansible.module_utils.network.f5.common import F5ModuleError
@ -188,6 +190,7 @@ except ImportError:
from ansible.module_utils.network.f5.common import exit_json
from ansible.module_utils.network.f5.common import fail_json
from ansible.module_utils.network.f5.ipaddress import is_valid_ip
from ansible.module_utils.network.f5.compare import cmp_str_with_none
class Parameters(AnsibleF5Parameters):
@ -199,18 +202,35 @@ 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', 'description',
'parent',
'ip',
'port',
'interval',
'timeout',
'variables',
'external_program',
'arguments',
'description',
]
updatables = [
'destination', 'interval', 'timeout', 'variables', 'external_program',
'arguments', 'description',
'destination',
'interval',
'timeout',
'variables',
'external_program',
'arguments',
'description',
]
@property
@ -279,6 +299,12 @@ class Parameters(AnsibleF5Parameters):
class ApiParameters(Parameters):
@property
def description(self):
if self._values['description'] in [None, 'none']:
return None
return self._values['description']
@property
def variables(self):
if self._values['variables'] is None:
@ -297,6 +323,14 @@ class ApiParameters(Parameters):
class ModuleParameters(Parameters):
@property
def description(self):
if self._values['description'] is None:
return None
elif self._values['description'] in ['none', '']:
return ''
return self._values['description']
@property
def variables(self):
if self._values['variables'] is None:
@ -425,6 +459,10 @@ class Difference(object):
)
return result
@property
def description(self):
return cmp_str_with_none(self.want.description, self.have.description)
class ModuleManager(object):
def __init__(self, *args, **kwargs):

View file

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# 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)
from __future__ import absolute_import, division, print_function
@ -85,6 +85,17 @@ options:
target_password:
description:
- Specifies the password, if the monitored target requires authentication.
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.
@ -170,6 +181,11 @@ time_until_up:
returned: changed
type: int
sample: 2
reverse:
description: Whether the monitor operates in reverse mode.
returned: changed
type: bool
sample: yes
'''
from ansible.module_utils.basic import AnsibleModule
@ -185,7 +201,9 @@ try:
from library.module_utils.network.f5.common import transform_name
from library.module_utils.network.f5.common import exit_json
from library.module_utils.network.f5.common import fail_json
from library.module_utils.network.f5.common import flatten_boolean
from library.module_utils.network.f5.ipaddress import is_valid_ip
from library.module_utils.network.f5.compare import cmp_str_with_none
except ImportError:
from ansible.module_utils.network.f5.bigip import F5RestClient
from ansible.module_utils.network.f5.common import F5ModuleError
@ -196,7 +214,9 @@ except ImportError:
from ansible.module_utils.network.f5.common import transform_name
from ansible.module_utils.network.f5.common import exit_json
from ansible.module_utils.network.f5.common import fail_json
from ansible.module_utils.network.f5.common import flatten_boolean
from ansible.module_utils.network.f5.ipaddress import is_valid_ip
from ansible.module_utils.network.f5.compare import cmp_str_with_none
class Parameters(AnsibleF5Parameters):
@ -208,18 +228,46 @@ class Parameters(AnsibleF5Parameters):
}
api_attributes = [
'timeUntilUp', 'defaultsFrom', 'interval', 'timeout', 'recv', 'send',
'destination', 'username', 'password', 'recvDisable', 'description',
'timeUntilUp',
'defaultsFrom',
'interval',
'timeout',
'recv',
'send',
'destination',
'username',
'password',
'recvDisable',
'description',
'reverse',
]
returnables = [
'parent', 'send', 'receive', 'ip', 'port', 'interval', 'timeout',
'time_until_up', 'receive_disable', 'description',
'parent',
'send',
'receive',
'ip',
'port',
'interval',
'timeout',
'time_until_up',
'receive_disable',
'description',
'reverse',
]
updatables = [
'destination', 'send', 'receive', 'interval', 'timeout', 'time_until_up',
'target_username', 'target_password', 'receive_disable', 'description',
'destination',
'send',
'receive',
'interval',
'timeout',
'time_until_up',
'target_username',
'target_password',
'receive_disable',
'description',
'reverse',
]
@property
@ -300,13 +348,27 @@ class Parameters(AnsibleF5Parameters):
def password(self):
return self._values['target_password']
@property
def reverse(self):
return flatten_boolean(self._values['reverse'])
class ApiParameters(Parameters):
pass
@property
def description(self):
if self._values['description'] in [None, 'none']:
return None
return self._values['description']
class ModuleParameters(Parameters):
pass
@property
def description(self):
if self._values['description'] is None:
return None
elif self._values['description'] in ['none', '']:
return ''
return self._values['description']
class Changes(Parameters):
@ -322,11 +384,19 @@ class Changes(Parameters):
class UsableChanges(Changes):
pass
@property
def reverse(self):
if self._values['reverse'] is None:
return None
elif self._values['reverse'] == 'yes':
return 'enabled'
return 'disabled'
class ReportableChanges(Changes):
pass
@property
def reverse(self):
return flatten_boolean(self._values['reverse'])
class Difference(object):
@ -395,6 +465,10 @@ class Difference(object):
except AttributeError:
return attr1
@property
def description(self):
return cmp_str_with_none(self.want.description, self.have.description)
class ModuleManager(object):
def __init__(self, *args, **kwargs):
@ -486,6 +560,15 @@ class ModuleManager(object):
self.have = self.read_current_from_device()
if not self.should_update():
return False
if self.want.reverse == 'enabled':
if not self.want.receive and not self.have.receive:
raise F5ModuleError(
"A 'receive' string must be specified when setting 'reverse'."
)
if self.want.time_until_up != 0 and self.have.time_until_up != 0:
raise F5ModuleError(
"Monitors with the 'reverse' attribute are not currently compatible with 'time_until_up'."
)
if self.module.check_mode:
return True
self.update_on_device()
@ -501,6 +584,15 @@ class ModuleManager(object):
def create(self):
self._set_changed_options()
if self.want.reverse == 'enabled':
if self.want.time_until_up != 0:
raise F5ModuleError(
"Monitors with the 'reverse' attribute are not currently compatible with 'time_until_up'."
)
if not self.want.receive:
raise F5ModuleError(
"A 'receive' string must be specified when setting 'reverse'."
)
self._set_default_creation_values()
if self.module.check_mode:
return True
@ -608,6 +700,7 @@ class ArgumentSpec(object):
ip=dict(),
port=dict(type='int'),
interval=dict(type='int'),
reverse=dict(type='bool'),
timeout=dict(type='int'),
time_until_up=dict(type='int'),
target_username=dict(),
@ -633,7 +726,9 @@ def main():
argument_spec=spec.argument_spec,
supports_check_mode=spec.supports_check_mode,
)
client = F5RestClient(**module.params)
try:
mm = ModuleManager(module=module, client=client)
results = mm.exec_module()

View file

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# 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)
from __future__ import absolute_import, division, print_function
@ -85,6 +85,13 @@ options:
target_password:
description:
- Specifies the password, if the monitored target requires authentication.
ssl_profile:
description:
- Specifies the SSL profile to use for the HTTPS monitor.
- Defining SSL profiles enables refined customization of the SSL attributes
for an HTTPS monitor.
- This parameter is only supported on BIG-IP versions 13.x and later.
version_added: 2.8
partition:
description:
- Device partition to manage resources on.
@ -109,21 +116,23 @@ author:
EXAMPLES = r'''
- name: Create HTTPS Monitor
bigip_monitor_https:
name: my_http_monitor
state: present
ip: 10.10.10.10
server: lb.mydomain.com
user: admin
password: secret
name: my_http_monitor
provider:
server: lb.mydomain.com
user: admin
password: secret
delegate_to: localhost
- name: Remove HTTPS Monitor
bigip_monitor_https:
state: absent
server: lb.mydomain.com
user: admin
password: secret
name: my_http_monitor
state: absent
provider:
server: lb.mydomain.com
user: admin
password: secret
delegate_to: localhost
'''
@ -174,6 +183,7 @@ try:
from library.module_utils.network.f5.common import exit_json
from library.module_utils.network.f5.common import fail_json
from library.module_utils.network.f5.ipaddress import is_valid_ip
from library.module_utils.network.f5.compare import cmp_str_with_none
except ImportError:
from ansible.module_utils.network.f5.bigip import F5RestClient
@ -187,6 +197,7 @@ except ImportError:
from ansible.module_utils.network.f5.common import fail_json
from ansible.module_utils.network.f5.common import f5_argument_spec
from ansible.module_utils.network.f5.ipaddress import is_valid_ip
from ansible.module_utils.network.f5.compare import cmp_str_with_none
class Parameters(AnsibleF5Parameters):
@ -195,21 +206,50 @@ class Parameters(AnsibleF5Parameters):
'defaultsFrom': 'parent',
'recv': 'receive',
'recvDisable': 'receive_disable',
'sslProfile': 'ssl_profile',
}
api_attributes = [
'timeUntilUp', 'defaultsFrom', 'interval', 'timeout', 'recv', 'send',
'destination', 'username', 'password', 'recvDisable', 'description',
'timeUntilUp',
'defaultsFrom',
'interval',
'timeout',
'recv',
'send',
'destination',
'username',
'password',
'recvDisable',
'description',
'sslProfile',
]
returnables = [
'parent', 'send', 'receive', 'ip', 'port', 'interval', 'timeout',
'time_until_up', 'receive_disable', 'description',
'parent',
'send',
'receive',
'ip',
'port',
'interval',
'timeout',
'time_until_up',
'receive_disable',
'description',
'ssl_profile',
]
updatables = [
'destination', 'send', 'receive', 'interval', 'timeout', 'time_until_up',
'target_username', 'target_password', 'receive_disable', 'description',
'destination',
'send',
'receive',
'interval',
'timeout',
'time_until_up',
'target_username',
'target_password',
'receive_disable',
'description',
'ssl_profile',
]
@property
@ -291,11 +331,30 @@ class Parameters(AnsibleF5Parameters):
class ApiParameters(Parameters):
pass
@property
def description(self):
if self._values['description'] in [None, 'none']:
return None
return self._values['description']
class ModuleParameters(Parameters):
pass
@property
def description(self):
if self._values['description'] is None:
return None
elif self._values['description'] in ['none', '']:
return ''
return self._values['description']
@property
def ssl_profile(self):
if self._values['ssl_profile'] is None:
return None
if self._values['ssl_profile'] in ['', 'none']:
return ''
result = fq_name(self.partition, self._values['ssl_profile'])
return result
class Changes(Parameters):
@ -375,6 +434,15 @@ class Difference(object):
if self.want.interval != self.have.interval:
return self.want.interval
@property
def ssl_profile(self):
if self.want.ssl_profile is None:
return None
if self.want.ssl_profile == '' and self.have.ssl_profile is None:
return None
if self.want.ssl_profile != self.have.ssl_profile:
return self.want.ssl_profile
def __default(self, param):
attr1 = getattr(self.want, param)
try:
@ -384,6 +452,10 @@ class Difference(object):
except AttributeError:
return attr1
@property
def description(self):
return cmp_str_with_none(self.want.description, self.have.description)
class ModuleManager(object):
def __init__(self, *args, **kwargs):
@ -601,6 +673,7 @@ class ArgumentSpec(object):
time_until_up=dict(type='int'),
target_username=dict(),
target_password=dict(no_log=True),
ssl_profile=dict(),
state=dict(
default='present',
choices=['present', 'absent']
@ -622,6 +695,7 @@ def main():
argument_spec=spec.argument_spec,
supports_check_mode=spec.supports_check_mode,
)
client = F5RestClient(**module.params)
try:

View file

@ -241,6 +241,7 @@ try:
from library.module_utils.network.f5.common import transform_name
from library.module_utils.network.f5.common import flatten_boolean
from library.module_utils.network.f5.ipaddress import is_valid_ip
from library.module_utils.network.f5.compare import cmp_str_with_none
except ImportError:
from ansible.module_utils.network.f5.bigip import F5RestClient
from ansible.module_utils.network.f5.common import F5ModuleError
@ -253,6 +254,7 @@ except ImportError:
from ansible.module_utils.network.f5.common import transform_name
from ansible.module_utils.network.f5.common import flatten_boolean
from ansible.module_utils.network.f5.ipaddress import is_valid_ip
from ansible.module_utils.network.f5.compare import cmp_str_with_none
class Parameters(AnsibleF5Parameters):
@ -368,6 +370,12 @@ class ApiParameters(Parameters):
except ValueError:
return port
@property
def description(self):
if self._values['description'] in [None, 'none']:
return None
return self._values['description']
class ModuleParameters(Parameters):
@property
@ -425,6 +433,14 @@ class ModuleParameters(Parameters):
def type(self):
return 'ldap'
@property
def description(self):
if self._values['description'] is None:
return None
elif self._values['description'] in ['none', '']:
return ''
return self._values['description']
class Changes(Parameters):
def to_return(self):
@ -536,6 +552,10 @@ class Difference(object):
except AttributeError:
return attr1
@property
def description(self):
return cmp_str_with_none(self.want.description, self.have.description)
class ModuleManager(object):
def __init__(self, *args, **kwargs):

View file

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# 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)
from __future__ import absolute_import, division, print_function
@ -135,20 +135,22 @@ author:
EXAMPLES = r'''
- name: Create SNMP DCS monitor
bigip_monitor_snmp_dca:
state: present
server: lb.mydomain.com
user: admin
password: secret
name: my_monitor
state: present
provider:
server: lb.mydomain.com
user: admin
password: secret
delegate_to: localhost
- name: Remove TCP Echo Monitor
bigip_monitor_snmp_dca:
state: absent
server: lb.mydomain.com
user: admin
password: secret
name: my_monitor
state: absent
provider:
server: lb.mydomain.com
user: admin
password: secret
delegate_to: localhost
'''
@ -238,7 +240,7 @@ try:
from library.module_utils.network.f5.common import transform_name
from library.module_utils.network.f5.common import exit_json
from library.module_utils.network.f5.common import fail_json
from library.module_utils.network.f5.compare import cmp_str_with_none
except ImportError:
from ansible.module_utils.network.f5.bigip import F5RestClient
from ansible.module_utils.network.f5.common import F5ModuleError
@ -249,6 +251,7 @@ except ImportError:
from ansible.module_utils.network.f5.common import transform_name
from ansible.module_utils.network.f5.common import exit_json
from ansible.module_utils.network.f5.common import fail_json
from ansible.module_utils.network.f5.compare import cmp_str_with_none
class Parameters(AnsibleF5Parameters):
@ -265,21 +268,56 @@ class Parameters(AnsibleF5Parameters):
}
api_attributes = [
'timeUntilUp', 'defaultsFrom', 'interval', 'timeout', 'destination', 'community',
'version', 'agentType', 'cpuCoefficient', 'cpuThreshold', 'memoryCoefficient',
'memoryThreshold', 'diskCoefficient', 'diskThreshold', 'description',
'timeUntilUp',
'defaultsFrom',
'interval',
'timeout',
'destination',
'community',
'version',
'agentType',
'cpuCoefficient',
'cpuThreshold',
'memoryCoefficient',
'memoryThreshold',
'diskCoefficient',
'diskThreshold',
'description',
]
returnables = [
'parent', 'ip', 'interval', 'timeout', 'time_until_up', 'description', 'community',
'version', 'agent_type', 'cpu_coefficient', 'cpu_threshold', 'memory_coefficient',
'memory_threshold', 'disk_coefficient', 'disk_threshold',
'parent',
'ip',
'interval',
'timeout',
'time_until_up',
'description',
'community',
'version',
'agent_type',
'cpu_coefficient',
'cpu_threshold',
'memory_coefficient',
'memory_threshold',
'disk_coefficient',
'disk_threshold',
]
updatables = [
'ip', 'interval', 'timeout', 'time_until_up', 'description', 'community',
'version', 'agent_type', 'cpu_coefficient', 'cpu_threshold', 'memory_coefficient',
'memory_threshold', 'disk_coefficient', 'disk_threshold',
'ip',
'interval',
'timeout',
'time_until_up',
'description',
'community',
'version',
'agent_type',
'cpu_coefficient',
'cpu_threshold',
'memory_coefficient',
'memory_threshold',
'disk_coefficient',
'disk_threshold',
]
@property
@ -358,11 +396,21 @@ class Parameters(AnsibleF5Parameters):
class ApiParameters(Parameters):
pass
@property
def description(self):
if self._values['description'] in [None, 'none']:
return None
return self._values['description']
class ModuleParameters(Parameters):
pass
@property
def description(self):
if self._values['description'] is None:
return None
elif self._values['description'] in ['none', '']:
return ''
return self._values['description']
class Changes(Parameters):
@ -434,6 +482,10 @@ class Difference(object):
except AttributeError:
return attr1
@property
def description(self):
return cmp_str_with_none(self.want.description, self.have.description)
class ModuleManager(object):
def __init__(self, *args, **kwargs):

View file

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# 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)
from __future__ import absolute_import, division, print_function
@ -105,7 +105,6 @@ EXAMPLES = r'''
user: admin
password: secret
name: my_tcp_monitor
type: tcp
send: tcp string to send
receive: tcp string to receive
delegate_to: localhost
@ -182,6 +181,7 @@ try:
from library.module_utils.network.f5.common import exit_json
from library.module_utils.network.f5.common import fail_json
from library.module_utils.network.f5.ipaddress import is_valid_ip
from library.module_utils.network.f5.compare import cmp_str_with_none
except ImportError:
from ansible.module_utils.network.f5.bigip import F5RestClient
@ -194,6 +194,7 @@ except ImportError:
from ansible.module_utils.network.f5.common import exit_json
from ansible.module_utils.network.f5.common import fail_json
from ansible.module_utils.network.f5.ipaddress import is_valid_ip
from ansible.module_utils.network.f5.compare import cmp_str_with_none
class Parameters(AnsibleF5Parameters):
@ -204,17 +205,35 @@ class Parameters(AnsibleF5Parameters):
}
api_attributes = [
'timeUntilUp', 'defaultsFrom', 'interval', 'timeout', 'recv', 'send',
'destination', 'description',
'timeUntilUp',
'defaultsFrom',
'interval',
'timeout',
'recv',
'send',
'destination',
'description',
]
returnables = [
'parent', 'send', 'receive', 'ip', 'port', 'interval', 'timeout',
'time_until_up', 'description',
'parent',
'send',
'receive',
'ip',
'port',
'interval',
'timeout',
'time_until_up',
'description',
]
updatables = [
'destination', 'send', 'receive', 'interval', 'timeout', 'time_until_up',
'destination',
'send',
'receive',
'interval',
'timeout',
'time_until_up',
'description',
]
@ -287,11 +306,21 @@ class Parameters(AnsibleF5Parameters):
class ApiParameters(Parameters):
pass
@property
def description(self):
if self._values['description'] in [None, 'none']:
return None
return self._values['description']
class ModuleParameters(Parameters):
pass
@property
def description(self):
if self._values['description'] is None:
return None
elif self._values['description'] in ['none', '']:
return ''
return self._values['description']
class Changes(Parameters):
@ -380,6 +409,10 @@ class Difference(object):
except AttributeError:
return attr1
@property
def description(self):
return cmp_str_with_none(self.want.description, self.have.description)
class ModuleManager(object):
def __init__(self, *args, **kwargs):

View file

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# 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)
from __future__ import absolute_import, division, print_function
@ -153,6 +153,7 @@ try:
from library.module_utils.network.f5.common import exit_json
from library.module_utils.network.f5.common import fail_json
from library.module_utils.network.f5.ipaddress import is_valid_ip
from library.module_utils.network.f5.compare import cmp_str_with_none
except ImportError:
from ansible.module_utils.network.f5.bigip import F5RestClient
from ansible.module_utils.network.f5.common import F5ModuleError
@ -163,6 +164,7 @@ except ImportError:
from ansible.module_utils.network.f5.common import exit_json
from ansible.module_utils.network.f5.common import fail_json
from ansible.module_utils.network.f5.ipaddress import is_valid_ip
from ansible.module_utils.network.f5.compare import cmp_str_with_none
class Parameters(AnsibleF5Parameters):
@ -172,16 +174,29 @@ class Parameters(AnsibleF5Parameters):
}
api_attributes = [
'timeUntilUp', 'defaultsFrom', 'interval', 'timeout', 'destination',
'timeUntilUp',
'defaultsFrom',
'interval',
'timeout',
'destination',
'description',
]
returnables = [
'parent', 'ip', 'interval', 'timeout', 'time_until_up', 'description',
'parent',
'ip',
'interval',
'timeout',
'time_until_up',
'description',
]
updatables = [
'ip', 'interval', 'timeout', 'time_until_up', 'description',
'ip',
'interval',
'timeout',
'time_until_up',
'description',
]
@property
@ -244,11 +259,21 @@ class Parameters(AnsibleF5Parameters):
class ApiParameters(Parameters):
pass
@property
def description(self):
if self._values['description'] in [None, 'none']:
return None
return self._values['description']
class ModuleParameters(Parameters):
pass
@property
def description(self):
if self._values['description'] is None:
return None
elif self._values['description'] in ['none', '']:
return ''
return self._values['description']
class Changes(Parameters):
@ -327,6 +352,10 @@ class Difference(object):
except AttributeError:
return attr1
@property
def description(self):
return cmp_str_with_none(self.want.description, self.have.description)
class ModuleManager(object):
def __init__(self, *args, **kwargs):
@ -555,6 +584,7 @@ def main():
argument_spec=spec.argument_spec,
supports_check_mode=spec.supports_check_mode,
)
client = F5RestClient(**module.params)
try:

View file

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# 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)
from __future__ import absolute_import, division, print_function
@ -170,6 +170,7 @@ try:
from library.module_utils.network.f5.common import exit_json
from library.module_utils.network.f5.common import fail_json
from library.module_utils.network.f5.ipaddress import is_valid_ip
from library.module_utils.network.f5.compare import cmp_str_with_none
except ImportError:
from ansible.module_utils.network.f5.bigip import F5RestClient
from ansible.module_utils.network.f5.common import F5ModuleError
@ -180,6 +181,7 @@ except ImportError:
from ansible.module_utils.network.f5.common import exit_json
from ansible.module_utils.network.f5.common import fail_json
from ansible.module_utils.network.f5.ipaddress import is_valid_ip
from ansible.module_utils.network.f5.compare import cmp_str_with_none
class Parameters(AnsibleF5Parameters):
@ -190,17 +192,30 @@ class Parameters(AnsibleF5Parameters):
}
api_attributes = [
'timeUntilUp', 'defaultsFrom', 'interval', 'timeout', 'destination',
'timeUntilUp',
'defaultsFrom',
'interval',
'timeout',
'destination',
'description',
]
returnables = [
'parent', 'ip', 'port', 'interval', 'timeout', 'time_until_up',
'parent',
'ip',
'port',
'interval',
'timeout',
'time_until_up',
'description',
]
updatables = [
'destination', 'interval', 'timeout', 'time_until_up', 'description',
'destination',
'interval',
'timeout',
'time_until_up',
'description',
]
@property
@ -278,11 +293,21 @@ class Parameters(AnsibleF5Parameters):
class ApiParameters(Parameters):
pass
@property
def description(self):
if self._values['description'] in [None, 'none']:
return None
return self._values['description']
class ModuleParameters(Parameters):
pass
@property
def description(self):
if self._values['description'] is None:
return None
elif self._values['description'] in ['none', '']:
return ''
return self._values['description']
class Changes(Parameters):
@ -371,6 +396,10 @@ class Difference(object):
except AttributeError:
return attr1
@property
def description(self):
return cmp_str_with_none(self.want.description, self.have.description)
class ModuleManager(object):
def __init__(self, *args, **kwargs):

View file

@ -169,6 +169,7 @@ try:
from library.module_utils.network.f5.common import transform_name
from library.module_utils.network.f5.common import exit_json
from library.module_utils.network.f5.common import fail_json
from library.module_utils.network.f5.compare import cmp_str_with_none
from library.module_utils.network.f5.ipaddress import is_valid_ip
except ImportError:
@ -181,6 +182,7 @@ except ImportError:
from ansible.module_utils.network.f5.common import transform_name
from ansible.module_utils.network.f5.common import exit_json
from ansible.module_utils.network.f5.common import fail_json
from ansible.module_utils.network.f5.compare import cmp_str_with_none
from ansible.module_utils.network.f5.ipaddress import is_valid_ip
@ -192,17 +194,35 @@ class Parameters(AnsibleF5Parameters):
}
api_attributes = [
'timeUntilUp', 'defaultsFrom', 'interval', 'timeout', 'recv', 'send',
'destination', 'description',
'timeUntilUp',
'defaultsFrom',
'interval',
'timeout',
'recv',
'send',
'destination',
'description',
]
returnables = [
'parent', 'send', 'receive', 'ip', 'port', 'interval', 'timeout',
'time_until_up', 'description',
'parent',
'send',
'receive',
'ip',
'port',
'interval',
'timeout',
'time_until_up',
'description',
]
updatables = [
'destination', 'send', 'receive', 'interval', 'timeout', 'time_until_up',
'destination',
'send',
'receive',
'interval',
'timeout',
'time_until_up',
'description',
]
@ -278,11 +298,21 @@ class Parameters(AnsibleF5Parameters):
class ApiParameters(Parameters):
pass
@property
def description(self):
if self._values['description'] in [None, 'none']:
return None
return self._values['description']
class ModuleParameters(Parameters):
pass
@property
def description(self):
if self._values['description'] is None:
return None
elif self._values['description'] in ['none', '']:
return ''
return self._values['description']
class Changes(Parameters):
@ -371,6 +401,10 @@ class Difference(object):
except AttributeError:
return attr1
@property
def description(self):
return cmp_str_with_none(self.want.description, self.have.description)
class ModuleManager(object):
def __init__(self, *args, **kwargs):

View file

@ -8,16 +8,12 @@ __metaclass__ = type
import os
import json
import pytest
import sys
from nose.plugins.skip import SkipTest
if sys.version_info < (2, 7):
raise SkipTest("F5 Ansible modules require Python >= 2.7")
from units.compat import unittest
from units.compat.mock import Mock
from units.compat.mock import patch
from ansible.module_utils.basic import AnsibleModule
try:
@ -25,17 +21,25 @@ try:
from library.modules.bigip_monitor_dns import ModuleParameters
from library.modules.bigip_monitor_dns import ModuleManager
from library.modules.bigip_monitor_dns import ArgumentSpec
from library.module_utils.network.f5.common import F5ModuleError
from library.module_utils.network.f5.common import iControlUnexpectedHTTPError
from test.unit.modules.utils import set_module_args
# In Ansible 2.8, Ansible changed import paths.
from test.units.compat import unittest
from test.units.compat.mock import Mock
from test.units.compat.mock import patch
from test.units.modules.utils import set_module_args
except ImportError:
try:
from ansible.modules.network.f5.bigip_monitor_dns import ApiParameters
from ansible.modules.network.f5.bigip_monitor_dns import ModuleParameters
from ansible.modules.network.f5.bigip_monitor_dns import ModuleManager
from ansible.modules.network.f5.bigip_monitor_dns import ArgumentSpec
from ansible.module_utils.network.f5.common import F5ModuleError
from ansible.module_utils.network.f5.common import iControlUnexpectedHTTPError
# Ansible 2.8 imports
from units.compat import unittest
from units.compat.mock import Mock
from units.compat.mock import patch
from units.modules.utils import set_module_args
except ImportError:
raise SkipTest("F5 Ansible modules require the f5-sdk Python library")

View file

@ -8,16 +8,12 @@ __metaclass__ = type
import os
import json
import pytest
import sys
from nose.plugins.skip import SkipTest
if sys.version_info < (2, 7):
raise SkipTest("F5 Ansible modules require Python >= 2.7")
from units.compat import unittest
from units.compat.mock import Mock
from units.compat.mock import patch
from ansible.module_utils.basic import AnsibleModule
try:
@ -25,17 +21,25 @@ try:
from library.modules.bigip_monitor_external import ModuleParameters
from library.modules.bigip_monitor_external import ModuleManager
from library.modules.bigip_monitor_external import ArgumentSpec
from library.module_utils.network.f5.common import F5ModuleError
from library.module_utils.network.f5.common import iControlUnexpectedHTTPError
from test.unit.modules.utils import set_module_args
# In Ansible 2.8, Ansible changed import paths.
from test.units.compat import unittest
from test.units.compat.mock import Mock
from test.units.compat.mock import patch
from test.units.modules.utils import set_module_args
except ImportError:
try:
from ansible.modules.network.f5.bigip_monitor_external import ApiParameters
from ansible.modules.network.f5.bigip_monitor_external import ModuleParameters
from ansible.modules.network.f5.bigip_monitor_external import ModuleManager
from ansible.modules.network.f5.bigip_monitor_external import ArgumentSpec
from ansible.module_utils.network.f5.common import F5ModuleError
from ansible.module_utils.network.f5.common import iControlUnexpectedHTTPError
# Ansible 2.8 imports
from units.compat import unittest
from units.compat.mock import Mock
from units.compat.mock import patch
from units.modules.utils import set_module_args
except ImportError:
raise SkipTest("F5 Ansible modules require the f5-sdk Python library")

View file

@ -15,25 +15,34 @@ from nose.plugins.skip import SkipTest
if sys.version_info < (2, 7):
raise SkipTest("F5 Ansible modules require Python >= 2.7")
from units.compat import unittest
from units.compat.mock import Mock
from units.compat.mock import patch
from ansible.module_utils.basic import AnsibleModule
try:
from library.modules.bigip_monitor_http import Parameters
from library.modules.bigip_monitor_http import ModuleManager
from library.modules.bigip_monitor_http import ArgumentSpec
from library.module_utils.network.f5.common import F5ModuleError
from library.module_utils.network.f5.common import iControlUnexpectedHTTPError
from test.unit.modules.utils import set_module_args
# In Ansible 2.8, Ansible changed import paths.
from test.units.compat import unittest
from test.units.compat.mock import Mock
from test.units.compat.mock import patch
from test.units.modules.utils import set_module_args
except ImportError:
try:
from ansible.modules.network.f5.bigip_monitor_http import Parameters
from ansible.modules.network.f5.bigip_monitor_http import ModuleManager
from ansible.modules.network.f5.bigip_monitor_http import ArgumentSpec
from ansible.module_utils.network.f5.common import F5ModuleError
from ansible.module_utils.network.f5.common import iControlUnexpectedHTTPError
# Ansible 2.8 imports
from units.compat import unittest
from units.compat.mock import Mock
from units.compat.mock import patch
from units.modules.utils import set_module_args
except ImportError:
raise SkipTest("F5 Ansible modules require the f5-sdk Python library")

View file

@ -15,25 +15,34 @@ from nose.plugins.skip import SkipTest
if sys.version_info < (2, 7):
raise SkipTest("F5 Ansible modules require Python >= 2.7")
from units.compat import unittest
from units.compat.mock import Mock
from units.compat.mock import patch
from ansible.module_utils.basic import AnsibleModule
try:
from library.modules.bigip_monitor_https import Parameters
from library.modules.bigip_monitor_https import ModuleManager
from library.modules.bigip_monitor_https import ArgumentSpec
from library.module_utils.network.f5.common import F5ModuleError
from library.module_utils.network.f5.common import iControlUnexpectedHTTPError
from test.unit.modules.utils import set_module_args
# In Ansible 2.8, Ansible changed import paths.
from test.units.compat import unittest
from test.units.compat.mock import Mock
from test.units.compat.mock import patch
from test.units.modules.utils import set_module_args
except ImportError:
try:
from ansible.modules.network.f5.bigip_monitor_https import Parameters
from ansible.modules.network.f5.bigip_monitor_https import ModuleManager
from ansible.modules.network.f5.bigip_monitor_https import ArgumentSpec
from ansible.module_utils.network.f5.common import F5ModuleError
from ansible.module_utils.network.f5.common import iControlUnexpectedHTTPError
# Ansible 2.8 imports
from units.compat import unittest
from units.compat.mock import Mock
from units.compat.mock import patch
from units.modules.utils import set_module_args
except ImportError:
raise SkipTest("F5 Ansible modules require the f5-sdk Python library")

View file

@ -8,32 +8,36 @@ __metaclass__ = type
import os
import json
import pytest
import sys
from nose.plugins.skip import SkipTest
if sys.version_info < (2, 7):
raise SkipTest("F5 Ansible modules require Python >= 2.7")
from units.compat import unittest
from units.compat.mock import Mock
from units.compat.mock import patch
from ansible.module_utils.basic import AnsibleModule
try:
from library.modules.bigip_monitor_snmp_dca import Parameters
from library.modules.bigip_monitor_snmp_dca import ModuleManager
from library.modules.bigip_monitor_snmp_dca import ArgumentSpec
from library.module_utils.network.f5.common import F5ModuleError
from library.module_utils.network.f5.common import iControlUnexpectedHTTPError
from test.unit.modules.utils import set_module_args
# In Ansible 2.8, Ansible changed import paths.
from test.units.compat import unittest
from test.units.compat.mock import Mock
from test.units.compat.mock import patch
from test.units.modules.utils import set_module_args
except ImportError:
try:
from ansible.modules.network.f5.bigip_monitor_snmp_dca import Parameters
from ansible.modules.network.f5.bigip_monitor_snmp_dca import ModuleManager
from ansible.modules.network.f5.bigip_monitor_snmp_dca import ArgumentSpec
from ansible.module_utils.network.f5.common import F5ModuleError
from ansible.module_utils.network.f5.common import iControlUnexpectedHTTPError
# Ansible 2.8 imports
from units.compat import unittest
from units.compat.mock import Mock
from units.compat.mock import patch
from units.modules.utils import set_module_args
except ImportError:
raise SkipTest("F5 Ansible modules require the f5-sdk Python library")

View file

@ -15,25 +15,34 @@ from nose.plugins.skip import SkipTest
if sys.version_info < (2, 7):
raise SkipTest("F5 Ansible modules require Python >= 2.7")
from units.compat import unittest
from units.compat.mock import Mock
from units.compat.mock import patch
from ansible.module_utils.basic import AnsibleModule
try:
from library.modules.bigip_monitor_tcp import Parameters
from library.modules.bigip_monitor_tcp import ModuleManager
from library.modules.bigip_monitor_tcp import ArgumentSpec
from library.module_utils.network.f5.common import F5ModuleError
from library.module_utils.network.f5.common import iControlUnexpectedHTTPError
from test.unit.modules.utils import set_module_args
# In Ansible 2.8, Ansible changed import paths.
from test.units.compat import unittest
from test.units.compat.mock import Mock
from test.units.compat.mock import patch
from test.units.modules.utils import set_module_args
except ImportError:
try:
from ansible.modules.network.f5.bigip_monitor_tcp import Parameters
from ansible.modules.network.f5.bigip_monitor_tcp import ModuleManager
from ansible.modules.network.f5.bigip_monitor_tcp import ArgumentSpec
from ansible.module_utils.network.f5.common import F5ModuleError
from ansible.module_utils.network.f5.common import iControlUnexpectedHTTPError
# Ansible 2.8 imports
from units.compat import unittest
from units.compat.mock import Mock
from units.compat.mock import patch
from units.modules.utils import set_module_args
except ImportError:
raise SkipTest("F5 Ansible modules require the f5-sdk Python library")

View file

@ -15,27 +15,34 @@ from nose.plugins.skip import SkipTest
if sys.version_info < (2, 7):
raise SkipTest("F5 Ansible modules require Python >= 2.7")
from units.compat import unittest
from units.compat.mock import Mock
from units.compat.mock import patch
from ansible.module_utils.basic import AnsibleModule
try:
from library.modules.bigip_monitor_tcp_echo import Parameters
from library.modules.bigip_monitor_tcp_echo import ModuleManager
from library.modules.bigip_monitor_tcp_echo import ArgumentSpec
from library.modules.bigip_monitor_tcp_echo import HAS_F5SDK
from library.module_utils.network.f5.common import F5ModuleError
from library.module_utils.network.f5.common import iControlUnexpectedHTTPError
from test.unit.modules.utils import set_module_args
# In Ansible 2.8, Ansible changed import paths.
from test.units.compat import unittest
from test.units.compat.mock import Mock
from test.units.compat.mock import patch
from test.units.modules.utils import set_module_args
except ImportError:
try:
from ansible.modules.network.f5.bigip_monitor_tcp_echo import Parameters
from ansible.modules.network.f5.bigip_monitor_tcp_echo import ModuleManager
from ansible.modules.network.f5.bigip_monitor_tcp_echo import ArgumentSpec
from ansible.modules.network.f5.bigip_monitor_tcp_echo import HAS_F5SDK
from ansible.module_utils.network.f5.common import F5ModuleError
from ansible.module_utils.network.f5.common import iControlUnexpectedHTTPError
# Ansible 2.8 imports
from units.compat import unittest
from units.compat.mock import Mock
from units.compat.mock import patch
from units.modules.utils import set_module_args
except ImportError:
raise SkipTest("F5 Ansible modules require the f5-sdk Python library")

View file

@ -15,27 +15,34 @@ from nose.plugins.skip import SkipTest
if sys.version_info < (2, 7):
raise SkipTest("F5 Ansible modules require Python >= 2.7")
from units.compat import unittest
from units.compat.mock import Mock
from units.compat.mock import patch
from ansible.module_utils.basic import AnsibleModule
try:
from library.modules.bigip_monitor_tcp_half_open import Parameters
from library.modules.bigip_monitor_tcp_half_open import ModuleManager
from library.modules.bigip_monitor_tcp_half_open import ArgumentSpec
from library.modules.bigip_monitor_tcp_half_open import HAS_F5SDK
from library.module_utils.network.f5.common import F5ModuleError
from library.module_utils.network.f5.common import iControlUnexpectedHTTPError
from test.unit.modules.utils import set_module_args
# In Ansible 2.8, Ansible changed import paths.
from test.units.compat import unittest
from test.units.compat.mock import Mock
from test.units.compat.mock import patch
from test.units.modules.utils import set_module_args
except ImportError:
try:
from ansible.modules.network.f5.bigip_monitor_tcp_half_open import Parameters
from ansible.modules.network.f5.bigip_monitor_tcp_half_open import ModuleManager
from ansible.modules.network.f5.bigip_monitor_tcp_half_open import ArgumentSpec
from ansible.modules.network.f5.bigip_monitor_tcp_half_open import HAS_F5SDK
from ansible.module_utils.network.f5.common import F5ModuleError
from ansible.module_utils.network.f5.common import iControlUnexpectedHTTPError
# Ansible 2.8 imports
from units.compat import unittest
from units.compat.mock import Mock
from units.compat.mock import patch
from units.modules.utils import set_module_args
except ImportError:
raise SkipTest("F5 Ansible modules require the f5-sdk Python library")

View file

@ -15,25 +15,34 @@ from nose.plugins.skip import SkipTest
if sys.version_info < (2, 7):
raise SkipTest("F5 Ansible modules require Python >= 2.7")
from units.compat import unittest
from units.compat.mock import Mock
from units.compat.mock import patch
from ansible.module_utils.basic import AnsibleModule
try:
from library.modules.bigip_monitor_udp import Parameters
from library.modules.bigip_monitor_udp import ModuleManager
from library.modules.bigip_monitor_udp import ArgumentSpec
from library.module_utils.network.f5.common import F5ModuleError
from library.module_utils.network.f5.common import iControlUnexpectedHTTPError
from test.unit.modules.utils import set_module_args
# In Ansible 2.8, Ansible changed import paths.
from test.units.compat import unittest
from test.units.compat.mock import Mock
from test.units.compat.mock import patch
from test.units.modules.utils import set_module_args
except ImportError:
try:
from ansible.modules.network.f5.bigip_monitor_udp import Parameters
from ansible.modules.network.f5.bigip_monitor_udp import ModuleManager
from ansible.modules.network.f5.bigip_monitor_udp import ArgumentSpec
from ansible.module_utils.network.f5.common import F5ModuleError
from ansible.module_utils.network.f5.common import iControlUnexpectedHTTPError
# Ansible 2.8 imports
from units.compat import unittest
from units.compat.mock import Mock
from units.compat.mock import patch
from units.modules.utils import set_module_args
except ImportError:
raise SkipTest("F5 Ansible modules require the f5-sdk Python library")