Refactors main() function and module manager in multiple modules in line with recent changes (#53981)

Adds variable types to docs
Refactors unit tests to remove deprecated parameters
pull/54015/head
Wojciech Wypior 5 years ago committed by Tim Rupp
parent 739df1c348
commit 1a411e9c6b

@ -23,6 +23,7 @@ options:
hostname: hostname:
description: description:
- Hostname of the BIG-IP host. - Hostname of the BIG-IP host.
type: str
required: True required: True
extends_documentation_fragment: f5 extends_documentation_fragment: f5
author: author:
@ -56,18 +57,12 @@ try:
from library.module_utils.network.f5.bigip import F5RestClient from library.module_utils.network.f5.bigip import F5RestClient
from library.module_utils.network.f5.common import F5ModuleError from library.module_utils.network.f5.common import F5ModuleError
from library.module_utils.network.f5.common import AnsibleF5Parameters from library.module_utils.network.f5.common import AnsibleF5Parameters
from library.module_utils.network.f5.common import cleanup_tokens
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 exit_json
from library.module_utils.network.f5.common import fail_json
except ImportError: except ImportError:
from ansible.module_utils.network.f5.bigip import F5RestClient from ansible.module_utils.network.f5.bigip import F5RestClient
from ansible.module_utils.network.f5.common import F5ModuleError from ansible.module_utils.network.f5.common import F5ModuleError
from ansible.module_utils.network.f5.common import AnsibleF5Parameters from ansible.module_utils.network.f5.common import AnsibleF5Parameters
from ansible.module_utils.network.f5.common import cleanup_tokens
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 exit_json
from ansible.module_utils.network.f5.common import fail_json
class Parameters(AnsibleF5Parameters): class Parameters(AnsibleF5Parameters):
@ -134,7 +129,7 @@ class Difference(object):
class ModuleManager(object): class ModuleManager(object):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.module = kwargs.get('module', None) self.module = kwargs.get('module', None)
self.client = kwargs.get('client', None) self.client = F5RestClient(**self.module.params)
self.have = ApiParameters() self.have = ApiParameters()
self.want = ModuleParameters(params=self.module.params) self.want = ModuleParameters(params=self.module.params)
self.changes = UsableChanges() self.changes = UsableChanges()
@ -301,16 +296,12 @@ def main():
supports_check_mode=spec.supports_check_mode supports_check_mode=spec.supports_check_mode
) )
client = F5RestClient(**module.params)
try: try:
mm = ModuleManager(module=module, client=client) mm = ModuleManager(module=module)
results = mm.exec_module() results = mm.exec_module()
cleanup_tokens(client) module.exit_json(**results)
exit_json(module, results, client)
except F5ModuleError as ex: except F5ModuleError as ex:
cleanup_tokens(client) module.fail_json(msg=str(ex))
fail_json(module, ex, client)
if __name__ == '__main__': if __name__ == '__main__':

@ -25,6 +25,7 @@ options:
name: name:
description: description:
- The name of the iApp service that you want to deploy. - The name of the iApp service that you want to deploy.
type: str
required: True required: True
template: template:
description: description:
@ -32,6 +33,7 @@ options:
template must exist on your BIG-IP before you can successfully template must exist on your BIG-IP before you can successfully
create a service. create a service.
- When creating a new service, this parameter is required. - When creating a new service, this parameter is required.
type: str
parameters: parameters:
description: description:
- A hash of all the required template variables for the iApp template. - A hash of all the required template variables for the iApp template.
@ -40,6 +42,7 @@ options:
to supply the expected parameters. to supply the expected parameters.
- These parameters typically consist of the C(lists), C(tables), and - These parameters typically consist of the C(lists), C(tables), and
C(variables) fields. C(variables) fields.
type: dict
force: force:
description: description:
- Forces the updating of an iApp service even if the parameters to the - Forces the updating of an iApp service even if the parameters to the
@ -47,19 +50,21 @@ options:
the iApp template that underlies the service has been updated in-place. the iApp template that underlies the service has been updated in-place.
This option is equivalent to re-configuring the iApp if that template This option is equivalent to re-configuring the iApp if that template
has changed. has changed.
default: no
type: bool type: bool
default: no
state: state:
description: description:
- When C(present), ensures that the iApp service is created and running. - When C(present), ensures that the iApp service is created and running.
When C(absent), ensures that the iApp service has been removed. When C(absent), ensures that the iApp service has been removed.
default: present type: str
choices: choices:
- present - present
- absent - absent
default: present
partition: partition:
description: description:
- Device partition to manage resources on. - Device partition to manage resources on.
type: str
default: Common default: Common
version_added: 2.5 version_added: 2.5
strict_updates: strict_updates:
@ -74,8 +79,8 @@ options:
- If this option is specified in the Ansible task, it will take precedence - If this option is specified in the Ansible task, it will take precedence
over any similar setting in the iApp Service payload that you provide in over any similar setting in the iApp Service payload that you provide in
the C(parameters) field. the C(parameters) field.
default: yes
type: bool type: bool
default: yes
version_added: 2.5 version_added: 2.5
traffic_group: traffic_group:
description: description:
@ -85,6 +90,7 @@ options:
- If this option is specified in the Ansible task, it will take precedence - If this option is specified in the Ansible task, it will take precedence
over any similar setting in the iApp Service payload that you provide in over any similar setting in the iApp Service payload that you provide in
the C(parameters) field. the C(parameters) field.
type: str
version_added: 2.5 version_added: 2.5
metadata: metadata:
description: description:
@ -92,6 +98,7 @@ options:
- If this option is specified in the Ansible task, it will take precedence - If this option is specified in the Ansible task, it will take precedence
over any similar setting in the iApp Service payload that you provide in over any similar setting in the iApp Service payload that you provide in
the C(parameters) field. the C(parameters) field.
type: list
version_added: 2.7 version_added: 2.7
description: description:
description: description:
@ -99,6 +106,7 @@ options:
- If this option is specified in the Ansible task, it will take precedence - If this option is specified in the Ansible task, it will take precedence
over any similar setting in the iApp Service payload that you provide in over any similar setting in the iApp Service payload that you provide in
the C(parameters) field. the C(parameters) field.
type: str
version_added: 2.7 version_added: 2.7
device_group: device_group:
description: description:
@ -106,6 +114,7 @@ options:
- If this option is specified in the Ansible task, it will take precedence - If this option is specified in the Ansible task, it will take precedence
over any similar setting in the iApp Service payload that you provide in over any similar setting in the iApp Service payload that you provide in
the C(parameters) field. the C(parameters) field.
type: str
version_added: 2.7 version_added: 2.7
extends_documentation_fragment: f5 extends_documentation_fragment: f5
author: author:
@ -264,11 +273,8 @@ try:
from library.module_utils.network.f5.bigip import F5RestClient from library.module_utils.network.f5.bigip import F5RestClient
from library.module_utils.network.f5.common import F5ModuleError from library.module_utils.network.f5.common import F5ModuleError
from library.module_utils.network.f5.common import AnsibleF5Parameters from library.module_utils.network.f5.common import AnsibleF5Parameters
from library.module_utils.network.f5.common import cleanup_tokens
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 exit_json
from library.module_utils.network.f5.common import fail_json
from library.module_utils.network.f5.common import transform_name 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 flatten_boolean
from library.module_utils.network.f5.urls import build_service_uri from library.module_utils.network.f5.urls import build_service_uri
@ -276,11 +282,8 @@ except ImportError:
from ansible.module_utils.network.f5.bigip import F5RestClient from ansible.module_utils.network.f5.bigip import F5RestClient
from ansible.module_utils.network.f5.common import F5ModuleError from ansible.module_utils.network.f5.common import F5ModuleError
from ansible.module_utils.network.f5.common import AnsibleF5Parameters from ansible.module_utils.network.f5.common import AnsibleF5Parameters
from ansible.module_utils.network.f5.common import cleanup_tokens
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 exit_json
from ansible.module_utils.network.f5.common import fail_json
from ansible.module_utils.network.f5.common import transform_name 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 flatten_boolean
from ansible.module_utils.network.f5.urls import build_service_uri from ansible.module_utils.network.f5.urls import build_service_uri
@ -676,7 +679,7 @@ class Difference(object):
class ModuleManager(object): class ModuleManager(object):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.module = kwargs.get('module', None) self.module = kwargs.get('module', None)
self.client = kwargs.get('client', None) self.client = F5RestClient(**self.module.params)
self.have = None self.have = None
self.want = ModuleParameters(params=self.module.params) self.want = ModuleParameters(params=self.module.params)
self.changes = UsableChanges() self.changes = UsableChanges()
@ -979,16 +982,12 @@ def main():
supports_check_mode=spec.supports_check_mode supports_check_mode=spec.supports_check_mode
) )
client = F5RestClient(**module.params)
try: try:
mm = ModuleManager(module=module, client=client) mm = ModuleManager(module=module)
results = mm.exec_module() results = mm.exec_module()
cleanup_tokens(client) module.exit_json(**results)
exit_json(module, results, client)
except F5ModuleError as ex: except F5ModuleError as ex:
cleanup_tokens(client) module.fail_json(msg=str(ex))
fail_json(module, ex, client)
if __name__ == '__main__': if __name__ == '__main__':

@ -46,19 +46,22 @@ options:
is only available when specifying a C(state) of C(absent) and is is only available when specifying a C(state) of C(absent) and is
provided as a way to delete templates that you may no longer have provided as a way to delete templates that you may no longer have
the source of. the source of.
type: str
content: content:
description: description:
- Sets the contents of an iApp template directly to the specified - Sets the contents of an iApp template directly to the specified
value. This is for simple values, but can be used with lookup value. This is for simple values, but can be used with lookup
plugins for anything complex or with formatting. C(content) must plugins for anything complex or with formatting. C(content) must
be provided when creating new templates. be provided when creating new templates.
type: str
state: state:
description: description:
- Whether the iApp template should exist or not. - Whether the iApp template should exist or not.
default: present type: str
choices: choices:
- present - present
- absent - absent
default: present
partition: partition:
description: description:
- Device partition to manage resources on. - Device partition to manage resources on.
@ -116,22 +119,16 @@ try:
from library.module_utils.network.f5.bigip import F5RestClient from library.module_utils.network.f5.bigip import F5RestClient
from library.module_utils.network.f5.common import F5ModuleError from library.module_utils.network.f5.common import F5ModuleError
from library.module_utils.network.f5.common import AnsibleF5Parameters from library.module_utils.network.f5.common import AnsibleF5Parameters
from library.module_utils.network.f5.common import cleanup_tokens
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 exit_json
from library.module_utils.network.f5.common import fail_json
from library.module_utils.network.f5.common import transform_name from library.module_utils.network.f5.common import transform_name
from library.module_utils.network.f5.icontrol import upload_file from library.module_utils.network.f5.icontrol import upload_file
except ImportError: except ImportError:
from ansible.module_utils.network.f5.bigip import F5RestClient from ansible.module_utils.network.f5.bigip import F5RestClient
from ansible.module_utils.network.f5.common import F5ModuleError from ansible.module_utils.network.f5.common import F5ModuleError
from ansible.module_utils.network.f5.common import AnsibleF5Parameters from ansible.module_utils.network.f5.common import AnsibleF5Parameters
from ansible.module_utils.network.f5.common import cleanup_tokens
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 exit_json
from ansible.module_utils.network.f5.common import fail_json
from ansible.module_utils.network.f5.common import transform_name from ansible.module_utils.network.f5.common import transform_name
from ansible.module_utils.network.f5.icontrol import upload_file from ansible.module_utils.network.f5.icontrol import upload_file
@ -245,7 +242,7 @@ class ReportableChanges(Changes):
class ModuleManager(object): class ModuleManager(object):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.module = kwargs.get('module', None) self.module = kwargs.get('module', None)
self.client = kwargs.get('client', None) self.client = F5RestClient(**self.module.params)
self.want = ModuleParameters(params=self.module.params) self.want = ModuleParameters(params=self.module.params)
self.have = ApiParameters() self.have = ApiParameters()
self.changes = UsableChanges() self.changes = UsableChanges()
@ -561,16 +558,12 @@ def main():
supports_check_mode=spec.supports_check_mode supports_check_mode=spec.supports_check_mode
) )
client = F5RestClient(**module.params)
try: try:
mm = ModuleManager(module=module, client=client) mm = ModuleManager(module=module)
results = mm.exec_module() results = mm.exec_module()
cleanup_tokens(client) module.exit_json(**results)
exit_json(module, results, client)
except F5ModuleError as ex: except F5ModuleError as ex:
cleanup_tokens(client) module.fail_json(msg=str(ex))
fail_json(module, ex, client)
if __name__ == '__main__': if __name__ == '__main__':

@ -23,10 +23,12 @@ options:
name: name:
description: description:
- Specifies the name of the IKE peer. - Specifies the name of the IKE peer.
type: str
required: True required: True
description: description:
description: description:
- Description of the IKE peer. - Description of the IKE peer.
type: str
version: version:
description: description:
- Specifies which version of IKE is used. - Specifies which version of IKE is used.
@ -37,6 +39,7 @@ options:
- If the system you are configuring is the IPsec responder, and you select - If the system you are configuring is the IPsec responder, and you select
both versions, the IPsec initiator system determines which IKE version to use. both versions, the IPsec initiator system determines which IKE version to use.
- When creating a new IKE peer, this value is required. - When creating a new IKE peer, this value is required.
type: list
choices: choices:
- v1 - v1
- v2 - v2
@ -44,6 +47,7 @@ options:
description: description:
- Specifies the identifier type that the local system uses to identify - Specifies the identifier type that the local system uses to identify
itself to the peer during IKE Phase 1 negotiations. itself to the peer during IKE Phase 1 negotiations.
type: str
choices: choices:
- address - address
- asn1dn - asn1dn
@ -56,6 +60,7 @@ options:
- This is a required value when C(version) includes (Cv2). - This is a required value when C(version) includes (Cv2).
- Specifies a value for the identity when using a C(presented_id_type) of - Specifies a value for the identity when using a C(presented_id_type) of
C(override). C(override).
type: str
verified_id_type: verified_id_type:
description: description:
- Specifies the identifier type that the local system uses to identify - Specifies the identifier type that the local system uses to identify
@ -63,6 +68,7 @@ options:
- This is a required value when C(version) includes (Cv2). - This is a required value when C(version) includes (Cv2).
- When C(user-fqdn), value of C(verified_id_value) must be in the form of - When C(user-fqdn), value of C(verified_id_value) must be in the form of
User @ DNS domain string. User @ DNS domain string.
type: str
choices: choices:
- address - address
- asn1dn - asn1dn
@ -75,11 +81,13 @@ options:
- This is a required value when C(version) includes (Cv2). - This is a required value when C(version) includes (Cv2).
- Specifies a value for the identity when using a C(verified_id_type) of - Specifies a value for the identity when using a C(verified_id_type) of
C(override). C(override).
type: str
phase1_auth_method: phase1_auth_method:
description: description:
- Specifies the authentication method for phase 1 negotiation. - Specifies the authentication method for phase 1 negotiation.
- When creating a new IKE peer, if this value is not specified, the default is - When creating a new IKE peer, if this value is not specified, the default is
C(rsa-signature). C(rsa-signature).
type: str
choices: choices:
- pre-shared-key - pre-shared-key
- rsa-signature - rsa-signature
@ -89,12 +97,14 @@ options:
- When creating a new IKE peer, if this value is not specified, and - When creating a new IKE peer, if this value is not specified, and
C(phase1_auth_method) is C(rsa-signature), the default is C(default.crt). C(phase1_auth_method) is C(rsa-signature), the default is C(default.crt).
- This parameter is invalid when C(phase1_auth_method) is C(pre-shared-key). - This parameter is invalid when C(phase1_auth_method) is C(pre-shared-key).
type: str
phase1_key: phase1_key:
description: description:
- Specifies the public key that the digital certificate contains. - Specifies the public key that the digital certificate contains.
- When creating a new IKE peer, if this value is not specified, and - When creating a new IKE peer, if this value is not specified, and
C(phase1_auth_method) is C(rsa-signature), the default is C(default.key). C(phase1_auth_method) is C(rsa-signature), the default is C(default.key).
- This parameter is invalid when C(phase1_auth_method) is C(pre-shared-key). - This parameter is invalid when C(phase1_auth_method) is C(pre-shared-key).
type: str
phase1_verify_peer_cert: phase1_verify_peer_cert:
description: description:
- In IKEv2, specifies whether the certificate sent by the IKE peer is verified - In IKEv2, specifies whether the certificate sent by the IKE peer is verified
@ -113,14 +123,17 @@ options:
- Specifies a string that the IKE peers share for authenticating each other. - Specifies a string that the IKE peers share for authenticating each other.
- This parameter is only relevant when C(phase1_auth_method) is C(pre-shared-key). - This parameter is only relevant when C(phase1_auth_method) is C(pre-shared-key).
- This parameter is invalid when C(phase1_auth_method) is C(rsa-signature). - This parameter is invalid when C(phase1_auth_method) is C(rsa-signature).
type: str
remote_address: remote_address:
description: description:
- Displays the IP address of the BIG-IP system that is remote to the system - Displays the IP address of the BIG-IP system that is remote to the system
you are configuring. you are configuring.
type: str
phase1_encryption_algorithm: phase1_encryption_algorithm:
description: description:
- Specifies the algorithm to use for IKE encryption. - Specifies the algorithm to use for IKE encryption.
- IKE C(version) C(v2) does not support C(blowfish), C(camellia), or C(cast128). - IKE C(version) C(v2) does not support C(blowfish), C(camellia), or C(cast128).
type: str
choices: choices:
- 3des - 3des
- des - des
@ -133,6 +146,7 @@ options:
phase1_hash_algorithm: phase1_hash_algorithm:
description: description:
- Specifies the algorithm to use for IKE authentication. - Specifies the algorithm to use for IKE authentication.
type: str
choices: choices:
- sha1 - sha1
- md5 - md5
@ -142,6 +156,7 @@ options:
phase1_perfect_forward_secrecy: phase1_perfect_forward_secrecy:
description: description:
- Specifies the Diffie-Hellman group to use for IKE Phase 1 and Phase 2 negotiations. - Specifies the Diffie-Hellman group to use for IKE Phase 1 and Phase 2 negotiations.
type: str
choices: choices:
- ecp256 - ecp256
- ecp384 - ecp384
@ -158,22 +173,25 @@ options:
description: description:
- C(always) will allow to update passwords if the user chooses to do so. - C(always) will allow to update passwords if the user chooses to do so.
C(on_create) will only set the password for newly created IKE peers. C(on_create) will only set the password for newly created IKE peers.
default: always type: str
choices: choices:
- always - always
- on_create - on_create
default: always
partition: partition:
description: description:
- Device partition to manage resources on. - Device partition to manage resources on.
type: str
default: Common default: Common
state: state:
description: description:
- When C(present), ensures that the resource exists. - When C(present), ensures that the resource exists.
- When C(absent), ensures the resource is removed. - When C(absent), ensures the resource is removed.
default: present type: str
choices: choices:
- present - present
- absent - absent
default: present
extends_documentation_fragment: f5 extends_documentation_fragment: f5
author: author:
- Tim Rupp (@caphrim007) - Tim Rupp (@caphrim007)
@ -181,9 +199,33 @@ author:
''' '''
EXAMPLES = r''' EXAMPLES = r'''
- name: Create a ... - name: Create new IKE peer
bigip_ike_peer:
name: ike1
remote_address: 1.2.3.4
version:
- v1
provider:
password: secret
server: lb.mydomain.com
user: admin
delegate_to: localhost
- name: Change presented id type - keyid-tag
bigip_ike_peer:
name: ike1
presented_id_type: keyid-tag
presented_id_value: key1
provider:
password: secret
server: lb.mydomain.com
user: admin
delegate_to: localhost
- name: Remove IKE peer
bigip_ike_peer: bigip_ike_peer:
name: foo name: ike1
state: absent
provider: provider:
password: secret password: secret
server: lb.mydomain.com server: lb.mydomain.com
@ -266,11 +308,8 @@ try:
from library.module_utils.network.f5.bigip import F5RestClient from library.module_utils.network.f5.bigip import F5RestClient
from library.module_utils.network.f5.common import F5ModuleError from library.module_utils.network.f5.common import F5ModuleError
from library.module_utils.network.f5.common import AnsibleF5Parameters from library.module_utils.network.f5.common import AnsibleF5Parameters
from library.module_utils.network.f5.common import cleanup_tokens
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 exit_json
from library.module_utils.network.f5.common import fail_json
from library.module_utils.network.f5.common import transform_name 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 flatten_boolean
from library.module_utils.network.f5.compare import cmp_str_with_none from library.module_utils.network.f5.compare import cmp_str_with_none
@ -278,11 +317,8 @@ except ImportError:
from ansible.module_utils.network.f5.bigip import F5RestClient from ansible.module_utils.network.f5.bigip import F5RestClient
from ansible.module_utils.network.f5.common import F5ModuleError from ansible.module_utils.network.f5.common import F5ModuleError
from ansible.module_utils.network.f5.common import AnsibleF5Parameters from ansible.module_utils.network.f5.common import AnsibleF5Parameters
from ansible.module_utils.network.f5.common import cleanup_tokens
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 exit_json
from ansible.module_utils.network.f5.common import fail_json
from ansible.module_utils.network.f5.common import transform_name 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 flatten_boolean
from ansible.module_utils.network.f5.compare import cmp_str_with_none from ansible.module_utils.network.f5.compare import cmp_str_with_none
@ -461,7 +497,7 @@ class Difference(object):
class ModuleManager(object): class ModuleManager(object):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.module = kwargs.get('module', None) self.module = kwargs.get('module', None)
self.client = kwargs.get('client', None) self.client = F5RestClient(**self.module.params)
self.want = ModuleParameters(params=self.module.params) self.want = ModuleParameters(params=self.module.params)
self.have = ApiParameters() self.have = ApiParameters()
self.changes = UsableChanges() self.changes = UsableChanges()
@ -756,16 +792,12 @@ def main():
required_together=spec.required_together, required_together=spec.required_together,
) )
client = F5RestClient(**module.params)
try: try:
mm = ModuleManager(module=module, client=client) mm = ModuleManager(module=module)
results = mm.exec_module() results = mm.exec_module()
cleanup_tokens(client) module.exit_json(**results)
exit_json(module, results, client)
except F5ModuleError as ex: except F5ModuleError as ex:
cleanup_tokens(client) module.fail_json(msg=str(ex))
fail_json(module, ex, client)
if __name__ == '__main__': if __name__ == '__main__':

@ -24,6 +24,7 @@ options:
route_domain: route_domain:
description: description:
- Route domain to manage BGP configuration on. - Route domain to manage BGP configuration on.
type: str
default: 0 default: 0
lines: lines:
description: description:
@ -33,6 +34,7 @@ options:
running-config. running-config.
- Be sure to note the configuration command syntax as some commands - Be sure to note the configuration command syntax as some commands
are automatically modified by the device config parser. are automatically modified by the device config parser.
type: list
aliases: ['commands'] aliases: ['commands']
parents: parents:
description: description:
@ -40,6 +42,7 @@ options:
the commands should be checked against. the commands should be checked against.
- If the C(parents) argument is omitted, the commands are checked against - If the C(parents) argument is omitted, the commands are checked against
the set of top level or global commands. the set of top level or global commands.
type: list
src: src:
description: description:
- The I(src) argument provides a path to the configuration file - The I(src) argument provides a path to the configuration file
@ -49,6 +52,7 @@ options:
implemented role or playbook. implemented role or playbook.
- This argument is mutually exclusive with the I(lines) and - This argument is mutually exclusive with the I(lines) and
I(parents) arguments. I(parents) arguments.
type: path
before: before:
description: description:
- The ordered set of commands to push on to the command stack if - The ordered set of commands to push on to the command stack if
@ -56,12 +60,14 @@ options:
- This allows the playbook designer the opportunity to perform - This allows the playbook designer the opportunity to perform
configuration commands prior to pushing any changes without configuration commands prior to pushing any changes without
affecting how the set of commands are matched against the system. affecting how the set of commands are matched against the system.
type: list
after: after:
description: description:
- The ordered set of commands to append to the end of the command - The ordered set of commands to append to the end of the command
stack if a change needs to be made. stack if a change needs to be made.
- Just like with I(before) this allows the playbook designer to - Just like with I(before) this allows the playbook designer to
append a set of commands to be executed after the command set. append a set of commands to be executed after the command set.
type: list
match: match:
description: description:
- Instructs the module on the way to perform the matching of - Instructs the module on the way to perform the matching of
@ -73,8 +79,13 @@ options:
- Finally, if match is set to I(none), the module will not attempt to - Finally, if match is set to I(none), the module will not attempt to
compare the source configuration with the running configuration on compare the source configuration with the running configuration on
the remote device. the remote device.
type: str
choices:
- line
- strict
- exact
- none
default: line default: line
choices: ['line', 'strict', 'exact', 'none']
replace: replace:
description: description:
- Instructs the module on the way to perform the configuration - Instructs the module on the way to perform the configuration
@ -84,8 +95,11 @@ options:
- If the replace argument is set to I(block) then the entire - If the replace argument is set to I(block) then the entire
command block is pushed to the device in configuration mode if any command block is pushed to the device in configuration mode if any
line is not correct. line is not correct.
type: str
choices:
- line
- block
default: line default: line
choices: ['line', 'block']
backup: backup:
description: description:
- This argument will cause the module to create a full backup of - This argument will cause the module to create a full backup of
@ -105,6 +119,7 @@ options:
current running-config for every task in a playbook. current running-config for every task in a playbook.
- The I(running_config) argument allows the implementer to pass in - The I(running_config) argument allows the implementer to pass in
the configuration to use as the base config for comparison. the configuration to use as the base config for comparison.
type: str
aliases: ['config'] aliases: ['config']
save_when: save_when:
description: description:
@ -120,8 +135,13 @@ options:
copied to the startup-config. copied to the startup-config.
- If the argument is set to I(changed), then the running-config - If the argument is set to I(changed), then the running-config
will only be copied to the startup-config if the task has made a change. will only be copied to the startup-config if the task has made a change.
type: str
choices:
- always
- never
- modified
- changed
default: never default: never
choices: ['always', 'never', 'modified', 'changed']
diff_against: diff_against:
description: description:
- When using the C(ansible-playbook --diff) command line argument - When using the C(ansible-playbook --diff) command line argument
@ -134,8 +154,12 @@ options:
- When this option is configured as I(running), the module will - When this option is configured as I(running), the module will
return the before and after diff of the running-config with respect return the before and after diff of the running-config with respect
to any changes made to the device configuration. to any changes made to the device configuration.
type: str
choices:
- startup
- intended
- running
default: startup default: startup
choices: ['startup', 'intended', 'running']
diff_ignore_lines: diff_ignore_lines:
description: description:
- Use this argument to specify one or more lines that should be - Use this argument to specify one or more lines that should be
@ -143,6 +167,7 @@ options:
- This is used for lines in the configuration that are automatically - This is used for lines in the configuration that are automatically
updated by the system. updated by the system.
- This argument takes a list of regular expressions or exact line matches. - This argument takes a list of regular expressions or exact line matches.
type: list
intended_config: intended_config:
description: description:
- The C(intended_config) provides the master configuration that - The C(intended_config) provides the master configuration that
@ -153,6 +178,7 @@ options:
configuration against. configuration against.
- When specifying this argument, the task should also modify the - When specifying this argument, the task should also modify the
C(diff_against) value and set it to I(intended). C(diff_against) value and set it to I(intended).
type: str
backup_options: backup_options:
description: description:
- This is a dict object containing configurable options related to backup file path. - This is a dict object containing configurable options related to backup file path.
@ -164,6 +190,7 @@ options:
- The filename to be used to store the backup configuration. If the the filename - The filename to be used to store the backup configuration. If the the filename
is not given it will be generated based on the hostname, current time and date is not given it will be generated based on the hostname, current time and date
in format defined by <hostname>_config.<current-date>@<current-time> in format defined by <hostname>_config.<current-date>@<current-time>
type: str
dir_path: dir_path:
description: description:
- This option provides the path ending with directory name in which the backup - This option provides the path ending with directory name in which the backup
@ -297,21 +324,15 @@ try:
from library.module_utils.network.f5.bigip import F5RestClient from library.module_utils.network.f5.bigip import F5RestClient
from library.module_utils.network.f5.common import F5ModuleError from library.module_utils.network.f5.common import F5ModuleError
from library.module_utils.network.f5.common import AnsibleF5Parameters from library.module_utils.network.f5.common import AnsibleF5Parameters
from library.module_utils.network.f5.common import cleanup_tokens
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 exit_json
from library.module_utils.network.f5.common import fail_json
from library.module_utils.network.f5.icontrol import upload_file from library.module_utils.network.f5.icontrol import upload_file
except ImportError: except ImportError:
from ansible.module_utils.network.f5.bigip import F5RestClient from ansible.module_utils.network.f5.bigip import F5RestClient
from ansible.module_utils.network.f5.common import F5ModuleError from ansible.module_utils.network.f5.common import F5ModuleError
from ansible.module_utils.network.f5.common import AnsibleF5Parameters from ansible.module_utils.network.f5.common import AnsibleF5Parameters
from ansible.module_utils.network.f5.common import cleanup_tokens
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 exit_json
from ansible.module_utils.network.f5.common import fail_json
from ansible.module_utils.network.f5.icontrol import upload_file from ansible.module_utils.network.f5.icontrol import upload_file
@ -388,7 +409,7 @@ class Difference(object):
class ModuleManager(object): class ModuleManager(object):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.module = kwargs.get('module', None) self.module = kwargs.get('module', None)
self.client = kwargs.get('client', None) self.client = F5RestClient(**self.module.params)
self.want = ModuleParameters(params=self.module.params) self.want = ModuleParameters(params=self.module.params)
self.have = ApiParameters() self.have = ApiParameters()
self.changes = UsableChanges() self.changes = UsableChanges()
@ -799,11 +820,11 @@ def main():
client = F5RestClient(**module.params) client = F5RestClient(**module.params)
try: try:
mm = ModuleManager(module=module, client=client) mm = ModuleManager(module=module)
results = mm.exec_module() results = mm.exec_module()
exit_json(module, results, client) module.exit_json(**results)
except F5ModuleError as ex: except F5ModuleError as ex:
fail_json(module, ex, client) module.fail_json(msg=str(ex))
if __name__ == '__main__': if __name__ == '__main__':

@ -23,14 +23,17 @@ options:
name: name:
description: description:
- Specifies the name of the IPSec policy. - Specifies the name of the IPSec policy.
type: str
required: True required: True
description: description:
description: description:
- Description of the policy - Description of the policy
type: str
protocol: protocol:
description: description:
- Specifies the IPsec protocol - Specifies the IPsec protocol
- Options include ESP (Encapsulating Security Protocol) or AH (Authentication Header). - Options include ESP (Encapsulating Security Protocol) or AH (Authentication Header).
type: str
choices: choices:
- esp - esp
- ah - ah
@ -48,6 +51,7 @@ options:
Acceleration section of the user interface. Acceleration section of the user interface.
- When C(interface), specifies that the IPsec policy can be used in the tunnel - When C(interface), specifies that the IPsec policy can be used in the tunnel
profile for network interfaces. profile for network interfaces.
type: str
choices: choices:
- transport - transport
- interface - interface
@ -57,13 +61,16 @@ options:
description: description:
- Specifies the local endpoint IP address of the IPsec tunnel. - Specifies the local endpoint IP address of the IPsec tunnel.
- This parameter is only valid when C(mode) is C(tunnel). - This parameter is only valid when C(mode) is C(tunnel).
type: str
tunnel_remote_address: tunnel_remote_address:
description: description:
- Specifies the remote endpoint IP address of the IPsec tunnel. - Specifies the remote endpoint IP address of the IPsec tunnel.
- This parameter is only valid when C(mode) is C(tunnel). - This parameter is only valid when C(mode) is C(tunnel).
type: str
encrypt_algorithm: encrypt_algorithm:
description: description:
- Specifies the algorithm to use for IKE encryption. - Specifies the algorithm to use for IKE encryption.
type: str
choices: choices:
- none - none
- 3des - 3des
@ -80,9 +87,11 @@ options:
route_domain: route_domain:
description: description:
- Specifies the route domain, when C(interface) is selected for the C(mode) setting. - Specifies the route domain, when C(interface) is selected for the C(mode) setting.
type: int
auth_algorithm: auth_algorithm:
description: description:
- Specifies the algorithm to use for IKE authentication. - Specifies the algorithm to use for IKE authentication.
type: str
choices: choices:
- sha1 - sha1
- sha256 - sha256
@ -100,6 +109,7 @@ options:
- When C(none), specifies that IPComp is disabled. - When C(none), specifies that IPComp is disabled.
- When C(deflate), specifies that IPComp is enabled and uses the Deflate - When C(deflate), specifies that IPComp is enabled and uses the Deflate
compression algorithm. compression algorithm.
type: str
choices: choices:
- none - none
- "null" - "null"
@ -108,13 +118,16 @@ options:
description: description:
- Specifies the length of time, in minutes, before the IKE security association - Specifies the length of time, in minutes, before the IKE security association
expires. expires.
type: int
kb_lifetime: kb_lifetime:
description: description:
- Specifies the length of time, in kilobytes, before the IKE security association - Specifies the length of time, in kilobytes, before the IKE security association
expires. expires.
type: int
perfect_forward_secrecy: perfect_forward_secrecy:
description: description:
- Specifies the Diffie-Hellman group to use for IKE Phase 2 negotiation. - Specifies the Diffie-Hellman group to use for IKE Phase 2 negotiation.
type: str
choices: choices:
- none - none
- modp768 - modp768
@ -128,15 +141,17 @@ options:
partition: partition:
description: description:
- Device partition to manage resources on. - Device partition to manage resources on.
type: str
default: Common default: Common
state: state:
description: description:
- When C(present), ensures that the resource exists. - When C(present), ensures that the resource exists.
- When C(absent), ensures the resource is removed. - When C(absent), ensures the resource is removed.
default: present type: str
choices: choices:
- present - present
- absent - absent
default: present
extends_documentation_fragment: f5 extends_documentation_fragment: f5
author: author:
- Tim Rupp (@caphrim007) - Tim Rupp (@caphrim007)
@ -230,21 +245,15 @@ try:
from library.module_utils.network.f5.bigip import F5RestClient from library.module_utils.network.f5.bigip import F5RestClient
from library.module_utils.network.f5.common import F5ModuleError from library.module_utils.network.f5.common import F5ModuleError
from library.module_utils.network.f5.common import AnsibleF5Parameters from library.module_utils.network.f5.common import AnsibleF5Parameters
from library.module_utils.network.f5.common import cleanup_tokens
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 exit_json
from library.module_utils.network.f5.common import fail_json
from library.module_utils.network.f5.common import transform_name from library.module_utils.network.f5.common import transform_name
except ImportError: except ImportError:
from ansible.module_utils.network.f5.bigip import F5RestClient from ansible.module_utils.network.f5.bigip import F5RestClient
from ansible.module_utils.network.f5.common import F5ModuleError from ansible.module_utils.network.f5.common import F5ModuleError
from ansible.module_utils.network.f5.common import AnsibleF5Parameters from ansible.module_utils.network.f5.common import AnsibleF5Parameters
from ansible.module_utils.network.f5.common import cleanup_tokens
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 exit_json
from ansible.module_utils.network.f5.common import fail_json
from ansible.module_utils.network.f5.common import transform_name from ansible.module_utils.network.f5.common import transform_name
@ -442,7 +451,7 @@ class Difference(object):
class ModuleManager(object): class ModuleManager(object):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.module = kwargs.get('module', None) self.module = kwargs.get('module', None)
self.client = kwargs.get('client', None) self.client = F5RestClient(**self.module.params)
self.want = ModuleParameters(params=self.module.params) self.want = ModuleParameters(params=self.module.params)
self.have = ApiParameters() self.have = ApiParameters()
self.changes = UsableChanges() self.changes = UsableChanges()
@ -684,18 +693,15 @@ def main():
module = AnsibleModule( module = AnsibleModule(
argument_spec=spec.argument_spec, argument_spec=spec.argument_spec,
supports_check_mode=spec.supports_check_mode, supports_check_mode=spec.supports_check_mode,
required_if=spec.required_if
) )
client = F5RestClient(**module.params)
try: try:
mm = ModuleManager(module=module, client=client) mm = ModuleManager(module=module)
results = mm.exec_module() results = mm.exec_module()
cleanup_tokens(client) module.exit_json(**results)
exit_json(module, results, client)
except F5ModuleError as ex: except F5ModuleError as ex:
cleanup_tokens(client) module.fail_json(msg=str(ex))
fail_json(module, ex, client)
if __name__ == '__main__': if __name__ == '__main__':

@ -26,9 +26,11 @@ options:
the specified value. This is for simple values, but can be used with the specified value. This is for simple values, but can be used with
lookup plugins for anything complex or with formatting. Either one lookup plugins for anything complex or with formatting. Either one
of C(src) or C(content) must be provided. of C(src) or C(content) must be provided.
type: str
module: module:
description: description:
- The BIG-IP module to add the iRule to. - The BIG-IP module to add the iRule to.
type: str
required: True required: True
choices: choices:
- ltm - ltm
@ -36,22 +38,26 @@ options:
name: name:
description: description:
- The name of the iRule. - The name of the iRule.
type: str
required: True required: True
src: src:
description: description:
- The iRule file to interpret and upload to the BIG-IP. Either one - The iRule file to interpret and upload to the BIG-IP. Either one
of C(src) or C(content) must be provided. of C(src) or C(content) must be provided.
type: path
required: True required: True
state: state:
description: description:
- Whether the iRule should exist or not. - Whether the iRule should exist or not.
default: present type: str
choices: choices:
- present - present
- absent - absent
default: present
partition: partition:
description: description:
- Device partition to manage resources on. - Device partition to manage resources on.
type: str
default: Common default: Common
version_added: 2.5 version_added: 2.5
extends_documentation_fragment: f5 extends_documentation_fragment: f5
@ -113,20 +119,14 @@ try:
from library.module_utils.network.f5.bigip import F5RestClient from library.module_utils.network.f5.bigip import F5RestClient
from library.module_utils.network.f5.common import F5ModuleError from library.module_utils.network.f5.common import F5ModuleError
from library.module_utils.network.f5.common import AnsibleF5Parameters from library.module_utils.network.f5.common import AnsibleF5Parameters
from library.module_utils.network.f5.common import cleanup_tokens
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 transform_name 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
except ImportError: except ImportError:
from ansible.module_utils.network.f5.bigip import F5RestClient from ansible.module_utils.network.f5.bigip import F5RestClient
from ansible.module_utils.network.f5.common import F5ModuleError from ansible.module_utils.network.f5.common import F5ModuleError
from ansible.module_utils.network.f5.common import AnsibleF5Parameters from ansible.module_utils.network.f5.common import AnsibleF5Parameters
from ansible.module_utils.network.f5.common import cleanup_tokens
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 transform_name 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
class Parameters(AnsibleF5Parameters): class Parameters(AnsibleF5Parameters):
@ -244,7 +244,7 @@ class ModuleManager(object):
class BaseManager(object): class BaseManager(object):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.module = kwargs.get('module', None) self.module = kwargs.get('module', None)
self.client = kwargs.get('client', None) self.client = F5RestClient(**self.module.params)
self.have = None self.have = None
self.want = ModuleParameters(params=self.module.params) self.want = ModuleParameters(params=self.module.params)
self.changes = UsableChanges() self.changes = UsableChanges()
@ -565,16 +565,12 @@ def main():
mutually_exclusive=spec.mutually_exclusive mutually_exclusive=spec.mutually_exclusive
) )
client = F5RestClient(**module.params)
try: try:
mm = ModuleManager(module=module, client=client) mm = ModuleManager(module=module)
results = mm.exec_module() results = mm.exec_module()
cleanup_tokens(client) module.exit_json(**results)
exit_json(module, results, client)
except F5ModuleError as ex: except F5ModuleError as ex:
cleanup_tokens(client) module.fail_json(msg=str(ex))
fail_json(module, ex, client)
if __name__ == '__main__': if __name__ == '__main__':

@ -23,11 +23,13 @@ options:
name: name:
description: description:
- Specifies the name of the log destination. - Specifies the name of the log destination.
type: str
required: True required: True
type: type:
description: description:
- Specifies the type of log destination. - Specifies the type of log destination.
- Once created, this parameter cannot be changed. - Once created, this parameter cannot be changed.
type: str
choices: choices:
- remote-high-speed-log - remote-high-speed-log
- remote-syslog - remote-syslog
@ -39,6 +41,7 @@ options:
description: description:
description: description:
- The description of the log destination. - The description of the log destination.
type: str
pool_settings: pool_settings:
description: description:
- This parameter is only available when C(type) is C(remote-high-speed-log). - This parameter is only available when C(type) is C(remote-high-speed-log).
@ -49,12 +52,14 @@ options:
- Specifies the existing pool of remote high-speed log servers where logs will be sent. - Specifies the existing pool of remote high-speed log servers where logs will be sent.
- When creating a new destination (and C(type) is C(remote-high-speed-log)), this parameter - When creating a new destination (and C(type) is C(remote-high-speed-log)), this parameter
is required. is required.
type: str
protocol: protocol:
description: description:
- Specifies the protocol for the system to use to send logs to the pool of remote high-speed - Specifies the protocol for the system to use to send logs to the pool of remote high-speed
log servers, where the logs are stored. log servers, where the logs are stored.
- When creating a new log destination (and C(type) is C(remote-high-speed-log)), if this - When creating a new log destination (and C(type) is C(remote-high-speed-log)), if this
parameter is not specified, the default is C(tcp). parameter is not specified, the default is C(tcp).
type: str
choices: choices:
- tcp - tcp
- udp - udp
@ -70,10 +75,12 @@ options:
- When C(replicated), replicates each log to all pool members, for redundancy. - When C(replicated), replicates each log to all pool members, for redundancy.
- When creating a new log destination (and C(type) is C(remote-high-speed-log)), if this - When creating a new log destination (and C(type) is C(remote-high-speed-log)), if this
parameter is not specified, the default is C(adaptive). parameter is not specified, the default is C(adaptive).
type: str
choices: choices:
- adaptive - adaptive
- balanced - balanced
- replicated - replicated
type: dict
syslog_settings: syslog_settings:
description: description:
- This parameter is only available when C(type) is C(remote-syslog). - This parameter is only available when C(type) is C(remote-syslog).
@ -86,6 +93,7 @@ options:
not specified, the default is C(bsd-syslog). not specified, the default is C(bsd-syslog).
- The C(syslog) and C(rfc5424) choices are two ways of saying the same thing. - The C(syslog) and C(rfc5424) choices are two ways of saying the same thing.
- The C(bsd-syslog) and C(rfc3164) choices are two ways of saying the same thing. - The C(bsd-syslog) and C(rfc3164) choices are two ways of saying the same thing.
type: str
choices: choices:
- bsd-syslog - bsd-syslog
- syslog - syslog
@ -98,6 +106,8 @@ options:
single log server, or a remote high-speed log destination, which will be used to forward the single log server, or a remote high-speed log destination, which will be used to forward the
logs to a pool of remote log servers. logs to a pool of remote log servers.
- When creating a new log destination (and C(type) is C(remote-syslog)), this parameter is required. - When creating a new log destination (and C(type) is C(remote-syslog)), this parameter is required.
type: str
type: dict
syslog_format: syslog_format:
description: description:
- Specifies the method to use to format the logs associated with the remote Syslog log destination. - Specifies the method to use to format the logs associated with the remote Syslog log destination.
@ -105,6 +115,7 @@ options:
not specified, the default is C(bsd-syslog). not specified, the default is C(bsd-syslog).
- The C(syslog) and C(rfc5424) choices are two ways of saying the same thing. - The C(syslog) and C(rfc5424) choices are two ways of saying the same thing.
- The C(bsd-syslog) and C(rfc3164) choices are two ways of saying the same thing. - The C(bsd-syslog) and C(rfc3164) choices are two ways of saying the same thing.
type: str
choices: choices:
- bsd-syslog - bsd-syslog
- syslog - syslog
@ -123,6 +134,7 @@ options:
ArcSight or Splunk server. ArcSight or Splunk server.
- When creating a new log destination and C(type) is C(remote-syslog), C(splunk), or C(arcsight), - When creating a new log destination and C(type) is C(remote-syslog), C(splunk), or C(arcsight),
this parameter is required. this parameter is required.
type: str
version_added: 2.8 version_added: 2.8
pool: pool:
description: description:
@ -133,6 +145,7 @@ options:
of collectors. of collectors.
- When creating a new destination and C(type) is C(remote-high-speed-log) or C(ipfix), this - When creating a new destination and C(type) is C(remote-high-speed-log) or C(ipfix), this
parameter is required. parameter is required.
type: str
version_added: 2.8 version_added: 2.8
protocol: protocol:
description: description:
@ -143,6 +156,7 @@ options:
- When C(type) is C(management-port), specifies the protocol used to send messages to the - When C(type) is C(management-port), specifies the protocol used to send messages to the
specified location. specified location.
- When C(type) is C(management-port), only C(tcp) and C(udp) are valid values. - When C(type) is C(management-port), only C(tcp) and C(udp) are valid values.
type: str
choices: choices:
- tcp - tcp
- udp - udp
@ -161,6 +175,7 @@ options:
- When C(replicated), replicates each log to all pool members, for redundancy. - When C(replicated), replicates each log to all pool members, for redundancy.
- When creating a new log destination and C(type) is C(remote-high-speed-log), if this - When creating a new log destination and C(type) is C(remote-high-speed-log), if this
parameter is not specified, the default is C(adaptive). parameter is not specified, the default is C(adaptive).
type: str
choices: choices:
- adaptive - adaptive
- balanced - balanced
@ -172,6 +187,7 @@ options:
- This parameter is only available when C(type) is C(management-port). - This parameter is only available when C(type) is C(management-port).
- When creating a new log destination and C(type) is C(management-port), this parameter - When creating a new log destination and C(type) is C(management-port), this parameter
is required. is required.
type: str
version_added: 2.8 version_added: 2.8
port: port:
description: description:
@ -180,6 +196,7 @@ options:
- This parameter is only available when C(type) is C(management-port). - This parameter is only available when C(type) is C(management-port).
- When creating a new log destination and C(type) is C(management-port), this parameter - When creating a new log destination and C(type) is C(management-port), this parameter
is required. is required.
type: int
version_added: 2.8 version_added: 2.8
transport_profile: transport_profile:
description: description:
@ -187,6 +204,7 @@ options:
- This profile defines the TCP or UDP options used to send IP-traffic logs - This profile defines the TCP or UDP options used to send IP-traffic logs
to the pool of collectors. to the pool of collectors.
- This parameter is only available when C(type) is C(ipfix). - This parameter is only available when C(type) is C(ipfix).
type: str
version_added: 2.8 version_added: 2.8
server_ssl_profile: server_ssl_profile:
description: description:
@ -196,6 +214,7 @@ options:
- An SSL server profile defines how to communicate securely over SSL or - An SSL server profile defines how to communicate securely over SSL or
Transport Layer Security (TLS). Transport Layer Security (TLS).
- This parameter is only available when C(type) is C(ipfix). - This parameter is only available when C(type) is C(ipfix).
type: str
version_added: 2.8 version_added: 2.8
template_retransmit_interval: template_retransmit_interval:
description: description:
@ -205,6 +224,7 @@ options:
at the interval you set in this field. These retransmissions are helpful at the interval you set in this field. These retransmissions are helpful
for UDP, a lossy transport mechanism. for UDP, a lossy transport mechanism.
- This parameter is only available when C(type) is C(ipfix). - This parameter is only available when C(type) is C(ipfix).
type: int
version_added: 2.8 version_added: 2.8
template_delete_delay: template_delete_delay:
description: description:
@ -212,19 +232,22 @@ options:
deleting an obsolete IPFIX template and reusing its template ID. deleting an obsolete IPFIX template and reusing its template ID.
- This feature is useful for systems where you use iRules to create - This feature is useful for systems where you use iRules to create
customized IPFIX templates. customized IPFIX templates.
type: int
version_added: 2.8 version_added: 2.8
partition: partition:
description: description:
- Device partition to manage resources on. - Device partition to manage resources on.
type: str
default: Common default: Common
state: state:
description: description:
- When C(present), ensures that the resource exists. - When C(present), ensures that the resource exists.
- When C(absent), ensures the resource is removed. - When C(absent), ensures the resource is removed.
default: present type: str
choices: choices:
- present - present
- absent - absent
default: present
extends_documentation_fragment: f5 extends_documentation_fragment: f5
author: author:
- Tim Rupp (@caphrim007) - Tim Rupp (@caphrim007)
@ -320,23 +343,17 @@ try:
from library.module_utils.network.f5.bigip import F5RestClient from library.module_utils.network.f5.bigip import F5RestClient
from library.module_utils.network.f5.common import F5ModuleError from library.module_utils.network.f5.common import F5ModuleError
from library.module_utils.network.f5.common import AnsibleF5Parameters from library.module_utils.network.f5.common import AnsibleF5Parameters
from library.module_utils.network.f5.common import cleanup_tokens
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 transform_name 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.compare import cmp_str_with_none
except ImportError: except ImportError:
from ansible.module_utils.network.f5.bigip import F5RestClient from ansible.module_utils.network.f5.bigip import F5RestClient
from ansible.module_utils.network.f5.common import F5ModuleError from ansible.module_utils.network.f5.common import F5ModuleError
from ansible.module_utils.network.f5.common import AnsibleF5Parameters from ansible.module_utils.network.f5.common import AnsibleF5Parameters
from ansible.module_utils.network.f5.common import cleanup_tokens
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 transform_name 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.compare import cmp_str_with_none
@ -683,7 +700,7 @@ class Difference(object):
class BaseManager(object): class BaseManager(object):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.module = kwargs.get('module', None) self.module = kwargs.get('module', None)
self.client = kwargs.get('client', None) self.client = F5RestClient(**self.module.params)
def _set_changed_options(self): def _set_changed_options(self):
changed = {} changed = {}
@ -1732,19 +1749,16 @@ def main():
module = AnsibleModule( module = AnsibleModule(
argument_spec=spec.argument_spec, argument_spec=spec.argument_spec,
supports_check_mode=spec.supports_check_mode supports_check_mode=spec.supports_check_mode,
mutually_exclusive=spec.mutually_exclusive
) )
client = F5RestClient(**module.params)
try: try:
mm = ModuleManager(module=module, client=client) mm = ModuleManager(module=module)
results = mm.exec_module() results = mm.exec_module()
cleanup_tokens(client) module.exit_json(**results)
exit_json(module, results, client)
except F5ModuleError as ex: except F5ModuleError as ex:
cleanup_tokens(client) module.fail_json(msg=str(ex))
fail_json(module, ex, client)
if __name__ == '__main__': if __name__ == '__main__':

@ -23,25 +23,30 @@ options:
name: name:
description: description:
- Specifies the name of the log publisher. - Specifies the name of the log publisher.
type: str
required: True required: True
description: description:
description: description:
- Specifies a description for the log publisher. - Specifies a description for the log publisher.
type: str
destinations: destinations:
description: description:
- Specifies log destinations for this log publisher to use. - Specifies log destinations for this log publisher to use.
type: list
partition: partition:
description: description:
- Device partition to manage resources on. - Device partition to manage resources on.
type: str
default: Common default: Common
state: state:
description: description:
- When C(present), ensures that the resource exists. - When C(present), ensures that the resource exists.
- When C(absent), ensures the resource is removed. - When C(absent), ensures the resource is removed.
default: present type: str
choices: choices:
- present - present
- absent - absent
default: present
extends_documentation_fragment: f5 extends_documentation_fragment: f5
author: author:
- Tim Rupp (@caphrim007) - Tim Rupp (@caphrim007)
@ -83,23 +88,17 @@ try:
from library.module_utils.network.f5.bigip import F5RestClient from library.module_utils.network.f5.bigip import F5RestClient
from library.module_utils.network.f5.common import F5ModuleError from library.module_utils.network.f5.common import F5ModuleError
from library.module_utils.network.f5.common import AnsibleF5Parameters from library.module_utils.network.f5.common import AnsibleF5Parameters
from library.module_utils.network.f5.common import cleanup_tokens
from library.module_utils.network.f5.common import transform_name from library.module_utils.network.f5.common import transform_name
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 exit_json
from library.module_utils.network.f5.common import fail_json
from library.module_utils.network.f5.compare import cmp_simple_list from library.module_utils.network.f5.compare import cmp_simple_list
except ImportError: except ImportError:
from ansible.module_utils.network.f5.bigip import F5RestClient from ansible.module_utils.network.f5.bigip import F5RestClient
from ansible.module_utils.network.f5.common import F5ModuleError from ansible.module_utils.network.f5.common import F5ModuleError
from ansible.module_utils.network.f5.common import AnsibleF5Parameters from ansible.module_utils.network.f5.common import AnsibleF5Parameters
from ansible.module_utils.network.f5.common import cleanup_tokens
from ansible.module_utils.network.f5.common import transform_name from ansible.module_utils.network.f5.common import transform_name
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 exit_json
from ansible.module_utils.network.f5.common import fail_json
from ansible.module_utils.network.f5.compare import cmp_simple_list from ansible.module_utils.network.f5.compare import cmp_simple_list
@ -200,7 +199,7 @@ class Difference(object):
class ModuleManager(object): class ModuleManager(object):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.module = kwargs.get('module', None) self.module = kwargs.get('module', None)
self.client = kwargs.get('client', None) self.client = F5RestClient(**self.module.params)
self.want = ModuleParameters(params=self.module.params) self.want = ModuleParameters(params=self.module.params)
self.have = ApiParameters() self.have = ApiParameters()
self.changes = UsableChanges() self.changes = UsableChanges()
@ -414,16 +413,12 @@ def main():
supports_check_mode=spec.supports_check_mode supports_check_mode=spec.supports_check_mode
) )
client = F5RestClient(**module.params)
try: try:
mm = ModuleManager(module=module, client=client) mm = ModuleManager(module=module)
results = mm.exec_module() results = mm.exec_module()
cleanup_tokens(client) module.exit_json(**results)
exit_json(module, results, client)
except F5ModuleError as ex: except F5ModuleError as ex:
cleanup_tokens(client) module.fail_json(msg=str(ex))
fail_json(module, ex, client)
if __name__ == '__main__': if __name__ == '__main__':

@ -23,14 +23,17 @@ options:
name: name:
description: description:
- Specifies the name of the management route. - Specifies the name of the management route.
type: str
required: True required: True
description: description:
description: description:
- Description of the management route. - Description of the management route.
type: str
gateway: gateway:
description: description:
- Specifies that the system forwards packets to the destination through the - Specifies that the system forwards packets to the destination through the
gateway with the specified IP address. gateway with the specified IP address.
type: str
network: network:
description: description:
- The subnet and netmask to be used for the route. - The subnet and netmask to be used for the route.
@ -39,18 +42,21 @@ options:
- Only one C(default) entry is allowed. - Only one C(default) entry is allowed.
- This parameter cannot be changed after it is set. Therefore, if you do need to change - This parameter cannot be changed after it is set. Therefore, if you do need to change
it, it is required that you delete and create a new route. it, it is required that you delete and create a new route.
type: str
partition: partition:
description: description:
- Device partition to manage resources on. - Device partition to manage resources on.
type: str
default: Common default: Common
state: state:
description: description:
- When C(present), ensures that the resource exists. - When C(present), ensures that the resource exists.
- When C(absent), ensures the resource is removed. - When C(absent), ensures the resource is removed.
default: present type: str
choices: choices:
- present - present
- absent - absent
default: present
extends_documentation_fragment: f5 extends_documentation_fragment: f5
author: author:
- Tim Rupp (@caphrim007) - Tim Rupp (@caphrim007)
@ -97,20 +103,14 @@ try:
from library.module_utils.network.f5.bigip import F5RestClient from library.module_utils.network.f5.bigip import F5RestClient
from library.module_utils.network.f5.common import F5ModuleError from library.module_utils.network.f5.common import F5ModuleError
from library.module_utils.network.f5.common import AnsibleF5Parameters from library.module_utils.network.f5.common import AnsibleF5Parameters
from library.module_utils.network.f5.common import cleanup_tokens
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 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.ipaddress import is_valid_ip
from library.module_utils.compat.ipaddress import ip_network from library.module_utils.compat.ipaddress import ip_network
except ImportError: except ImportError:
from ansible.module_utils.network.f5.bigip import F5RestClient from ansible.module_utils.network.f5.bigip import F5RestClient
from ansible.module_utils.network.f5.common import F5ModuleError from ansible.module_utils.network.f5.common import F5ModuleError
from ansible.module_utils.network.f5.common import AnsibleF5Parameters from ansible.module_utils.network.f5.common import AnsibleF5Parameters
from ansible.module_utils.network.f5.common import cleanup_tokens
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 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.ipaddress import is_valid_ip
from ansible.module_utils.compat.ipaddress import ip_network from ansible.module_utils.compat.ipaddress import ip_network
@ -226,7 +226,7 @@ class Difference(object):
class ModuleManager(object): class ModuleManager(object):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.module = kwargs.get('module', None) self.module = kwargs.get('module', None)
self.client = kwargs.get('client', None) self.client = F5RestClient(**self.module.params)
self.want = ModuleParameters(params=self.module.params) self.want = ModuleParameters(params=self.module.params)
self.have = ApiParameters() self.have = ApiParameters()
self.changes = UsableChanges() self.changes = UsableChanges()
@ -441,16 +441,12 @@ def main():
supports_check_mode=spec.supports_check_mode supports_check_mode=spec.supports_check_mode
) )
client = F5RestClient(**module.params)
try: try:
mm = ModuleManager(module=module, client=client) mm = ModuleManager(module=module)
results = mm.exec_module() results = mm.exec_module()
cleanup_tokens(client) module.exit_json(**results)
exit_json(module, results, client)
except F5ModuleError as ex: except F5ModuleError as ex:
cleanup_tokens(client) module.fail_json(msg=str(ex))
fail_json(module, ex, client)
if __name__ == '__main__': if __name__ == '__main__':

@ -29,10 +29,12 @@ options:
- 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(dns) been set, it cannot be changed. By default, this value is the C(dns)
parent on the C(Common) partition. parent on the C(Common) partition.
type: str
default: /Common/dns default: /Common/dns
description: description:
description: description:
- The description of the monitor. - The description of the monitor.
type: str
interval: interval:
description: description:
- The interval specifying how frequently the monitor instance of this - The interval specifying how frequently the monitor instance of this
@ -40,6 +42,7 @@ options:
- This value B(must) be less than the C(timeout) value. - This value B(must) be less than the C(timeout) value.
- When creating a new monitor, if this parameter is not provided, the - When creating a new monitor, if this parameter is not provided, the
default C(5) will be used. default C(5) will be used.
type: int
up_interval: up_interval:
description: description:
- Specifies the interval for the system to use to perform the health check - Specifies the interval for the system to use to perform the health check
@ -50,6 +53,7 @@ options:
use when checking the health of a resource that is up. use when checking the health of a resource that is up.
- When creating a new monitor, if this parameter is not provided, the - When creating a new monitor, if this parameter is not provided, the
default C(0) will be used. default C(0) will be used.
type: int
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
@ -60,6 +64,7 @@ options:
interval number of seconds plus 1 second. interval number of seconds plus 1 second.
- If this parameter is not provided when creating a new monitor, then the default - If this parameter is not provided when creating a new monitor, then the default
value will be C(16). value will be C(16).
type: int
transparent: transparent:
description: description:
- Specifies whether the monitor operates in transparent mode. - Specifies whether the monitor operates in transparent mode.
@ -82,6 +87,7 @@ options:
- Specifies the IP address that the monitor uses from the resource record sections - Specifies the IP address that the monitor uses from the resource record sections
of the DNS response. of the DNS response.
- The IP address should be specified in the dotted-decimal notation or IPv6 notation. - The IP address should be specified in the dotted-decimal notation or IPv6 notation.
type: str
time_until_up: time_until_up:
description: description:
- Specifies the amount of time in seconds after the first successful - Specifies the amount of time in seconds after the first successful
@ -90,6 +96,7 @@ options:
response is received from the node. response is received from the node.
- If this parameter is not provided when creating a new monitor, then the default - If this parameter is not provided when creating a new monitor, then the default
value will be C(0). value will be C(0).
type: int
manual_resume: manual_resume:
description: description:
- Specifies whether the system automatically changes the status of a resource - Specifies whether the system automatically changes the status of a resource
@ -108,15 +115,18 @@ options:
- IP address part of the IP/port definition. - IP address part of the IP/port definition.
- If this parameter is not provided when creating a new monitor, then the - If this parameter is not provided when creating a new monitor, then the
default value will be C(*). default value will be C(*).
type: str
port: port:
description: description:
- Port address part of the IP/port definition. - Port address part of the IP/port definition.
- If this parameter is not provided when creating a new monitor, then the default - If this parameter is not provided when creating a new monitor, then the default
value will be C(*). value will be C(*).
- Note that if specifying an IP address, a value between 1 and 65535 must be specified. - Note that if specifying an IP address, a value between 1 and 65535 must be specified.
type: str
query_name: query_name:
description: description:
- Specifies a query name for the monitor to use in a DNS query. - Specifies a query name for the monitor to use in a DNS query.
type: str
query_type: query_type:
description: description:
- Specifies the type of DNS query that the monitor sends. - Specifies the type of DNS query that the monitor sends.
@ -124,6 +134,7 @@ options:
value is C(a). value is C(a).
- When C(a), specifies that the monitor will send a DNS query of type A. - When C(a), specifies that the monitor will send a DNS query of type A.
- When C(aaaa), specifies that the monitor will send a DNS query of type AAAA. - When C(aaaa), specifies that the monitor will send a DNS query of type AAAA.
type: str
choices: choices:
- a - a
- aaaa - aaaa
@ -137,6 +148,7 @@ options:
- When C(any-type), specifies that the DNS message should contain at least one answer. - When C(any-type), specifies that the DNS message should contain at least one answer.
- When C(anything), specifies that an empty answer is enough to mark the status of - When C(anything), specifies that an empty answer is enough to mark the status of
the node up. the node up.
type: str
choices: choices:
- any-type - any-type
- anything - anything
@ -152,6 +164,7 @@ options:
irrespective of the RCODE in the DNS message received. irrespective of the RCODE in the DNS message received.
- If this parameter is set to C(anything), it will disregard the C(receive) - If this parameter is set to C(anything), it will disregard the C(receive)
string, and nullify it if the monitor is being updated. string, and nullify it if the monitor is being updated.
type: str
choices: choices:
- no-error - no-error
- anything - anything
@ -175,6 +188,7 @@ options:
latency value you set, the pool member or node is marked down. latency value you set, the pool member or node is marked down.
- When C(relative), the percentage of deviation the latency of a monitor probe - When C(relative), the percentage of deviation the latency of a monitor probe
can exceed the mean latency of a monitor probe for the service being probed. can exceed the mean latency of a monitor probe for the service being probed.
type: str
choices: choices:
- relative - relative
- absolute - absolute
@ -182,6 +196,7 @@ options:
description: description:
- When specifying a new monitor, if C(adaptive) is C(yes), and C(type) is - When specifying a new monitor, if C(adaptive) is C(yes), and C(type) is
C(relative), the default is C(25) percent. C(relative), the default is C(25) percent.
type: int
adaptive_limit: adaptive_limit:
description: description:
- Specifies the absolute number of milliseconds that may not be exceeded by a monitor - Specifies the absolute number of milliseconds that may not be exceeded by a monitor
@ -190,24 +205,28 @@ options:
- This value applies regardless of the value of the C(allowed_divergence) setting. - This value applies regardless of the value of the C(allowed_divergence) setting.
- While this value can be configured when C(adaptive) is C(no), it will not take - While this value can be configured when C(adaptive) is C(no), it will not take
effect on the system until C(adaptive) is C(yes). effect on the system until C(adaptive) is C(yes).
type: int
sampling_timespan: sampling_timespan:
description: description:
- Specifies the length, in seconds, of the probe history window that the system - Specifies the length, in seconds, of the probe history window that the system
uses to calculate the mean latency and standard deviation of a monitor probe. uses to calculate the mean latency and standard deviation of a monitor probe.
- While this value can be configured when C(adaptive) is C(no), it will not take - While this value can be configured when C(adaptive) is C(no), it will not take
effect on the system until C(adaptive) is C(yes). effect on the system until C(adaptive) is C(yes).
type: int
partition: partition:
description: description:
- Device partition to manage resources on. - Device partition to manage resources on.
type: str
default: Common default: Common
state: state:
description: description:
- When C(present), ensures that the monitor exists. - When C(present), ensures that the monitor exists.
- When C(absent), ensures the monitor is removed. - When C(absent), ensures the monitor is removed.
default: present type: str
choices: choices:
- present - present
- absent - absent
default: present
extends_documentation_fragment: f5 extends_documentation_fragment: f5
author: author:
- Tim Rupp (@caphrim007) - Tim Rupp (@caphrim007)
@ -352,12 +371,9 @@ try:
from library.module_utils.network.f5.bigip import F5RestClient from library.module_utils.network.f5.bigip import F5RestClient
from library.module_utils.network.f5.common import F5ModuleError from library.module_utils.network.f5.common import F5ModuleError
from library.module_utils.network.f5.common import AnsibleF5Parameters from library.module_utils.network.f5.common import AnsibleF5Parameters
from library.module_utils.network.f5.common import cleanup_tokens
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 transform_name 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.common import flatten_boolean
from library.module_utils.network.f5.ipaddress import is_valid_ip 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_v6_address
@ -367,12 +383,9 @@ except ImportError:
from ansible.module_utils.network.f5.bigip import F5RestClient from ansible.module_utils.network.f5.bigip import F5RestClient
from ansible.module_utils.network.f5.common import F5ModuleError from ansible.module_utils.network.f5.common import F5ModuleError
from ansible.module_utils.network.f5.common import AnsibleF5Parameters from ansible.module_utils.network.f5.common import AnsibleF5Parameters
from ansible.module_utils.network.f5.common import cleanup_tokens
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 transform_name 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.common import flatten_boolean
from ansible.module_utils.network.f5.ipaddress import is_valid_ip 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_v6_address
@ -708,7 +721,7 @@ class Difference(object):
class ModuleManager(object): class ModuleManager(object):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.module = kwargs.get('module', None) self.module = kwargs.get('module', None)
self.client = kwargs.get('client', None) self.client = F5RestClient(**self.module.params)
self.want = ModuleParameters(params=self.module.params) self.want = ModuleParameters(params=self.module.params)
self.have = ApiParameters() self.have = ApiParameters()
self.changes = UsableChanges() self.changes = UsableChanges()
@ -1002,16 +1015,12 @@ def main():
supports_check_mode=spec.supports_check_mode, supports_check_mode=spec.supports_check_mode,
) )
client = F5RestClient(**module.params)
try: try:
mm = ModuleManager(module=module, client=client) mm = ModuleManager(module=module)
results = mm.exec_module() results = mm.exec_module()
cleanup_tokens(client) module.exit_json(**results)
exit_json(module, results, client)
except F5ModuleError as ex: except F5ModuleError as ex:
cleanup_tokens(client) module.fail_json(msg=str(ex))
fail_json(module, ex, client)
if __name__ == '__main__': if __name__ == '__main__':

@ -23,32 +23,38 @@ options:
name: name:
description: description:
- Monitor name. - Monitor name.
type: str
required: True required: True
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 been set, it cannot be changed. By default, this value is the
C(gateway_icmp) parent on the C(Common) partition. C(gateway_icmp) parent on the C(Common) partition.
type: str
default: /Common/gateway_icmp default: /Common/gateway_icmp
description: description:
description: description:
- The description of the monitor. - The description of the monitor.
type: str
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
provided when creating a new monitor, then the default value will be provided when creating a new monitor, then the default value will be
'*'. '*'.
type: str
port: port:
description: description:
- Port address part of the IP/port definition. If this parameter is not - 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 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 '*'. Note that if specifying an IP address, a value between 1 and 65535
must be specified. must be specified.
type: str
interval: interval:
description: description:
- Specifies, in seconds, the frequency at which the system issues the - Specifies, in seconds, the frequency at which the system issues the
monitor check when either the resource is down or the status of the monitor check when either the resource is down or the status of the
resource is unknown. resource is unknown.
type: int
timeout: timeout:
description: description:
- Specifies the number of seconds the target has in which to respond to - Specifies the number of seconds the target has in which to respond to
@ -59,6 +65,7 @@ options:
from the parent monitor. from the parent monitor.
- Note that C(timeout) and C(time_until_up) combine to control when a - Note that C(timeout) and C(time_until_up) combine to control when a
resource is set to up. resource is set to up.
type: int
time_until_up: time_until_up:
description: description:
- Specifies the number of seconds to wait after a resource first responds - Specifies the number of seconds to wait after a resource first responds
@ -67,6 +74,7 @@ options:
- When the interval expires, the resource is marked 'up'. - When the interval expires, the resource is marked 'up'.
- A value of 0, means that the resource is marked up immediately upon - A value of 0, means that the resource is marked up immediately upon
receipt of the first correct response. receipt of the first correct response.
type: int
up_interval: up_interval:
description: description:
- Specifies the interval for the system to use to perform the health check - Specifies the interval for the system to use to perform the health check
@ -75,6 +83,7 @@ options:
C(interval) to check the health of the resource. C(interval) to check the health of the resource.
- When any other number, enables specification of a different interval to - When any other number, enables specification of a different interval to
use when checking the health of a resource that is up. use when checking the health of a resource that is up.
type: int
manual_resume: manual_resume:
description: description:
- Specifies whether the system automatically changes the status of a resource - Specifies whether the system automatically changes the status of a resource
@ -106,6 +115,7 @@ options:
latency value you set, the pool member or node is marked down. latency value you set, the pool member or node is marked down.
- When C(relative), the percentage of deviation the latency of a monitor probe - When C(relative), the percentage of deviation the latency of a monitor probe
can exceed the mean latency of a monitor probe for the service being probed. can exceed the mean latency of a monitor probe for the service being probed.
type: str
choices: choices:
- relative - relative
- absolute - absolute
@ -113,6 +123,7 @@ options:
description: description:
- When specifying a new monitor, if C(adaptive) is C(yes), and C(type) is - When specifying a new monitor, if C(adaptive) is C(yes), and C(type) is
C(relative), the default is C(25) percent. C(relative), the default is C(25) percent.
type: int
adaptive_limit: adaptive_limit:
description: description:
- Specifies the absolute number of milliseconds that may not be exceeded by a monitor - Specifies the absolute number of milliseconds that may not be exceeded by a monitor
@ -121,12 +132,14 @@ options:
- This value applies regardless of the value of the C(allowed_divergence) setting. - This value applies regardless of the value of the C(allowed_divergence) setting.
- While this value can be configured when C(adaptive) is C(no), it will not take - While this value can be configured when C(adaptive) is C(no), it will not take
effect on the system until C(adaptive) is C(yes). effect on the system until C(adaptive) is C(yes).
type: int
sampling_timespan: sampling_timespan:
description: description:
- Specifies the length, in seconds, of the probe history window that the system - Specifies the length, in seconds, of the probe history window that the system
uses to calculate the mean latency and standard deviation of a monitor probe. uses to calculate the mean latency and standard deviation of a monitor probe.
- While this value can be configured when C(adaptive) is C(no), it will not take - While this value can be configured when C(adaptive) is C(no), it will not take
effect on the system until C(adaptive) is C(yes). effect on the system until C(adaptive) is C(yes).
type: int
transparent: transparent:
description: description:
- Specifies whether the monitor operates in transparent mode. - Specifies whether the monitor operates in transparent mode.
@ -141,15 +154,17 @@ options:
partition: partition:
description: description:
- Device partition to manage resources on. - Device partition to manage resources on.
type: str
default: Common default: Common
state: state:
description: description:
- When C(present), ensures that the monitor exists. - When C(present), ensures that the monitor exists.
- When C(absent), ensures the monitor is removed. - When C(absent), ensures the monitor is removed.
default: present type: str
choices: choices:
- present - present
- absent - absent
default: present
extends_documentation_fragment: f5 extends_documentation_fragment: f5
author: author:
- Tim Rupp (@caphrim007) - Tim Rupp (@caphrim007)
@ -254,11 +269,8 @@ try:
from library.module_utils.network.f5.bigip import F5RestClient from library.module_utils.network.f5.bigip import F5RestClient
from library.module_utils.network.f5.common import F5ModuleError from library.module_utils.network.f5.common import F5ModuleError
from library.module_utils.network.f5.common import AnsibleF5Parameters from library.module_utils.network.f5.common import AnsibleF5Parameters
from library.module_utils.network.f5.common import cleanup_tokens
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 exit_json
from library.module_utils.network.f5.common import fail_json
from library.module_utils.network.f5.common import transform_name 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 flatten_boolean
from library.module_utils.network.f5.ipaddress import is_valid_ip from library.module_utils.network.f5.ipaddress import is_valid_ip
@ -267,11 +279,8 @@ except ImportError:
from ansible.module_utils.network.f5.bigip import F5RestClient from ansible.module_utils.network.f5.bigip import F5RestClient
from ansible.module_utils.network.f5.common import F5ModuleError from ansible.module_utils.network.f5.common import F5ModuleError
from ansible.module_utils.network.f5.common import AnsibleF5Parameters from ansible.module_utils.network.f5.common import AnsibleF5Parameters
from ansible.module_utils.network.f5.common import cleanup_tokens
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 exit_json
from ansible.module_utils.network.f5.common import fail_json
from ansible.module_utils.network.f5.common import transform_name 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 flatten_boolean
from ansible.module_utils.network.f5.ipaddress import is_valid_ip from ansible.module_utils.network.f5.ipaddress import is_valid_ip
@ -555,7 +564,7 @@ class Difference(object):
class ModuleManager(object): class ModuleManager(object):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.module = kwargs.get('module', None) self.module = kwargs.get('module', None)
self.client = kwargs.get('client', None) self.client = F5RestClient(**self.module.params)
self.want = ModuleParameters(params=self.module.params) self.want = ModuleParameters(params=self.module.params)
self.have = ApiParameters() self.have = ApiParameters()
self.changes = UsableChanges() self.changes = UsableChanges()
@ -780,16 +789,12 @@ def main():
supports_check_mode=spec.supports_check_mode, supports_check_mode=spec.supports_check_mode,
) )
client = F5RestClient(**module.params)
try: try:
mm = ModuleManager(module=module, client=client) mm = ModuleManager(module=module)
results = mm.exec_module() results = mm.exec_module()
cleanup_tokens(client) module.exit_json(**results)
exit_json(module, results, client)
except F5ModuleError as ex: except F5ModuleError as ex:
cleanup_tokens(client) module.fail_json(msg=str(ex))
fail_json(module, ex, client)
if __name__ == '__main__': if __name__ == '__main__':

@ -22,47 +22,56 @@ options:
name: name:
description: description:
- Monitor name. - Monitor name.
type: str
required: True required: True
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.
type: str
default: /Common/http default: /Common/http
description: description:
description: description:
- The description of the monitor. - The description of the monitor.
type: str
version_added: 2.7 version_added: 2.7
send: send:
description: description:
- The send string for the monitor call. When creating a new monitor, if - The send string for the monitor call. When creating a new monitor, if
this value is not provided, the default C(GET /\r\n) will be used. this value is not provided, the default C(GET /\r\n) will be used.
type: str
receive: receive:
description: description:
- The receive string for the monitor call. - The receive string for the monitor call.
type: str
receive_disable: receive_disable:
description: description:
- This setting works like C(receive), except that the system marks the node - This setting works like C(receive), except that the system marks the node
or pool member disabled when its response matches the C(receive_disable) or pool member disabled when its response matches the C(receive_disable)
string but not C(receive). To use this setting, you must specify both string but not C(receive). To use this setting, you must specify both
C(receive_disable) and C(receive). C(receive_disable) and C(receive).
type: str
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
provided when creating a new monitor, then the default value will be provided when creating a new monitor, then the default value will be
'*'. '*'.
type: str
port: port:
description: description:
- Port address part of the IP/port definition. If this parameter is not - 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 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 '*'. Note that if specifying an IP address, a value between 1 and 65535
must be specified. must be specified.
type: str
interval: interval:
description: description:
- The interval specifying how frequently the monitor instance of this - The interval specifying how frequently the monitor instance of this
template will run. If this parameter is not provided when creating template will run. If this parameter is not provided when creating
a new monitor, then the default value will be 5. This value B(must) a new monitor, then the default value will be 5. This value B(must)
be less than the C(timeout) value. be less than the C(timeout) value.
type: int
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
@ -72,6 +81,7 @@ options:
number to any number you want, however, it should be 3 times the 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 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. provided when creating a new monitor, then the default value will be 16.
type: int
time_until_up: time_until_up:
description: description:
- Specifies the amount of time in seconds after the first successful - Specifies the amount of time in seconds after the first successful
@ -79,12 +89,15 @@ 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.
type: int
target_username: target_username:
description: description:
- Specifies the user name, if the monitored target requires authentication. - Specifies the user name, if the monitored target requires authentication.
type: str
target_password: target_password:
description: description:
- Specifies the password, if the monitored target requires authentication. - Specifies the password, if the monitored target requires authentication.
type: str
reverse: reverse:
description: description:
- Specifies whether the monitor operates in reverse mode. - Specifies whether the monitor operates in reverse mode.
@ -99,16 +112,18 @@ options:
partition: partition:
description: description:
- Device partition to manage resources on. - Device partition to manage resources on.
type: str
default: Common default: Common
version_added: 2.5 version_added: 2.5
state: state:
description: description:
- When C(present), ensures that the monitor exists. - When C(present), ensures that the monitor exists.
- When C(absent), ensures the monitor is removed. - When C(absent), ensures the monitor is removed.
default: present type: str
choices: choices:
- present - present
- absent - absent
default: present
version_added: 2.5 version_added: 2.5
notes: notes:
- Requires BIG-IP software version >= 12 - Requires BIG-IP software version >= 12
@ -198,12 +213,9 @@ try:
from library.module_utils.network.f5.bigip import F5RestClient from library.module_utils.network.f5.bigip import F5RestClient
from library.module_utils.network.f5.common import F5ModuleError from library.module_utils.network.f5.common import F5ModuleError
from library.module_utils.network.f5.common import AnsibleF5Parameters from library.module_utils.network.f5.common import AnsibleF5Parameters
from library.module_utils.network.f5.common import cleanup_tokens
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 transform_name 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.common import flatten_boolean
from library.module_utils.network.f5.ipaddress import is_valid_ip from library.module_utils.network.f5.ipaddress import is_valid_ip
from library.module_utils.network.f5.compare import cmp_str_with_none from library.module_utils.network.f5.compare import cmp_str_with_none
@ -211,12 +223,9 @@ except ImportError:
from ansible.module_utils.network.f5.bigip import F5RestClient from ansible.module_utils.network.f5.bigip import F5RestClient
from ansible.module_utils.network.f5.common import F5ModuleError from ansible.module_utils.network.f5.common import F5ModuleError
from ansible.module_utils.network.f5.common import AnsibleF5Parameters from ansible.module_utils.network.f5.common import AnsibleF5Parameters
from ansible.module_utils.network.f5.common import cleanup_tokens
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 transform_name 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.common import flatten_boolean
from ansible.module_utils.network.f5.ipaddress import is_valid_ip from ansible.module_utils.network.f5.ipaddress import is_valid_ip
from ansible.module_utils.network.f5.compare import cmp_str_with_none from ansible.module_utils.network.f5.compare import cmp_str_with_none
@ -480,7 +489,7 @@ class Difference(object):
class ModuleManager(object): class ModuleManager(object):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.module = kwargs.get('module', None) self.module = kwargs.get('module', None)
self.client = kwargs.get('client', None) self.client = F5RestClient(**self.module.params)
self.want = ModuleParameters(params=self.module.params) self.want = ModuleParameters(params=self.module.params)
self.have = ApiParameters() self.have = ApiParameters()
self.changes = UsableChanges() self.changes = UsableChanges()
@ -734,16 +743,12 @@ def main():
supports_check_mode=spec.supports_check_mode, supports_check_mode=spec.supports_check_mode,
) )
client = F5RestClient(**module.params)
try: try:
mm = ModuleManager(module=module, client=client) mm = ModuleManager(module=module)
results = mm.exec_module() results = mm.exec_module()
cleanup_tokens(client) module.exit_json(**results)
exit_json(module, results, client)
except F5ModuleError as ex: except F5ModuleError as ex:
cleanup_tokens(client) module.fail_json(msg=str(ex))
fail_json(module, ex, client)
if __name__ == '__main__': if __name__ == '__main__':

@ -22,47 +22,56 @@ options:
name: name:
description: description:
- Monitor name. - Monitor name.
type: str
required: True required: True
description: description:
description: description:
- The description of the monitor. - The description of the monitor.
type: str
version_added: 2.7 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(https) been set, it cannot be changed. By default, this value is the C(https)
parent on the C(Common) partition. parent on the C(Common) partition.
type: str
default: /Common/https default: /Common/https
send: send:
description: description:
- The send string for the monitor call. When creating a new monitor, if - The send string for the monitor call. When creating a new monitor, if
this value is not provided, the default C(GET /\\r\\n) will be used. this value is not provided, the default C(GET /\\r\\n) will be used.
type: str
receive: receive:
description: description:
- The receive string for the monitor call. - The receive string for the monitor call.
type: str
receive_disable: receive_disable:
description: description:
- This setting works like C(receive), except that the system marks the node - This setting works like C(receive), except that the system marks the node
or pool member disabled when its response matches the C(receive_disable) or pool member disabled when its response matches the C(receive_disable)
string but not C(receive). To use this setting, you must specify both string but not C(receive). To use this setting, you must specify both
C(receive_disable) and C(receive). C(receive_disable) and C(receive).
type: str
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
provided when creating a new monitor, then the default value will be provided when creating a new monitor, then the default value will be
'*'. '*'.
type: str
port: port:
description: description:
- Port address part of the IP/port definition. If this parameter is not - 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 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 '*'. Note that if specifying an IP address, a value between 1 and 65535
must be specified. must be specified.
type: str
interval: interval:
description: description:
- The interval specifying how frequently the monitor instance of this - The interval specifying how frequently the monitor instance of this
template will run. If this parameter is not provided when creating template will run. If this parameter is not provided when creating
a new monitor, then the default value will be 5. This value B(must) a new monitor, then the default value will be 5. This value B(must)
be less than the C(timeout) value. be less than the C(timeout) value.
type: int
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
@ -72,6 +81,7 @@ options:
number to any number you want, however, it should be 3 times the 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 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. provided when creating a new monitor, then the default value will be 16.
type: int
time_until_up: time_until_up:
description: description:
- Specifies the amount of time in seconds after the first successful - Specifies the amount of time in seconds after the first successful
@ -79,18 +89,22 @@ 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.
type: int
target_username: target_username:
description: description:
- Specifies the user name, if the monitored target requires authentication. - Specifies the user name, if the monitored target requires authentication.
type: str
target_password: target_password:
description: description:
- Specifies the password, if the monitored target requires authentication. - Specifies the password, if the monitored target requires authentication.
type: str
ssl_profile: ssl_profile:
description: description:
- Specifies the SSL profile to use for the HTTPS monitor. - Specifies the SSL profile to use for the HTTPS monitor.
- Defining SSL profiles enables refined customization of the SSL attributes - Defining SSL profiles enables refined customization of the SSL attributes
for an HTTPS monitor. for an HTTPS monitor.
- This parameter is only supported on BIG-IP versions 13.x and later. - This parameter is only supported on BIG-IP versions 13.x and later.
type: str
version_added: 2.8 version_added: 2.8
up_interval: up_interval:
description: description:
@ -100,19 +114,22 @@ options:
C(interval) to check the health of the resource. C(interval) to check the health of the resource.
- When any other number, enables specification of a different interval to - When any other number, enables specification of a different interval to
use when checking the health of a resource that is up. use when checking the health of a resource that is up.
type: int
version_added: 2.8 version_added: 2.8
partition: partition:
description: description:
- Device partition to manage resources on. - Device partition to manage resources on.
type: str
default: Common default: Common
state: state:
description: description:
- When C(present), ensures that the monitor exists. - When C(present), ensures that the monitor exists.
- When C(absent), ensures the monitor is removed. - When C(absent), ensures the monitor is removed.
default: present type: str
choices: choices:
- present - present
- absent - absent
default: present
version_added: 2.5 version_added: 2.5
notes: notes:
- Requires BIG-IP software version >= 12 - Requires BIG-IP software version >= 12
@ -190,12 +207,9 @@ try:
from library.module_utils.network.f5.bigip import F5RestClient from library.module_utils.network.f5.bigip import F5RestClient
from library.module_utils.network.f5.common import F5ModuleError from library.module_utils.network.f5.common import F5ModuleError
from library.module_utils.network.f5.common import AnsibleF5Parameters from library.module_utils.network.f5.common import AnsibleF5Parameters
from library.module_utils.network.f5.common import cleanup_tokens
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 transform_name 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.ipaddress import is_valid_ip from library.module_utils.network.f5.ipaddress import is_valid_ip
from library.module_utils.network.f5.compare import cmp_str_with_none from library.module_utils.network.f5.compare import cmp_str_with_none
@ -203,12 +217,9 @@ except ImportError:
from ansible.module_utils.network.f5.bigip import F5RestClient from ansible.module_utils.network.f5.bigip import F5RestClient
from ansible.module_utils.network.f5.common import F5ModuleError from ansible.module_utils.network.f5.common import F5ModuleError
from ansible.module_utils.network.f5.common import AnsibleF5Parameters from ansible.module_utils.network.f5.common import AnsibleF5Parameters
from ansible.module_utils.network.f5.common import cleanup_tokens
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 transform_name 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 f5_argument_spec 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.ipaddress import is_valid_ip
from ansible.module_utils.network.f5.compare import cmp_str_with_none from ansible.module_utils.network.f5.compare import cmp_str_with_none
@ -482,7 +493,7 @@ class Difference(object):
class ModuleManager(object): class ModuleManager(object):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.module = kwargs.get('module', None) self.module = kwargs.get('module', None)
self.client = kwargs.get('client', None) self.client = F5RestClient(**self.module.params)
self.want = ModuleParameters(params=self.module.params) self.want = ModuleParameters(params=self.module.params)
self.have = ApiParameters() self.have = ApiParameters()
self.changes = UsableChanges() self.changes = UsableChanges()
@ -719,16 +730,12 @@ def main():
supports_check_mode=spec.supports_check_mode, supports_check_mode=spec.supports_check_mode,
) )
client = F5RestClient(**module.params)
try: try:
mm = ModuleManager(module=module, client=client) mm = ModuleManager(module=module)
results = mm.exec_module() results = mm.exec_module()
cleanup_tokens(client) module.exit_json(**results)
exit_json(module, results, client)
except F5ModuleError as ex: except F5ModuleError as ex:
cleanup_tokens(client) module.fail_json(msg=str(ex))
fail_json(module, ex, client)
if __name__ == '__main__': if __name__ == '__main__':

@ -23,21 +23,25 @@ options:
name: name:
description: description:
- Monitor name. - Monitor name.
type: str
required: True required: True
description: description:
description: description:
- Specifies descriptive text that identifies the monitor. - Specifies descriptive text that identifies the monitor.
type: str
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. been set, it cannot be changed.
- By default, this value is the C(ldap) parent on the C(Common) partition. - By default, this value is the C(ldap) parent on the C(Common) partition.
type: str
default: "/Common/ldap" default: "/Common/ldap"
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
provided when creating a new monitor, then the default value will be provided when creating a new monitor, then the default value will be
'*'. '*'.
type: str
port: port:
description: description:
- Port address part of the IP/port definition. If this parameter is not - Port address part of the IP/port definition. If this parameter is not
@ -45,11 +49,13 @@ options:
'*'. '*'.
- Note that if specifying an IP address, a value between 1 and 65535 - Note that if specifying an IP address, a value between 1 and 65535
must be specified. must be specified.
type: str
interval: interval:
description: description:
- Specifies, in seconds, the frequency at which the system issues the - Specifies, in seconds, the frequency at which the system issues the
monitor check when either the resource is down or the status of the monitor check when either the resource is down or the status of the
resource is unknown. resource is unknown.
type: int
timeout: timeout:
description: description:
- Specifies the number of seconds the target has in which to respond to - Specifies the number of seconds the target has in which to respond to
@ -60,6 +66,7 @@ options:
from the parent monitor. from the parent monitor.
- Note that C(timeout) and C(time_until_up) combine to control when a - Note that C(timeout) and C(time_until_up) combine to control when a
resource is set to up. resource is set to up.
type: int
time_until_up: time_until_up:
description: description:
- Specifies the number of seconds to wait after a resource first responds - Specifies the number of seconds to wait after a resource first responds
@ -68,6 +75,7 @@ options:
- When the interval expires, the resource is marked 'up'. - When the interval expires, the resource is marked 'up'.
- A value of 0, means that the resource is marked up immediately upon - A value of 0, means that the resource is marked up immediately upon
receipt of the first correct response. receipt of the first correct response.
type: int
up_interval: up_interval:
description: description:
- Specifies the interval for the system to use to perform the health check - Specifies the interval for the system to use to perform the health check
@ -76,6 +84,7 @@ options:
C(interval) to check the health of the resource. C(interval) to check the health of the resource.
- When any other number, enables specification of a different interval to - When any other number, enables specification of a different interval to
use when checking the health of a resource that is up. use when checking the health of a resource that is up.
type: int
manual_resume: manual_resume:
description: description:
- Specifies whether the system automatically changes the status of a resource - Specifies whether the system automatically changes the status of a resource
@ -90,19 +99,24 @@ options:
target_username: target_username:
description: description:
- Specifies the user name, if the monitored target requires authentication. - Specifies the user name, if the monitored target requires authentication.
type: str
target_password: target_password:
description: description:
- Specifies the password, if the monitored target requires authentication. - Specifies the password, if the monitored target requires authentication.
type: str
base: base:
description: description:
- Specifies the location in the LDAP tree from which the monitor starts the - Specifies the location in the LDAP tree from which the monitor starts the
health check. health check.
type: str
filter: filter:
description: description:
- Specifies an LDAP key for which the monitor searches. - Specifies an LDAP key for which the monitor searches.
type: str
security: security:
description: description:
- Specifies the secure protocol type for communications with the target. - Specifies the secure protocol type for communications with the target.
type: str
choices: choices:
- none - none
- ssl - ssl
@ -126,22 +140,25 @@ options:
description: description:
- C(always) will update passwords if the C(target_password) is specified. - C(always) will update passwords if the C(target_password) is specified.
- C(on_create) will only set the password for newly created monitors. - C(on_create) will only set the password for newly created monitors.
default: always type: str
choices: choices:
- always - always
- on_create - on_create
default: always
partition: partition:
description: description:
- Device partition to manage resources on. - Device partition to manage resources on.
type: str
default: Common default: Common
state: state:
description: description:
- When C(present), ensures that the monitor exists. - When C(present), ensures that the monitor exists.
- When C(absent), ensures the monitor is removed. - When C(absent), ensures the monitor is removed.
default: present type: str
choices: choices:
- present - present
- absent - absent
default: present
extends_documentation_fragment: f5 extends_documentation_fragment: f5
author: author:
- Tim Rupp (@caphrim007) - Tim Rupp (@caphrim007)
@ -233,11 +250,8 @@ try:
from library.module_utils.network.f5.bigip import F5RestClient from library.module_utils.network.f5.bigip import F5RestClient
from library.module_utils.network.f5.common import F5ModuleError from library.module_utils.network.f5.common import F5ModuleError
from library.module_utils.network.f5.common import AnsibleF5Parameters from library.module_utils.network.f5.common import AnsibleF5Parameters
from library.module_utils.network.f5.common import cleanup_tokens
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 exit_json
from library.module_utils.network.f5.common import fail_json
from library.module_utils.network.f5.common import transform_name 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 flatten_boolean
from library.module_utils.network.f5.ipaddress import is_valid_ip from library.module_utils.network.f5.ipaddress import is_valid_ip
@ -246,11 +260,8 @@ except ImportError:
from ansible.module_utils.network.f5.bigip import F5RestClient from ansible.module_utils.network.f5.bigip import F5RestClient
from ansible.module_utils.network.f5.common import F5ModuleError from ansible.module_utils.network.f5.common import F5ModuleError
from ansible.module_utils.network.f5.common import AnsibleF5Parameters from ansible.module_utils.network.f5.common import AnsibleF5Parameters
from ansible.module_utils.network.f5.common import cleanup_tokens
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 exit_json
from ansible.module_utils.network.f5.common import fail_json
from ansible.module_utils.network.f5.common import transform_name 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 flatten_boolean
from ansible.module_utils.network.f5.ipaddress import is_valid_ip from ansible.module_utils.network.f5.ipaddress import is_valid_ip
@ -560,7 +571,7 @@ class Difference(object):
class ModuleManager(object): class ModuleManager(object):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.module = kwargs.get('module', None) self.module = kwargs.get('module', None)
self.client = kwargs.get('client', None) self.client = F5RestClient(**self.module.params)
self.want = ModuleParameters(params=self.module.params) self.want = ModuleParameters(params=self.module.params)
self.have = ApiParameters() self.have = ApiParameters()
self.changes = UsableChanges() self.changes = UsableChanges()
@ -798,16 +809,12 @@ def main():
supports_check_mode=spec.supports_check_mode, supports_check_mode=spec.supports_check_mode,
) )
client = F5RestClient(**module.params)
try: try:
mm = ModuleManager(module=module, client=client) mm = ModuleManager(module=module)
results = mm.exec_module() results = mm.exec_module()
cleanup_tokens(client) module.exit_json(**results)
exit_json(module, results, client)
except F5ModuleError as ex: except F5ModuleError as ex:
cleanup_tokens(client) module.fail_json(msg=str(ex))
fail_json(module, ex, client)
if __name__ == '__main__': if __name__ == '__main__':

@ -25,21 +25,25 @@ options:
name: name:
description: description:
- Monitor name. - Monitor name.
type: str
required: True required: True
description: description:
description: description:
- Specifies descriptive text that identifies the monitor. - Specifies descriptive text that identifies the monitor.
type: str
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(snmp_dca) been set, it cannot be changed. By default, this value is the C(snmp_dca)
parent on the C(Common) partition. parent on the C(Common) partition.
type: str
default: "/Common/snmp_dca" default: "/Common/snmp_dca"
interval: interval:
description: description:
- Specifies, in seconds, the frequency at which the system issues the - Specifies, in seconds, the frequency at which the system issues the
monitor check when either the resource is down or the status of the monitor check when either the resource is down or the status of the
resource is unknown. When creating a new monitor, the default is C(10). resource is unknown. When creating a new monitor, the default is C(10).
type: int
timeout: timeout:
description: description:
- Specifies the number of seconds the target has in which to respond to - Specifies the number of seconds the target has in which to respond to
@ -50,6 +54,7 @@ options:
the system uses the interval from the parent monitor. Note that the system uses the interval from the parent monitor. Note that
C(timeout) and C(time_until_up) combine to control when a resource is C(timeout) and C(time_until_up) combine to control when a resource is
set to up. set to up.
type: int
time_until_up: time_until_up:
description: description:
- Specifies the number of seconds to wait after a resource first responds - Specifies the number of seconds to wait after a resource first responds
@ -58,17 +63,20 @@ options:
interval expires, the resource is marked 'up'. A value of 0, means interval expires, the resource is marked 'up'. A value of 0, means
that the resource is marked up immediately upon receipt of the first that the resource is marked up immediately upon receipt of the first
correct response. When creating a new monitor, the default is C(0). correct response. When creating a new monitor, the default is C(0).
type: int
community: community:
description: description:
- Specifies the community name that the system must use to authenticate - Specifies the community name that the system must use to authenticate
with the host server through SNMP. When creating a new monitor, the with the host server through SNMP. When creating a new monitor, the
default value is C(public). Note that this value is case sensitive. default value is C(public). Note that this value is case sensitive.
type: str
version: version:
description: description:
- Specifies the version of SNMP that the host server uses. When creating - Specifies the version of SNMP that the host server uses. When creating
a new monitor, the default is C(v1). When C(v1), specifies that the a new monitor, the default is C(v1). When C(v1), specifies that the
host server uses SNMP version 1. When C(v2c), specifies that the host host server uses SNMP version 1. When C(v2c), specifies that the host
server uses SNMP version 2c. server uses SNMP version 2c.
type: str
choices: choices:
- v1 - v1
- v2c - v2c
@ -76,6 +84,7 @@ options:
description: description:
- Specifies the SNMP agent running on the monitored server. When creating - Specifies the SNMP agent running on the monitored server. When creating
a new monitor, the default is C(UCD) (UC-Davis). a new monitor, the default is C(UCD) (UC-Davis).
type: str
choices: choices:
- UCD - UCD
- WIN2000 - WIN2000
@ -85,40 +94,48 @@ options:
- Specifies the coefficient that the system uses to calculate the weight - Specifies the coefficient that the system uses to calculate the weight
of the CPU threshold in the dynamic ratio load balancing algorithm. of the CPU threshold in the dynamic ratio load balancing algorithm.
When creating a new monitor, the default is C(1.5). When creating a new monitor, the default is C(1.5).
type: str
cpu_threshold: cpu_threshold:
description: description:
- Specifies the maximum acceptable CPU usage on the target server. When - Specifies the maximum acceptable CPU usage on the target server. When
creating a new monitor, the default is C(80) percent. creating a new monitor, the default is C(80) percent.
type: int
memory_coefficient: memory_coefficient:
description: description:
- Specifies the coefficient that the system uses to calculate the weight - Specifies the coefficient that the system uses to calculate the weight
of the memory threshold in the dynamic ratio load balancing algorithm. of the memory threshold in the dynamic ratio load balancing algorithm.
When creating a new monitor, the default is C(1.0). When creating a new monitor, the default is C(1.0).
type: str
memory_threshold: memory_threshold:
description: description:
- Specifies the maximum acceptable memory usage on the target server. - Specifies the maximum acceptable memory usage on the target server.
When creating a new monitor, the default is C(70) percent. When creating a new monitor, the default is C(70) percent.
type: int
disk_coefficient: disk_coefficient:
description: description:
- Specifies the coefficient that the system uses to calculate the weight - Specifies the coefficient that the system uses to calculate the weight
of the disk threshold in the dynamic ratio load balancing algorithm. of the disk threshold in the dynamic ratio load balancing algorithm.
When creating a new monitor, the default is C(2.0). When creating a new monitor, the default is C(2.0).
type: str
disk_threshold: disk_threshold:
description: description:
- Specifies the maximum acceptable disk usage on the target server. When - Specifies the maximum acceptable disk usage on the target server. When
creating a new monitor, the default is C(90) percent. creating a new monitor, the default is C(90) percent.
type: int
partition: partition:
description: description:
- Device partition to manage resources on. - Device partition to manage resources on.
type: str
default: Common default: Common
state: state:
description: description:
- When C(present), ensures that the monitor exists. - When C(present), ensures that the monitor exists.
- When C(absent), ensures the monitor is removed. - When C(absent), ensures the monitor is removed.
default: present type: str
choices: choices:
- present - present
- absent - absent
default: present
version_added: 2.5 version_added: 2.5
notes: notes:
- Requires BIG-IP software version >= 12 - Requires BIG-IP software version >= 12
@ -234,23 +251,17 @@ try:
from library.module_utils.network.f5.bigip import F5RestClient from library.module_utils.network.f5.bigip import F5RestClient
from library.module_utils.network.f5.common import F5ModuleError from library.module_utils.network.f5.common import F5ModuleError
from library.module_utils.network.f5.common import AnsibleF5Parameters from library.module_utils.network.f5.common import AnsibleF5Parameters
from library.module_utils.network.f5.common import cleanup_tokens
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 transform_name 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.compare import cmp_str_with_none
except ImportError: except ImportError:
from ansible.module_utils.network.f5.bigip import F5RestClient from ansible.module_utils.network.f5.bigip import F5RestClient
from ansible.module_utils.network.f5.common import F5ModuleError from ansible.module_utils.network.f5.common import F5ModuleError
from ansible.module_utils.network.f5.common import AnsibleF5Parameters from ansible.module_utils.network.f5.common import AnsibleF5Parameters
from ansible.module_utils.network.f5.common import cleanup_tokens
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 transform_name 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.compare import cmp_str_with_none
@ -490,7 +501,7 @@ class Difference(object):
class ModuleManager(object): class ModuleManager(object):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.module = kwargs.get('module', None) self.module = kwargs.get('module', None)
self.client = kwargs.get('client', None) self.client = F5RestClient(**self.module.params)
self.want = ModuleParameters(params=self.module.params) self.want = ModuleParameters(params=self.module.params)
self.have = ApiParameters() self.have = ApiParameters()
self.changes = UsableChanges() self.changes = UsableChanges()
@ -741,16 +752,12 @@ def main():
supports_check_mode=spec.supports_check_mode, supports_check_mode=spec.supports_check_mode,
) )
client = F5RestClient(**module.params)
try: try:
mm = ModuleManager(module=module, client=client) mm = ModuleManager(module=module)
results = mm.exec_module() results = mm.exec_module()
cleanup_tokens(client) module.exit_json(**results)
exit_json(module, results, client)
except F5ModuleError as ex: except F5ModuleError as ex:
cleanup_tokens(client) module.fail_json(msg=str(ex))
fail_json(module, ex, client)
if __name__ == '__main__': if __name__ == '__main__':

@ -22,23 +22,28 @@ options:
name: name:
description: description:
- Monitor name. - Monitor name.
type: str
required: True required: True
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)
parent on the C(Common) partition. parent on the C(Common) partition.
type: str
default: /Common/tcp default: /Common/tcp
description: description:
description: description:
- The description of the monitor. - The description of the monitor.
type: str
version_added: 2.7 version_added: 2.7
send: send:
description: description:
- The send string for the monitor call. - The send string for the monitor call.
type: str
receive: receive:
description: description:
- The receive string for the monitor call. - The receive string for the monitor call.
type: str
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
@ -46,6 +51,7 @@ 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.
type: str
port: port:
description: description:
- Port address part of the IP/port definition. If this parameter is not - Port address part of the IP/port definition. If this parameter is not
@ -53,12 +59,14 @@ options:
'*'. Note that if specifying an IP address, a value between 1 and 65535 '*'. Note that if specifying an IP address, a value between 1 and 65535
must be specified must be specified
- This argument is not supported for TCP Echo types. - This argument is not supported for TCP Echo types.
type: str
interval: interval:
description: description:
- The interval specifying how frequently the monitor instance of this - The interval specifying how frequently the monitor instance of this
template will run. If this parameter is not provided when creating template will run. If this parameter is not provided when creating
a new monitor, then the default value will be 5. This value B(must) a new monitor, then the default value will be 5. This value B(must)
be less than the C(timeout) value. be less than the C(timeout) value.
type: int
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
@ -68,6 +76,7 @@ options:
number to any number you want, however, it should be 3 times the 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 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. provided when creating a new monitor, then the default value will be 16.
type: int
time_until_up: time_until_up:
description: description:
- Specifies the amount of time in seconds after the first successful - Specifies the amount of time in seconds after the first successful
@ -75,19 +84,22 @@ 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.
type: int
partition: partition:
description: description:
- Device partition to manage resources on. - Device partition to manage resources on.
type: str
default: Common default: Common
version_added: 2.5 version_added: 2.5
state: state:
description: description:
- When C(present), ensures that the monitor exists. - When C(present), ensures that the monitor exists.
- When C(absent), ensures the monitor is removed. - When C(absent), ensures the monitor is removed.
default: present type: str
choices: choices:
- present - present
- absent - absent
default: present
version_added: 2.5 version_added: 2.5
notes: notes:
- Requires BIG-IP software version >= 12 - Requires BIG-IP software version >= 12
@ -176,12 +188,9 @@ try:
from library.module_utils.network.f5.bigip import F5RestClient from library.module_utils.network.f5.bigip import F5RestClient
from library.module_utils.network.f5.common import F5ModuleError from library.module_utils.network.f5.common import F5ModuleError
from library.module_utils.network.f5.common import AnsibleF5Parameters from library.module_utils.network.f5.common import AnsibleF5Parameters
from library.module_utils.network.f5.common import cleanup_tokens
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 transform_name 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.ipaddress import is_valid_ip from library.module_utils.network.f5.ipaddress import is_valid_ip
from library.module_utils.network.f5.compare import cmp_str_with_none from library.module_utils.network.f5.compare import cmp_str_with_none
@ -189,12 +198,9 @@ except ImportError:
from ansible.module_utils.network.f5.bigip import F5RestClient from ansible.module_utils.network.f5.bigip import F5RestClient
from ansible.module_utils.network.f5.common import F5ModuleError from ansible.module_utils.network.f5.common import F5ModuleError
from ansible.module_utils.network.f5.common import AnsibleF5Parameters from ansible.module_utils.network.f5.common import AnsibleF5Parameters
from ansible.module_utils.network.f5.common import cleanup_tokens
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 transform_name 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.ipaddress import is_valid_ip from ansible.module_utils.network.f5.ipaddress import is_valid_ip
from ansible.module_utils.network.f5.compare import cmp_str_with_none from ansible.module_utils.network.f5.compare import cmp_str_with_none
@ -419,7 +425,7 @@ class Difference(object):
class ModuleManager(object): class ModuleManager(object):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.module = kwargs.get('module', None) self.module = kwargs.get('module', None)
self.client = kwargs.get('client', None) self.client = F5RestClient(**self.module.params)
self.want = ModuleParameters(params=self.module.params) self.want = ModuleParameters(params=self.module.params)
self.have = ApiParameters() self.have = ApiParameters()
self.changes = UsableChanges() self.changes = UsableChanges()
@ -649,16 +655,12 @@ def main():
supports_check_mode=spec.supports_check_mode, supports_check_mode=spec.supports_check_mode,
) )
client = F5RestClient(**module.params)
try: try:
mm = ModuleManager(module=module, client=client) mm = ModuleManager(module=module)
results = mm.exec_module() results = mm.exec_module()
cleanup_tokens(client) module.exit_json(**results)
exit_json(module, results, client)
except F5ModuleError as ex: except F5ModuleError as ex:
cleanup_tokens(client) module.fail_json(msg=str(ex))
fail_json(module, ex, client)
if __name__ == '__main__': if __name__ == '__main__':

@ -22,28 +22,33 @@ options:
name: name:
description: description:
- Monitor name. - Monitor name.
type: str
required: True required: True
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_echo) been set, it cannot be changed. By default, this value is the C(tcp_echo)
parent on the C(Common) partition. parent on the C(Common) partition.
type: str
default: /Common/tcp_echo default: /Common/tcp_echo
description: description:
description: description:
- The description of the monitor. - The description of the monitor.
type: str
version_added: 2.7 version_added: 2.7
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
provided when creating a new monitor, then the default value will be provided when creating a new monitor, then the default value will be
'*'. '*'.
type: str
interval: interval:
description: description:
- The interval specifying how frequently the monitor instance of this - The interval specifying how frequently the monitor instance of this
template will run. If this parameter is not provided when creating template will run. If this parameter is not provided when creating
a new monitor, then the default value will be 5. This value B(must) a new monitor, then the default value will be 5. This value B(must)
be less than the C(timeout) value. be less than the C(timeout) value.
type: int
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
@ -53,6 +58,7 @@ options:
number to any number you want, however, it should be 3 times the 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 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. provided when creating a new monitor, then the default value will be 16.
type: int
time_until_up: time_until_up:
description: description:
- Specifies the amount of time in seconds after the first successful - Specifies the amount of time in seconds after the first successful
@ -60,19 +66,22 @@ 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.
type: int
partition: partition:
description: description:
- Device partition to manage resources on. - Device partition to manage resources on.
type: str
default: Common default: Common
version_added: 2.5 version_added: 2.5
state: state:
description: description:
- When C(present), ensures that the monitor exists. - When C(present), ensures that the monitor exists.
- When C(absent), ensures the monitor is removed. - When C(absent), ensures the monitor is removed.
default: present type: str
choices: choices:
- present - present
- absent - absent
default: present
version_added: 2.5 version_added: 2.5
notes: notes:
- Requires BIG-IP software version >= 12 - Requires BIG-IP software version >= 12
@ -147,22 +156,16 @@ try:
from library.module_utils.network.f5.bigip import F5RestClient from library.module_utils.network.f5.bigip import F5RestClient
from library.module_utils.network.f5.common import F5ModuleError from library.module_utils.network.f5.common import F5ModuleError
from library.module_utils.network.f5.common import AnsibleF5Parameters from library.module_utils.network.f5.common import AnsibleF5Parameters
from library.module_utils.network.f5.common import cleanup_tokens
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 transform_name 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.ipaddress import is_valid_ip from library.module_utils.network.f5.ipaddress import is_valid_ip
from library.module_utils.network.f5.compare import cmp_str_with_none from library.module_utils.network.f5.compare import cmp_str_with_none
except ImportError: except ImportError:
from ansible.module_utils.network.f5.bigip import F5RestClient from ansible.module_utils.network.f5.bigip import F5RestClient
from ansible.module_utils.network.f5.common import F5ModuleError from ansible.module_utils.network.f5.common import F5ModuleError
from ansible.module_utils.network.f5.common import AnsibleF5Parameters from ansible.module_utils.network.f5.common import AnsibleF5Parameters
from ansible.module_utils.network.f5.common import cleanup_tokens
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 transform_name 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.ipaddress import is_valid_ip from ansible.module_utils.network.f5.ipaddress import is_valid_ip
from ansible.module_utils.network.f5.compare import cmp_str_with_none from ansible.module_utils.network.f5.compare import cmp_str_with_none
@ -360,7 +363,7 @@ class Difference(object):
class ModuleManager(object): class ModuleManager(object):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.module = kwargs.get('module', None) self.module = kwargs.get('module', None)
self.client = kwargs.get('client', None) self.client = F5RestClient(**self.module.params)
self.want = ModuleParameters(params=self.module.params) self.want = ModuleParameters(params=self.module.params)
self.have = ApiParameters() self.have = ApiParameters()
self.changes = UsableChanges() self.changes = UsableChanges()
@ -585,16 +588,12 @@ def main():
supports_check_mode=spec.supports_check_mode, supports_check_mode=spec.supports_check_mode,
) )
client = F5RestClient(**module.params)
try: try:
mm = ModuleManager(module=module, client=client) mm = ModuleManager(module=module)
results = mm.exec_module() results = mm.exec_module()
cleanup_tokens(client) module.exit_json(**results)
exit_json(module, results, client)
except F5ModuleError as ex: except F5ModuleError as ex:
cleanup_tokens(client) module.fail_json(msg=str(ex))
fail_json(module, ex, client)
if __name__ == '__main__': if __name__ == '__main__':

@ -22,16 +22,19 @@ options:
name: name:
description: description:
- Monitor name. - Monitor name.
type: str
required: True required: True
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_half_open) 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.
type: str
default: /Common/tcp_half_open default: /Common/tcp_half_open
description: description:
description: description:
- The description of the monitor. - The description of the monitor.
type: str
version_added: 2.7 version_added: 2.7
ip: ip:
description: description:
@ -40,12 +43,14 @@ 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.
type: str
port: port:
description: description:
- Port address part of the IP/port definition. If this parameter is not - 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 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 '*'. Note that if specifying an IP address, a value between 1 and 65535
must be specified must be specified
type: str
version_added: 2.5 version_added: 2.5
interval: interval:
description: description:
@ -53,6 +58,7 @@ options:
template will run. If this parameter is not provided when creating template will run. If this parameter is not provided when creating
a new monitor, then the default value will be 5. This value B(must) a new monitor, then the default value will be 5. This value B(must)
be less than the C(timeout) value. be less than the C(timeout) value.
type: int
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
@ -62,6 +68,7 @@ options:
number to any number you want, however, it should be 3 times the 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 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. provided when creating a new monitor, then the default value will be 16.
type: int
time_until_up: time_until_up:
description: description:
- Specifies the amount of time in seconds after the first successful - Specifies the amount of time in seconds after the first successful
@ -69,19 +76,22 @@ 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.
type: int
partition: partition:
description: description:
- Device partition to manage resources on. - Device partition to manage resources on.
type: str
default: Common default: Common
version_added: 2.5 version_added: 2.5
state: state:
description: description:
- When C(present), ensures that the monitor exists. - When C(present), ensures that the monitor exists.
- When C(absent), ensures the monitor is removed. - When C(absent), ensures the monitor is removed.
default: present type: str
choices: choices:
- present - present
- absent - absent
default: present
version_added: 2.5 version_added: 2.5
notes: notes:
- Requires BIG-IP software version >= 12 - Requires BIG-IP software version >= 12
@ -167,22 +177,16 @@ try:
from library.module_utils.network.f5.bigip import F5RestClient from library.module_utils.network.f5.bigip import F5RestClient
from library.module_utils.network.f5.common import F5ModuleError from library.module_utils.network.f5.common import F5ModuleError
from library.module_utils.network.f5.common import AnsibleF5Parameters from library.module_utils.network.f5.common import AnsibleF5Parameters
from library.module_utils.network.f5.common import cleanup_tokens
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 transform_name 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.ipaddress import is_valid_ip from library.module_utils.network.f5.ipaddress import is_valid_ip
from library.module_utils.network.f5.compare import cmp_str_with_none from library.module_utils.network.f5.compare import cmp_str_with_none
except ImportError: except ImportError:
from ansible.module_utils.network.f5.bigip import F5RestClient from ansible.module_utils.network.f5.bigip import F5RestClient
from ansible.module_utils.network.f5.common import F5ModuleError from ansible.module_utils.network.f5.common import F5ModuleError
from ansible.module_utils.network.f5.common import AnsibleF5Parameters from ansible.module_utils.network.f5.common import AnsibleF5Parameters
from ansible.module_utils.network.f5.common import cleanup_tokens
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 transform_name 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.ipaddress import is_valid_ip from ansible.module_utils.network.f5.ipaddress import is_valid_ip
from ansible.module_utils.network.f5.compare import cmp_str_with_none from ansible.module_utils.network.f5.compare import cmp_str_with_none
@ -407,7 +411,7 @@ class Difference(object):
class ModuleManager(object): class ModuleManager(object):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.module = kwargs.get('module', None) self.module = kwargs.get('module', None)
self.client = kwargs.get('client', None) self.client = F5RestClient(**self.module.params)
self.want = ModuleParameters(params=self.module.params) self.want = ModuleParameters(params=self.module.params)
self.have = ApiParameters() self.have = ApiParameters()
self.changes = UsableChanges() self.changes = UsableChanges()
@ -635,16 +639,12 @@ def main():
supports_check_mode=spec.supports_check_mode, supports_check_mode=spec.supports_check_mode,
) )
client = F5RestClient(**module.params)
try: try:
mm = ModuleManager(module=module, client=client) mm = ModuleManager(module=module)
results = mm.exec_module() results = mm.exec_module()
cleanup_tokens(client) module.exit_json(**results)
exit_json(module, results, client)
except F5ModuleError as ex: except F5ModuleError as ex:
cleanup_tokens(client) module.fail_json(msg=str(ex))
fail_json(module, ex, client)
if __name__ == '__main__': if __name__ == '__main__':

@ -22,47 +22,56 @@ options:
name: name:
description: description:
- Monitor name. - Monitor name.
type: str
required: True required: True
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(udp) been set, it cannot be changed. By default, this value is the C(udp)
parent on the C(Common) partition. parent on the C(Common) partition.
type: str
default: /Common/udp default: /Common/udp
description: description:
description: description:
- The description of the monitor. - The description of the monitor.
type: str
version_added: 2.7 version_added: 2.7
send: send:
description: description:
- The send string for the monitor call. When creating a new monitor, if - The send string for the monitor call. When creating a new monitor, if
this value is not provided, the default C(default send string) will be used. this value is not provided, the default C(default send string) will be used.
type: str
receive: receive:
description: description:
- The receive string for the monitor call. - The receive string for the monitor call.
type: str
receive_disable: receive_disable:
description: description:
- This setting works like C(receive), except that the system marks the node - This setting works like C(receive), except that the system marks the node
or pool member disabled when its response matches the C(receive_disable) or pool member disabled when its response matches the C(receive_disable)
string but not C(receive). To use this setting, you must specify both string but not C(receive). To use this setting, you must specify both
C(receive_disable) and C(receive). C(receive_disable) and C(receive).
type: str
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
provided when creating a new monitor, then the default value will be provided when creating a new monitor, then the default value will be
'*'. '*'.
type: str
port: port:
description: description:
- Port address part of the IP/port definition. If this parameter is not - 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 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 '*'. Note that if specifying an IP address, a value between 1 and 65535
must be specified. must be specified.
type: str
interval: interval:
description: description:
- The interval specifying how frequently the monitor instance of this - The interval specifying how frequently the monitor instance of this
template will run. If this parameter is not provided when creating template will run. If this parameter is not provided when creating
a new monitor, then the default value will be 5. This value B(must) a new monitor, then the default value will be 5. This value B(must)
be less than the C(timeout) value. be less than the C(timeout) value.
type: int
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
@ -72,6 +81,7 @@ options:
number to any number you want, however, it should be 3 times the 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 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. provided when creating a new monitor, then the default value will be 16.
type: int
time_until_up: time_until_up:
description: description:
- Specifies the amount of time in seconds after the first successful - Specifies the amount of time in seconds after the first successful
@ -79,19 +89,22 @@ 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.
type: int
partition: partition:
description: description:
- Device partition to manage resources on. - Device partition to manage resources on.
type: str
default: Common default: Common
version_added: 2.5 version_added: 2.5
state: state:
description: description:
- When C(present), ensures that the monitor exists. - When C(present), ensures that the monitor exists.
- When C(absent), ensures the monitor is removed. - When C(absent), ensures the monitor is removed.
default: present type: str
choices: choices:
- present - present
- absent - absent
default: present
version_added: 2.5 version_added: 2.5
notes: notes:
- Requires BIG-IP software version >= 12 - Requires BIG-IP software version >= 12
@ -165,12 +178,9 @@ try:
from library.module_utils.network.f5.bigip import F5RestClient from library.module_utils.network.f5.bigip import F5RestClient
from library.module_utils.network.f5.common import F5ModuleError from library.module_utils.network.f5.common import F5ModuleError
from library.module_utils.network.f5.common import AnsibleF5Parameters from library.module_utils.network.f5.common import AnsibleF5Parameters
from library.module_utils.network.f5.common import cleanup_tokens
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 transform_name 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.compare import cmp_str_with_none
from library.module_utils.network.f5.ipaddress import is_valid_ip from library.module_utils.network.f5.ipaddress import is_valid_ip
@ -178,12 +188,9 @@ except ImportError:
from ansible.module_utils.network.f5.bigip import F5RestClient from ansible.module_utils.network.f5.bigip import F5RestClient
from ansible.module_utils.network.f5.common import F5ModuleError from ansible.module_utils.network.f5.common import F5ModuleError
from ansible.module_utils.network.f5.common import AnsibleF5Parameters from ansible.module_utils.network.f5.common import AnsibleF5Parameters
from ansible.module_utils.network.f5.common import cleanup_tokens
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 transform_name 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.compare import cmp_str_with_none
from ansible.module_utils.network.f5.ipaddress import is_valid_ip from ansible.module_utils.network.f5.ipaddress import is_valid_ip
@ -411,7 +418,7 @@ class Difference(object):
class ModuleManager(object): class ModuleManager(object):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.module = kwargs.get('module', None) self.module = kwargs.get('module', None)
self.client = kwargs.get('client', None) self.client = F5RestClient(**self.module.params)
self.want = ModuleParameters(params=self.module.params) self.want = ModuleParameters(params=self.module.params)
self.have = ApiParameters() self.have = ApiParameters()
self.changes = UsableChanges() self.changes = UsableChanges()
@ -644,16 +651,12 @@ def main():
supports_check_mode=spec.supports_check_mode, supports_check_mode=spec.supports_check_mode,
) )
client = F5RestClient(**module.params)
try: try:
mm = ModuleManager(module=module, client=client) mm = ModuleManager(module=module)
results = mm.exec_module() results = mm.exec_module()
cleanup_tokens(client) module.exit_json(**results)
exit_json(module, results, client)
except F5ModuleError as ex: except F5ModuleError as ex:
cleanup_tokens(client) module.fail_json(msg=str(ex))
fail_json(module, ex, client)
if __name__ == '__main__': if __name__ == '__main__':

@ -81,9 +81,11 @@ class TestManager(unittest.TestCase):
def test_update_hostname(self, *args): def test_update_hostname(self, *args):
set_module_args(dict( set_module_args(dict(
hostname='foo2.internal.com', hostname='foo2.internal.com',
password='password', provider=dict(
server='localhost', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
# Configure the parameters that would be returned by querying the # Configure the parameters that would be returned by querying the

@ -323,9 +323,11 @@ class TestManager(unittest.TestCase):
template='f5.http', template='f5.http',
parameters=parameters, parameters=parameters,
state='present', state='present',
password='password', provider=dict(
server='localhost', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(
@ -349,9 +351,11 @@ class TestManager(unittest.TestCase):
template='f5.http', template='f5.http',
parameters=parameters, parameters=parameters,
state='present', state='present',
password='password', provider=dict(
server='localhost', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
# Configure the parameters that would be returned by querying the # Configure the parameters that would be returned by querying the

@ -101,9 +101,11 @@ class TestManager(unittest.TestCase):
# Configure the arguments that would be sent to the Ansible module # Configure the arguments that would be sent to the Ansible module
set_module_args(dict( set_module_args(dict(
content=load_fixture('basic-iapp.tmpl'), content=load_fixture('basic-iapp.tmpl'),
password='password', provider=dict(
server='localhost', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(
@ -124,9 +126,11 @@ class TestManager(unittest.TestCase):
# Configure the arguments that would be sent to the Ansible module # Configure the arguments that would be sent to the Ansible module
set_module_args(dict( set_module_args(dict(
content=load_fixture('basic-iapp.tmpl'), content=load_fixture('basic-iapp.tmpl'),
password='password', provider=dict(
server='localhost', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current1 = Parameters(params=load_fixture('load_sys_application_template_w_new_checksum.json')) current1 = Parameters(params=load_fixture('load_sys_application_template_w_new_checksum.json'))
@ -153,10 +157,12 @@ class TestManager(unittest.TestCase):
def test_delete_iapp_template(self, *args): def test_delete_iapp_template(self, *args):
set_module_args(dict( set_module_args(dict(
content=load_fixture('basic-iapp.tmpl'), content=load_fixture('basic-iapp.tmpl'),
password='password', state='absent',
server='localhost', provider=dict(
user='admin', server='localhost',
state='absent' password='password',
user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(
@ -176,10 +182,12 @@ class TestManager(unittest.TestCase):
def test_delete_iapp_template_idempotent(self, *args): def test_delete_iapp_template_idempotent(self, *args):
set_module_args(dict( set_module_args(dict(
content=load_fixture('basic-iapp.tmpl'), content=load_fixture('basic-iapp.tmpl'),
password='password', state='absent',
server='localhost', provider=dict(
user='admin', server='localhost',
state='absent' password='password',
user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(

@ -89,14 +89,18 @@ class TestUntypedManager(unittest.TestCase):
set_module_args(dict( set_module_args(dict(
name='ike1', name='ike1',
version=['v1'], version=['v1'],
password='password', provider=dict(
server='localhost', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(
argument_spec=self.spec.argument_spec, argument_spec=self.spec.argument_spec,
supports_check_mode=self.spec.supports_check_mode supports_check_mode=self.spec.supports_check_mode,
required_if=self.spec.required_if,
required_together=self.spec.required_together
) )
# Override methods to force specific logic in the module to happen # Override methods to force specific logic in the module to happen

@ -82,15 +82,20 @@ class TestManager(unittest.TestCase):
parents='router bgp 64664', parents='router bgp 64664',
before='bfd slow-timer 2000', before='bfd slow-timer 2000',
match='exact', match='exact',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = load_fixture('load_imish_output_1.json') current = load_fixture('load_imish_output_1.json')
module = AnsibleModule( module = AnsibleModule(
argument_spec=self.spec.argument_spec, argument_spec=self.spec.argument_spec,
supports_check_mode=self.spec.supports_check_mode supports_check_mode=self.spec.supports_check_mode,
mutually_exclusive=self.spec.mutually_exclusive,
required_if=self.spec.required_if,
add_file_common_args=self.spec.add_file_common_args
) )
# Override methods in the specific type of manager # Override methods in the specific type of manager

@ -88,14 +88,17 @@ class TestUntypedManager(unittest.TestCase):
def test_create(self, *args): def test_create(self, *args):
set_module_args(dict( set_module_args(dict(
name='ipsec1', name='ipsec1',
password='password', provider=dict(
server='localhost', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(
argument_spec=self.spec.argument_spec, argument_spec=self.spec.argument_spec,
supports_check_mode=self.spec.supports_check_mode supports_check_mode=self.spec.supports_check_mode,
required_if=self.spec.required_if
) )
# Override methods to force specific logic in the module to happen # Override methods to force specific logic in the module to happen

@ -140,9 +140,11 @@ class TestManager(unittest.TestCase):
module='ltm', module='ltm',
content='this is my content', content='this is my content',
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(
@ -171,9 +173,11 @@ class TestManager(unittest.TestCase):
module='gtm', module='gtm',
content='this is my content', content='this is my content',
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(
@ -202,9 +206,11 @@ class TestManager(unittest.TestCase):
module='gtm', module='gtm',
src='{0}/create_ltm_irule.tcl'.format(fixture_path), src='{0}/create_ltm_irule.tcl'.format(fixture_path),
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(
@ -244,9 +250,11 @@ class TestManager(unittest.TestCase):
state='present', state='present',
src='/path/to/irules/foo.tcl', src='/path/to/irules/foo.tcl',
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
with patch('ansible.module_utils.basic.AnsibleModule.fail_json', unsafe=True) as mo: with patch('ansible.module_utils.basic.AnsibleModule.fail_json', unsafe=True) as mo:

@ -80,9 +80,11 @@ class TestV1Parameters(unittest.TestCase):
forward_to='pool1', forward_to='pool1',
syslog_format='rfc5424' syslog_format='rfc5424'
), ),
password='password', provider=dict(
server='localhost', server='localhost',
user='admin' password='password',
user='admin'
)
) )
p = V1ModuleParameters(params=args) p = V1ModuleParameters(params=args)
assert p.name == 'foo' assert p.name == 'foo'
@ -110,14 +112,17 @@ class TestV1Manager(unittest.TestCase):
forward_to='pool1', forward_to='pool1',
), ),
state='present', state='present',
password='password', provider=dict(
server='localhost', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(
argument_spec=self.spec.argument_spec, argument_spec=self.spec.argument_spec,
supports_check_mode=self.spec.supports_check_mode supports_check_mode=self.spec.supports_check_mode,
mutually_exclusive=self.spec.mutually_exclusive
) )
# Override methods in the specific type of manager # Override methods in the specific type of manager

@ -73,9 +73,11 @@ class TestParameters(unittest.TestCase):
'dest1', 'dest1',
'dest2' 'dest2'
], ],
password='password', provider=dict(
server='localhost', server='localhost',
user='admin' password='password',
user='admin'
)
) )
p = ModuleParameters(params=args) p = ModuleParameters(params=args)
assert p.name == 'foo' assert p.name == 'foo'
@ -108,9 +110,11 @@ class TestManager(unittest.TestCase):
'dest2' 'dest2'
], ],
state='present', state='present',
password='password', provider=dict(
server='localhost', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(

@ -101,9 +101,11 @@ class TestManager(unittest.TestCase):
network='default', network='default',
description='my description', description='my description',
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(

@ -107,9 +107,11 @@ class TestManager(unittest.TestCase):
interval=20, interval=20,
timeout=30, timeout=30,
time_until_up=60, time_until_up=60,
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(
@ -135,9 +137,11 @@ class TestManager(unittest.TestCase):
timeout=30, timeout=30,
time_until_up=60, time_until_up=60,
description='Important Description', description='Important Description',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(

@ -106,9 +106,11 @@ class TestManager(unittest.TestCase):
interval=20, interval=20,
timeout=30, timeout=30,
time_until_up=60, time_until_up=60,
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(
@ -133,9 +135,11 @@ class TestManager(unittest.TestCase):
timeout=30, timeout=30,
time_until_up=60, time_until_up=60,
description='Important Description', description='Important Description',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(

@ -164,9 +164,11 @@ class TestManager(unittest.TestCase):
timeout=30, timeout=30,
time_until_up=60, time_until_up=60,
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(
@ -196,9 +198,11 @@ class TestManager(unittest.TestCase):
timeout=16, timeout=16,
time_until_up=0, time_until_up=0,
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_http.json')) current = Parameters(params=load_fixture('load_ltm_monitor_http.json'))
@ -221,9 +225,11 @@ class TestManager(unittest.TestCase):
name='asdf', name='asdf',
port=800, port=800,
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_http.json')) current = Parameters(params=load_fixture('load_ltm_monitor_http.json'))
@ -248,9 +254,11 @@ class TestManager(unittest.TestCase):
name='foo', name='foo',
interval=10, interval=10,
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_http.json')) current = Parameters(params=load_fixture('load_ltm_monitor_http.json'))
@ -275,9 +283,11 @@ class TestManager(unittest.TestCase):
name='asdf', name='asdf',
interval=30, interval=30,
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_http.json')) current = Parameters(params=load_fixture('load_ltm_monitor_http.json'))
@ -303,9 +313,11 @@ class TestManager(unittest.TestCase):
interval=10, interval=10,
timeout=5, timeout=5,
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_http.json')) current = Parameters(params=load_fixture('load_ltm_monitor_http.json'))
@ -330,9 +342,11 @@ class TestManager(unittest.TestCase):
name='asdf', name='asdf',
send='this is another send string', send='this is another send string',
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_http.json')) current = Parameters(params=load_fixture('load_ltm_monitor_http.json'))
@ -357,9 +371,11 @@ class TestManager(unittest.TestCase):
name='asdf', name='asdf',
receive='this is another receive string', receive='this is another receive string',
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_http.json')) current = Parameters(params=load_fixture('load_ltm_monitor_http.json'))
@ -384,9 +400,11 @@ class TestManager(unittest.TestCase):
name='asdf', name='asdf',
timeout=300, timeout=300,
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_http.json')) current = Parameters(params=load_fixture('load_ltm_monitor_http.json'))
@ -411,9 +429,11 @@ class TestManager(unittest.TestCase):
name='asdf', name='asdf',
time_until_up=300, time_until_up=300,
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_http.json')) current = Parameters(params=load_fixture('load_ltm_monitor_http.json'))

@ -164,9 +164,11 @@ class TestManager(unittest.TestCase):
timeout=30, timeout=30,
time_until_up=60, time_until_up=60,
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(
@ -196,9 +198,11 @@ class TestManager(unittest.TestCase):
timeout=16, timeout=16,
time_until_up=0, time_until_up=0,
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_https.json')) current = Parameters(params=load_fixture('load_ltm_monitor_https.json'))
@ -221,9 +225,11 @@ class TestManager(unittest.TestCase):
name='asdf', name='asdf',
port=800, port=800,
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_https.json')) current = Parameters(params=load_fixture('load_ltm_monitor_https.json'))
@ -248,9 +254,11 @@ class TestManager(unittest.TestCase):
name='foo', name='foo',
interval=10, interval=10,
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_https.json')) current = Parameters(params=load_fixture('load_ltm_monitor_https.json'))
@ -275,9 +283,11 @@ class TestManager(unittest.TestCase):
name='asdf', name='asdf',
interval=30, interval=30,
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_https.json')) current = Parameters(params=load_fixture('load_ltm_monitor_https.json'))
@ -303,9 +313,11 @@ class TestManager(unittest.TestCase):
interval=10, interval=10,
timeout=5, timeout=5,
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_https.json')) current = Parameters(params=load_fixture('load_ltm_monitor_https.json'))
@ -330,9 +342,11 @@ class TestManager(unittest.TestCase):
name='asdf', name='asdf',
send='this is another send string', send='this is another send string',
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_https.json')) current = Parameters(params=load_fixture('load_ltm_monitor_https.json'))
@ -357,9 +371,11 @@ class TestManager(unittest.TestCase):
name='asdf', name='asdf',
receive='this is another receive string', receive='this is another receive string',
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_https.json')) current = Parameters(params=load_fixture('load_ltm_monitor_https.json'))
@ -384,9 +400,11 @@ class TestManager(unittest.TestCase):
name='asdf', name='asdf',
timeout=300, timeout=300,
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_https.json')) current = Parameters(params=load_fixture('load_ltm_monitor_https.json'))
@ -411,9 +429,11 @@ class TestManager(unittest.TestCase):
name='asdf', name='asdf',
time_until_up=300, time_until_up=300,
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_https.json')) current = Parameters(params=load_fixture('load_ltm_monitor_https.json'))

@ -92,9 +92,11 @@ class TestManager(unittest.TestCase):
interval=20, interval=20,
timeout=30, timeout=30,
time_until_up=60, time_until_up=60,
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(

@ -155,9 +155,11 @@ class TestManager(unittest.TestCase):
interval=20, interval=20,
timeout=30, timeout=30,
time_until_up=60, time_until_up=60,
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(

@ -166,9 +166,11 @@ class TestManager(unittest.TestCase):
timeout=30, timeout=30,
time_until_up=60, time_until_up=60,
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(
@ -198,9 +200,11 @@ class TestManager(unittest.TestCase):
timeout=30, timeout=30,
time_until_up=60, time_until_up=60,
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_tcp.json')) current = Parameters(params=load_fixture('load_ltm_monitor_tcp.json'))
@ -223,9 +227,11 @@ class TestManager(unittest.TestCase):
name='foo', name='foo',
port=800, port=800,
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_tcp.json')) current = Parameters(params=load_fixture('load_ltm_monitor_tcp.json'))
@ -250,9 +256,11 @@ class TestManager(unittest.TestCase):
name='foo', name='foo',
interval=10, interval=10,
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_tcp.json')) current = Parameters(params=load_fixture('load_ltm_monitor_tcp.json'))
@ -277,9 +285,11 @@ class TestManager(unittest.TestCase):
name='foo', name='foo',
interval=30, interval=30,
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_tcp.json')) current = Parameters(params=load_fixture('load_ltm_monitor_tcp.json'))
@ -305,9 +315,11 @@ class TestManager(unittest.TestCase):
interval=10, interval=10,
timeout=5, timeout=5,
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_tcp.json')) current = Parameters(params=load_fixture('load_ltm_monitor_tcp.json'))
@ -332,9 +344,11 @@ class TestManager(unittest.TestCase):
name='foo', name='foo',
send='this is another send string', send='this is another send string',
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_tcp.json')) current = Parameters(params=load_fixture('load_ltm_monitor_tcp.json'))
@ -359,9 +373,11 @@ class TestManager(unittest.TestCase):
name='foo', name='foo',
receive='this is another receive string', receive='this is another receive string',
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_tcp.json')) current = Parameters(params=load_fixture('load_ltm_monitor_tcp.json'))
@ -386,9 +402,11 @@ class TestManager(unittest.TestCase):
name='foo', name='foo',
timeout=300, timeout=300,
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_tcp.json')) current = Parameters(params=load_fixture('load_ltm_monitor_tcp.json'))
@ -413,9 +431,11 @@ class TestManager(unittest.TestCase):
name='foo', name='foo',
time_until_up=300, time_until_up=300,
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_tcp.json')) current = Parameters(params=load_fixture('load_ltm_monitor_tcp.json'))

@ -142,9 +142,11 @@ class TestManagerEcho(unittest.TestCase):
interval=20, interval=20,
timeout=30, timeout=30,
time_until_up=60, time_until_up=60,
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(
@ -168,9 +170,11 @@ class TestManagerEcho(unittest.TestCase):
interval=20, interval=20,
timeout=30, timeout=30,
time_until_up=60, time_until_up=60,
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_tcp_echo.json')) current = Parameters(params=load_fixture('load_ltm_monitor_tcp_echo.json'))
@ -192,9 +196,11 @@ class TestManagerEcho(unittest.TestCase):
set_module_args(dict( set_module_args(dict(
name='foo', name='foo',
interval=10, interval=10,
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_tcp_echo.json')) current = Parameters(params=load_fixture('load_ltm_monitor_tcp_echo.json'))
@ -218,9 +224,11 @@ class TestManagerEcho(unittest.TestCase):
set_module_args(dict( set_module_args(dict(
name='foo', name='foo',
interval=30, interval=30,
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_tcp_echo.json')) current = Parameters(params=load_fixture('load_ltm_monitor_tcp_echo.json'))
@ -245,9 +253,11 @@ class TestManagerEcho(unittest.TestCase):
name='foo', name='foo',
interval=10, interval=10,
timeout=5, timeout=5,
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_tcp_echo.json')) current = Parameters(params=load_fixture('load_ltm_monitor_tcp_echo.json'))
@ -271,9 +281,11 @@ class TestManagerEcho(unittest.TestCase):
set_module_args(dict( set_module_args(dict(
name='foo', name='foo',
timeout=300, timeout=300,
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_tcp_echo.json')) current = Parameters(params=load_fixture('load_ltm_monitor_tcp_echo.json'))
@ -296,9 +308,11 @@ class TestManagerEcho(unittest.TestCase):
set_module_args(dict( set_module_args(dict(
name='foo', name='foo',
time_until_up=300, time_until_up=300,
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_tcp_echo.json')) current = Parameters(params=load_fixture('load_ltm_monitor_tcp_echo.json'))

@ -148,9 +148,11 @@ class TestManager(unittest.TestCase):
interval=20, interval=20,
timeout=30, timeout=30,
time_until_up=60, time_until_up=60,
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(
@ -175,9 +177,11 @@ class TestManager(unittest.TestCase):
interval=20, interval=20,
timeout=30, timeout=30,
time_until_up=60, time_until_up=60,
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_tcp_half_open.json')) current = Parameters(params=load_fixture('load_ltm_monitor_tcp_half_open.json'))
@ -199,9 +203,11 @@ class TestManager(unittest.TestCase):
set_module_args(dict( set_module_args(dict(
name='foo', name='foo',
interval=10, interval=10,
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_tcp_half_open.json')) current = Parameters(params=load_fixture('load_ltm_monitor_tcp_half_open.json'))
@ -225,9 +231,11 @@ class TestManager(unittest.TestCase):
set_module_args(dict( set_module_args(dict(
name='foo', name='foo',
interval=30, interval=30,
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_tcp_half_open.json')) current = Parameters(params=load_fixture('load_ltm_monitor_tcp_half_open.json'))
@ -252,9 +260,11 @@ class TestManager(unittest.TestCase):
name='foo', name='foo',
interval=10, interval=10,
timeout=5, timeout=5,
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_tcp_half_open.json')) current = Parameters(params=load_fixture('load_ltm_monitor_tcp_half_open.json'))
@ -278,9 +288,11 @@ class TestManager(unittest.TestCase):
set_module_args(dict( set_module_args(dict(
name='foo', name='foo',
timeout=300, timeout=300,
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_tcp_half_open.json')) current = Parameters(params=load_fixture('load_ltm_monitor_tcp_half_open.json'))
@ -303,9 +315,11 @@ class TestManager(unittest.TestCase):
set_module_args(dict( set_module_args(dict(
name='foo', name='foo',
time_until_up=300, time_until_up=300,
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_tcp_half_open.json')) current = Parameters(params=load_fixture('load_ltm_monitor_tcp_half_open.json'))

@ -164,9 +164,11 @@ class TestManager(unittest.TestCase):
timeout=30, timeout=30,
time_until_up=60, time_until_up=60,
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(
@ -196,9 +198,11 @@ class TestManager(unittest.TestCase):
timeout=16, timeout=16,
time_until_up=0, time_until_up=0,
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_udp.json')) current = Parameters(params=load_fixture('load_ltm_monitor_udp.json'))
@ -221,9 +225,11 @@ class TestManager(unittest.TestCase):
name='asdf', name='asdf',
port=800, port=800,
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_udp.json')) current = Parameters(params=load_fixture('load_ltm_monitor_udp.json'))
@ -248,9 +254,11 @@ class TestManager(unittest.TestCase):
name='foo', name='foo',
interval=10, interval=10,
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_udp.json')) current = Parameters(params=load_fixture('load_ltm_monitor_udp.json'))
@ -275,9 +283,11 @@ class TestManager(unittest.TestCase):
name='asdf', name='asdf',
interval=30, interval=30,
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_udp.json')) current = Parameters(params=load_fixture('load_ltm_monitor_udp.json'))
@ -303,9 +313,11 @@ class TestManager(unittest.TestCase):
interval=10, interval=10,
timeout=5, timeout=5,
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_udp.json')) current = Parameters(params=load_fixture('load_ltm_monitor_udp.json'))
@ -330,9 +342,11 @@ class TestManager(unittest.TestCase):
name='asdf', name='asdf',
send='this is another send string', send='this is another send string',
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_udp.json')) current = Parameters(params=load_fixture('load_ltm_monitor_udp.json'))
@ -357,9 +371,11 @@ class TestManager(unittest.TestCase):
name='asdf', name='asdf',
receive='this is another receive string', receive='this is another receive string',
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_udp.json')) current = Parameters(params=load_fixture('load_ltm_monitor_udp.json'))
@ -384,9 +400,11 @@ class TestManager(unittest.TestCase):
name='asdf', name='asdf',
timeout=300, timeout=300,
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_udp.json')) current = Parameters(params=load_fixture('load_ltm_monitor_udp.json'))
@ -411,9 +429,11 @@ class TestManager(unittest.TestCase):
name='asdf', name='asdf',
time_until_up=300, time_until_up=300,
partition='Common', partition='Common',
server='localhost', provider=dict(
password='password', server='localhost',
user='admin' password='password',
user='admin'
)
)) ))
current = Parameters(params=load_fixture('load_ltm_monitor_udp.json')) current = Parameters(params=load_fixture('load_ltm_monitor_udp.json'))

Loading…
Cancel
Save