1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

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

Adds variable types to docs
Refactors unit tests to remove deprecated parameters
This commit is contained in:
Wojciech Wypior 2019-03-19 07:12:17 +01:00 committed by Tim Rupp
parent 1a411e9c6b
commit 348b6e7da9
40 changed files with 776 additions and 431 deletions

View file

@ -34,16 +34,18 @@ options:
cannot be resolved. These situations disable your ability to change their cannot be resolved. These situations disable your ability to change their
C(state) to C(disabled) or C(offline). They will remain in an C(state) to C(disabled) or C(offline). They will remain in an
*Unavailable - Enabled* state. *Unavailable - Enabled* state.
default: present type: str
choices: choices:
- present - present
- absent - absent
- enabled - enabled
- disabled - disabled
- offline - offline
default: present
name: name:
description: description:
- Specifies the name of the node. - Specifies the name of the node.
type: str
required: True required: True
monitor_type: monitor_type:
description: description:
@ -55,21 +57,28 @@ options:
or it has a list of one. Where they differ is in the extra guards that or it has a list of one. Where they differ is in the extra guards that
C(single) provides; namely that it only allows a single monitor. C(single) provides; namely that it only allows a single monitor.
version_added: "1.3" version_added: "1.3"
choices: ['and_list', 'm_of_n', 'single'] type: str
choices:
- and_list
- m_of_n
- single
quorum: quorum:
description: description:
- Monitor quorum value when C(monitor_type) is C(m_of_n). - Monitor quorum value when C(monitor_type) is C(m_of_n).
type: int
version_added: 2.2 version_added: 2.2
monitors: monitors:
description: description:
- Specifies the health monitors that the system currently uses to - Specifies the health monitors that the system currently uses to
monitor this node. monitor this node.
type: list
version_added: 2.2 version_added: 2.2
address: address:
description: description:
- IP address of the node. This can be either IPv4 or IPv6. When creating a - IP address of the node. This can be either IPv4 or IPv6. When creating a
new node, one of either C(address) or C(fqdn) must be provided. This new node, one of either C(address) or C(fqdn) must be provided. This
parameter cannot be updated after it is set. parameter cannot be updated after it is set.
type: str
aliases: aliases:
- ip - ip
- host - host
@ -84,6 +93,7 @@ options:
- FQDN names must end with a letter or a number. - FQDN names must end with a letter or a number.
- When creating a new node, one of either C(address) or C(fqdn) must be - When creating a new node, one of either C(address) or C(fqdn) must be
provided. This parameter cannot be updated after it is set. provided. This parameter cannot be updated after it is set.
type: str
aliases: aliases:
- hostname - hostname
version_added: 2.5 version_added: 2.5
@ -93,6 +103,7 @@ options:
- When creating a new node, if this parameter is not specified and C(fqdn) is - When creating a new node, if this parameter is not specified and C(fqdn) is
specified, this parameter will default to C(ipv4). specified, this parameter will default to C(ipv4).
- This parameter cannot be changed after it has been set. - This parameter cannot be changed after it has been set.
type: str
choices: choices:
- ipv4 - ipv4
- ipv6 - ipv6
@ -124,6 +135,7 @@ options:
the FQDN. The default TTL interval is akin to specifying C(3600). the FQDN. The default TTL interval is akin to specifying C(3600).
- When creating a new node, if this parameter is not specified and C(fqdn) is - When creating a new node, if this parameter is not specified and C(fqdn) is
specified, this parameter will default to C(3600). specified, this parameter will default to C(3600).
type: str
version_added: 2.6 version_added: 2.6
fqdn_down_interval: fqdn_down_interval:
description: description:
@ -131,31 +143,37 @@ options:
The associated monitor continues polling as long as the DNS server is down. The associated monitor continues polling as long as the DNS server is down.
- When creating a new node, if this parameter is not specified and C(fqdn) is - When creating a new node, if this parameter is not specified and C(fqdn) is
specified, this parameter will default to C(5). specified, this parameter will default to C(5).
type: int
version_added: 2.6 version_added: 2.6
description: description:
description: description:
- Specifies descriptive text that identifies the node. - Specifies descriptive text that identifies the node.
- You can remove a description by either specifying an empty string, or by - You can remove a description by either specifying an empty string, or by
specifying the special value C(none). specifying the special value C(none).
type: str
connection_limit: connection_limit:
description: description:
- Node connection limit. Setting this to 0 disables the limit. - Node connection limit. Setting this to 0 disables the limit.
type: int
version_added: 2.7 version_added: 2.7
rate_limit: rate_limit:
description: description:
- Node rate limit (connections-per-second). Setting this to 0 disables the limit. - Node rate limit (connections-per-second). Setting this to 0 disables the limit.
type: int
version_added: 2.7 version_added: 2.7
ratio: ratio:
description: description:
- Node ratio weight. Valid values range from 1 through 100. - Node ratio weight. Valid values range from 1 through 100.
- When creating a new node, if this parameter is not specified, the default of - When creating a new node, if this parameter is not specified, the default of
C(1) will be used. C(1) will be used.
type: int
version_added: 2.7 version_added: 2.7
dynamic_ratio: dynamic_ratio:
description: description:
- The dynamic ratio number for the node. Used for dynamic ratio load balancing. - The dynamic ratio number for the node. Used for dynamic ratio load balancing.
- When creating a new node, if this parameter is not specified, the default of - When creating a new node, if this parameter is not specified, the default of
C(1) will be used. C(1) will be used.
type: int
version_added: 2.7 version_added: 2.7
availability_requirements: availability_requirements:
description: description:
@ -168,17 +186,22 @@ options:
- Monitor rule type when C(monitors) is specified. - Monitor rule type when C(monitors) is specified.
- When creating a new pool, if this value is not specified, the default of - When creating a new pool, if this value is not specified, the default of
'all' will be used. 'all' will be used.
choices: ['all', 'at_least'] choices:
- all
- at_least
at_least: at_least:
description: description:
- Specifies the minimum number of active health monitors that must be successful - Specifies the minimum number of active health monitors that must be successful
before the link is considered up. before the link is considered up.
- This parameter is only relevant when a C(type) of C(at_least) is used. - This parameter is only relevant when a C(type) of C(at_least) is used.
- This parameter will be ignored if a type of C(all) is used. - This parameter will be ignored if a type of C(all) is used.
type: int
type: dict
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
version_added: 2.5 version_added: 2.5
extends_documentation_fragment: f5 extends_documentation_fragment: f5
@ -765,11 +788,10 @@ 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()
self.client = F5RestClient(**self.module.params)
def _set_changed_options(self): def _set_changed_options(self):
changed = {} changed = {}
@ -1157,6 +1179,7 @@ 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
) )
try: try:

View file

@ -23,22 +23,26 @@ options:
name: name:
description: description:
- Name of the partition - Name of the partition
type: str
required: True required: True
description: description:
description: description:
- The description to attach to the Partition. - The description to attach to the Partition.
type: str
route_domain: route_domain:
description: description:
- The default Route Domain to assign to the Partition. If no route domain - The default Route Domain to assign to the Partition. If no route domain
is specified, then the default route domain for the system (typically is specified, then the default route domain for the system (typically
zero) will be used only when creating a new partition. zero) will be used only when creating a new partition.
type: int
state: state:
description: description:
- Whether the partition should exist or not. - Whether the partition should exist or not.
default: present type: str
choices: choices:
- present - present
- absent - absent
default: present
notes: notes:
- Requires BIG-IP software version >= 12 - Requires BIG-IP software version >= 12
extends_documentation_fragment: f5 extends_documentation_fragment: f5
@ -118,18 +122,12 @@ try:
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 f5_argument_spec from library.module_utils.network.f5.common import f5_argument_spec
from library.module_utils.network.f5.common import cleanup_tokens
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 f5_argument_spec from ansible.module_utils.network.f5.common import f5_argument_spec
from ansible.module_utils.network.f5.common import cleanup_tokens
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
@ -238,7 +236,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()
@ -486,16 +484,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__':

View file

@ -25,21 +25,26 @@ options:
- Specifies the number of days before a password expires. - Specifies the number of days before a password expires.
- Based on this value, the BIG-IP system automatically warns users when their - Based on this value, the BIG-IP system automatically warns users when their
password is about to expire. password is about to expire.
type: int
max_duration: max_duration:
description: description:
- Specifies the maximum number of days a password is valid. - Specifies the maximum number of days a password is valid.
type: int
max_login_failures: max_login_failures:
description: description:
- Specifies the number of consecutive unsuccessful login attempts - Specifies the number of consecutive unsuccessful login attempts
that the system allows before locking out the user. that the system allows before locking out the user.
- Specify zero (0) to disable this parameter. - Specify zero (0) to disable this parameter.
type: int
min_duration: min_duration:
description: description:
- Specifies the minimum number of days a password is valid. - Specifies the minimum number of days a password is valid.
type: int
min_length: min_length:
description: description:
- Specifies the minimum number of characters in a valid password. - Specifies the minimum number of characters in a valid password.
- This value must be between 6 and 255. - This value must be between 6 and 255.
type: int
policy_enforcement: policy_enforcement:
description: description:
- Enables or disables the password policy on the BIG-IP system. - Enables or disables the password policy on the BIG-IP system.
@ -48,23 +53,28 @@ options:
description: description:
- Specifies the number of lowercase alpha characters that must be - Specifies the number of lowercase alpha characters that must be
present in a password for the password to be valid. present in a password for the password to be valid.
type: int
required_numeric: required_numeric:
description: description:
- Specifies the number of numeric characters that must be present in - Specifies the number of numeric characters that must be present in
a password for the password to be valid. a password for the password to be valid.
type: int
required_special: required_special:
description: description:
- Specifies the number of special characters that must be present in - Specifies the number of special characters that must be present in
a password for the password to be valid. a password for the password to be valid.
type: int
required_uppercase: required_uppercase:
description: description:
- Specifies the number of uppercase alpha characters that must be - Specifies the number of uppercase alpha characters that must be
present in a password for the password to be valid. present in a password for the password to be valid.
type: int
password_memory: password_memory:
description: description:
- Specifies whether the user has configured the BIG-IP system to - Specifies whether the user has configured the BIG-IP system to
remember a password on a specific computer and how many passwords remember a password on a specific computer and how many passwords
to remember. to remember.
type: int
extends_documentation_fragment: f5 extends_documentation_fragment: f5
author: author:
- Tim Rupp (@caphrim007) - Tim Rupp (@caphrim007)
@ -145,23 +155,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 transform_name from library.module_utils.network.f5.common import transform_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 flatten_boolean from library.module_utils.network.f5.common import flatten_boolean
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 transform_name from ansible.module_utils.network.f5.common import transform_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 flatten_boolean from ansible.module_utils.network.f5.common import flatten_boolean
@ -288,7 +292,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()
@ -423,16 +427,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__':

View file

@ -30,9 +30,11 @@ options:
- The description to attach to the policy. - The description to attach to the policy.
- This parameter is only supported on versions of BIG-IP >= 12.1.0. On earlier - This parameter is only supported on versions of BIG-IP >= 12.1.0. On earlier
versions it will simply be ignored. versions it will simply be ignored.
type: str
name: name:
description: description:
- The name of the policy to create. - The name of the policy to create.
type: str
required: True required: True
state: state:
description: description:
@ -43,6 +45,7 @@ options:
When modifying rules, it is required that policies first be in a draft. When modifying rules, it is required that policies first be in a draft.
- Drafting is only supported on versions of BIG-IP >= 12.1.0. On versions - Drafting is only supported on versions of BIG-IP >= 12.1.0. On versions
prior to that, specifying a C(state) of C(draft) will raise an error. prior to that, specifying a C(state) of C(draft) will raise an error.
type: str
choices: choices:
- present - present
- absent - absent
@ -55,6 +58,7 @@ options:
policies, the default is C(first). policies, the default is C(first).
- This module does not allow you to specify the C(best) strategy to use. - This module does not allow you to specify the C(best) strategy to use.
It will choose the system default (C(/Common/best-match)) for you instead. It will choose the system default (C(/Common/best-match)) for you instead.
type: str
choices: choices:
- first - first
- all - all
@ -69,9 +73,11 @@ options:
- The C(actions) for a default rule are C(ignore). - The C(actions) for a default rule are C(ignore).
- The C(bigip_policy_rule) module can be used to create and edit existing - The C(bigip_policy_rule) module can be used to create and edit existing
and new rules. and new rules.
type: list
partition: partition:
description: description:
- Device partition to manage resources on. - Device partition to manage resources on.
type: str
default: Common default: Common
extends_documentation_fragment: f5 extends_documentation_fragment: f5
author: author:
@ -197,23 +203,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.icontrol import tmos_version from library.module_utils.network.f5.icontrol import tmos_version
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.icontrol import tmos_version from ansible.module_utils.network.f5.icontrol import tmos_version
@ -343,7 +343,7 @@ class ComplexChanges(ComplexParameters):
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 = Parameters(params=self.module.params) self.want = Parameters(params=self.module.params)
@ -1058,7 +1058,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.kwargs = kwargs self.kwargs = kwargs
def exec_module(self): def exec_module(self):
@ -1116,16 +1116,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__':

View file

@ -23,6 +23,7 @@ options:
description: description:
description: description:
- Description of the policy rule. - Description of the policy rule.
type: str
actions: actions:
description: description:
- The actions that you want the policy rule to perform. - The actions that you want the policy rule to perform.
@ -41,31 +42,43 @@ options:
- When C(type) is C(ignore), will remove all existing actions from this - When C(type) is C(ignore), will remove all existing actions from this
rule. rule.
- When C(type) is C(redirect), will redirect an HTTP request to a different URL. - When C(type) is C(redirect), will redirect an HTTP request to a different URL.
type: str
required: true required: true
choices: ['forward', 'enable', 'ignore', 'redirect'] choices:
- forward
- enable
- ignore
- redirect
pool: pool:
description: description:
- Pool that you want to forward traffic to. - Pool that you want to forward traffic to.
- This parameter is only valid with the C(forward) type. - This parameter is only valid with the C(forward) type.
type: str
virtual: virtual:
description: description:
- Virtual Server that you want to forward traffic to. - Virtual Server that you want to forward traffic to.
- This parameter is only valid with the C(forward) type. - This parameter is only valid with the C(forward) type.
type: str
asm_policy: asm_policy:
description: description:
- ASM policy to enable. - ASM policy to enable.
- This parameter is only valid with the C(enable) type. - This parameter is only valid with the C(enable) type.
type: str
location: location:
description: description:
- The new URL for which a redirect response will be sent. - The new URL for which a redirect response will be sent.
- A Tcl command substitution can be used for this field. - A Tcl command substitution can be used for this field.
type: str
type: list
policy: policy:
description: description:
- The name of the policy that you want to associate this rule with. - The name of the policy that you want to associate this rule with.
type: str
required: True required: True
name: name:
description: description:
- The name of the rule. - The name of the rule.
type: str
required: True required: True
conditions: conditions:
description: description:
@ -86,32 +99,42 @@ options:
list will provide a match. list will provide a match.
- When C(type) is C(all_traffic), will remove all existing conditions from - When C(type) is C(all_traffic), will remove all existing conditions from
this rule. this rule.
type: str
required: True required: True
choices: [ 'http_uri', 'all_traffic', 'http_host' ] choices:
- http_uri
- all_traffic
- http_host
path_begins_with_any: path_begins_with_any:
description: description:
- A list of strings of characters that the HTTP URI should start with. - A list of strings of characters that the HTTP URI should start with.
- This parameter is only valid with the C(http_uri) type. - This parameter is only valid with the C(http_uri) type.
type: str
host_is_any: host_is_any:
description: description:
- A list of strings of characters that the HTTP Host should match. - A list of strings of characters that the HTTP Host should match.
- This parameter is only valid with the C(http_host) type. - This parameter is only valid with the C(http_host) type.
type: str
host_begins_with_any: host_begins_with_any:
description: description:
- A list of strings of characters that the HTTP Host should start with. - A list of strings of characters that the HTTP Host should start with.
- This parameter is only valid with the C(http_host) type. - This parameter is only valid with the C(http_host) type.
type: str
type: list
state: state:
description: description:
- When C(present), ensures that the key is uploaded to the device. When - When C(present), ensures that the key is uploaded to the device. When
C(absent), ensures that the key is removed from the device. If the key C(absent), ensures that the key is removed from the device. If the key
is currently in use, the module will not be able to remove the key. is currently in use, the module will not be able to remove the key.
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
extends_documentation_fragment: f5 extends_documentation_fragment: f5
requirements: requirements:
@ -238,22 +261,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 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 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
class Parameters(AnsibleF5Parameters): class Parameters(AnsibleF5Parameters):
@ -694,7 +711,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()
@ -1039,16 +1056,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__':

View file

@ -23,10 +23,12 @@ options:
description: description:
description: description:
- Specifies descriptive text that identifies the pool. - Specifies descriptive text that identifies the pool.
type: str
version_added: 2.3 version_added: 2.3
name: name:
description: description:
- Pool name - Pool name
type: str
required: True required: True
aliases: aliases:
- pool - pool
@ -34,6 +36,7 @@ options:
description: description:
- Load balancing method. When creating a new pool, if this value is not - Load balancing method. When creating a new pool, if this value is not
specified, the default of C(round-robin) will be used. specified, the default of C(round-robin) will be used.
type: str
version_added: 1.3 version_added: 1.3
choices: choices:
- dynamic-ratio-member - dynamic-ratio-member
@ -69,40 +72,50 @@ options:
or already existing on the device. or already existing on the device.
- Both C(single) and C(and_list) are functionally identical since BIG-IP - Both C(single) and C(and_list) are functionally identical since BIG-IP
considers all monitors as "a list". considers all monitors as "a list".
type: str
choices:
- and_list
- m_of_n
- single
version_added: 1.3 version_added: 1.3
choices: ['and_list', 'm_of_n', 'single']
quorum: quorum:
description: description:
- Monitor quorum value when C(monitor_type) is C(m_of_n). - Monitor quorum value when C(monitor_type) is C(m_of_n).
- Quorum must be a value of 1 or greater when C(monitor_type) is C(m_of_n). - Quorum must be a value of 1 or greater when C(monitor_type) is C(m_of_n).
type: int
version_added: 1.3 version_added: 1.3
monitors: monitors:
description: description:
- Monitor template name list. If the partition is not provided as part of - Monitor template name list. If the partition is not provided as part of
the monitor name, then the C(partition) option will be used instead. the monitor name, then the C(partition) option will be used instead.
type: list
version_added: 1.3 version_added: 1.3
slow_ramp_time: slow_ramp_time:
description: description:
- Sets the ramp-up time (in seconds) to gradually ramp up the load on - Sets the ramp-up time (in seconds) to gradually ramp up the load on
newly added or freshly detected up pool members. newly added or freshly detected up pool members.
type: int
version_added: 1.3 version_added: 1.3
reselect_tries: reselect_tries:
description: description:
- Sets the number of times the system tries to contact a pool member - Sets the number of times the system tries to contact a pool member
after a passive failure. after a passive failure.
type: int
version_added: 2.2 version_added: 2.2
service_down_action: service_down_action:
description: description:
- Sets the action to take when node goes down in pool. - Sets the action to take when node goes down in pool.
version_added: 1.3 type: str
choices: choices:
- none - none
- reset - reset
- drop - drop
- reselect - reselect
version_added: 1.3
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:
@ -110,10 +123,11 @@ options:
- When C(present), guarantees that the pool exists with the provided - When C(present), guarantees that the pool exists with the provided
attributes. attributes.
- When C(absent), removes the pool from the system. - When C(absent), removes the pool from the system.
default: present type: str
choices: choices:
- absent - absent
- present - present
default: present
version_added: 2.5 version_added: 2.5
metadata: metadata:
description: description:
@ -123,6 +137,7 @@ options:
- Values for all of the keys will be stored as strings; this includes values - Values for all of the keys will be stored as strings; this includes values
that are numbers. that are numbers.
- Data will be persisted, not ephemeral. - Data will be persisted, not ephemeral.
type: raw
version_added: 2.5 version_added: 2.5
priority_group_activation: priority_group_activation:
description: description:
@ -140,12 +155,14 @@ options:
priority group. priority group.
- When a sufficient number of members become available in the higher priority - When a sufficient number of members become available in the higher priority
group, the system again directs traffic to the higher priority group. group, the system again directs traffic to the higher priority group.
type: int
aliases: aliases:
- minimum_active_members - minimum_active_members
version_added: 2.6 version_added: 2.6
aggregate: aggregate:
description: description:
- List of pool definitions to be created, modified or removed. - List of pool definitions to be created, modified or removed.
type: list
aliases: aliases:
- pools - pools
version_added: 2.8 version_added: 2.8
@ -154,8 +171,8 @@ options:
- Remove pools not defined in the C(aggregate) parameter. - Remove pools not defined in the C(aggregate) parameter.
- This operation is all or none, meaning that it will stop if there are some pools - This operation is all or none, meaning that it will stop if there are some pools
that cannot be removed. that cannot be removed.
default: no
type: bool type: bool
default: no
aliases: aliases:
- purge - purge
version_added: 2.8 version_added: 2.8
@ -395,24 +412,18 @@ 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.icontrol import TransactionContextManager from library.module_utils.network.f5.icontrol import TransactionContextManager
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
from ansible.module_utils.network.f5.icontrol import TransactionContextManager from ansible.module_utils.network.f5.icontrol import TransactionContextManager
@ -799,7 +810,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 = None self.want = None
self.have = None self.have = None
self.changes = None self.changes = None
@ -1248,16 +1259,12 @@ def main():
required_one_of=spec.required_one_of required_one_of=spec.required_one_of
) )
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__':

View file

@ -27,31 +27,36 @@ options:
- This parameter is optional and, if not specified, a node name will be - This parameter is optional and, if not specified, a node name will be
created automatically from either the specified C(address) or C(fqdn). created automatically from either the specified C(address) or C(fqdn).
- The C(enabled) state is an alias of C(present). - The C(enabled) state is an alias of C(present).
type: str
version_added: 2.6 version_added: 2.6
state: state:
description: description:
- Pool member state. - Pool member state.
type: str
required: True required: True
default: present
choices: choices:
- present - present
- absent - absent
- enabled - enabled
- disabled - disabled
- forced_offline - forced_offline
default: present
pool: pool:
description: description:
- Pool name. This pool must exist. - Pool name. This pool must exist.
type: str
required: True required: True
partition: partition:
description: description:
- Partition - Partition to manage resources on.
type: str
default: Common default: Common
address: address:
description: description:
- IP address of the pool member. This can be either IPv4 or IPv6. When creating a - IP address of the pool member. This can be either IPv4 or IPv6. When creating a
new pool member, one of either C(address) or C(fqdn) must be provided. This new pool member, one of either C(address) or C(fqdn) must be provided. This
parameter cannot be updated after it is set. parameter cannot be updated after it is set.
type: str
aliases: aliases:
- ip - ip
- host - host
@ -66,6 +71,7 @@ options:
- FQDN names must end with a letter or a number. - FQDN names must end with a letter or a number.
- When creating a new pool member, one of either C(address) or C(fqdn) must be - When creating a new pool member, one of either C(address) or C(fqdn) must be
provided. This parameter cannot be updated after it is set. provided. This parameter cannot be updated after it is set.
type: str
aliases: aliases:
- hostname - hostname
version_added: 2.6 version_added: 2.6
@ -73,22 +79,27 @@ options:
description: description:
- Pool member port. - Pool member port.
- This value cannot be changed after it has been set. - This value cannot be changed after it has been set.
type: int
required: True required: True
connection_limit: connection_limit:
description: description:
- Pool member connection limit. Setting this to 0 disables the limit. - Pool member connection limit. Setting this to 0 disables the limit.
type: int
description: description:
description: description:
- Pool member description. - Pool member description.
type: str
rate_limit: rate_limit:
description: description:
- Pool member rate limit (connections-per-second). Setting this to 0 - Pool member rate limit (connections-per-second). Setting this to 0
disables the limit. disables the limit.
type: int
ratio: ratio:
description: description:
- Pool member ratio weight. Valid values range from 1 through 100. - Pool member ratio weight. Valid values range from 1 through 100.
New pool members -- unless overridden with this value -- default New pool members -- unless overridden with this value -- default
to 1. to 1.
type: int
preserve_node: preserve_node:
description: description:
- When state is C(absent) attempts to remove the node that the pool - When state is C(absent) attempts to remove the node that the pool
@ -108,6 +119,7 @@ options:
assigned to the pool member. assigned to the pool member.
- The higher the number, the higher the priority, so a member with a priority - The higher the number, the higher the priority, so a member with a priority
of 3 has higher priority than a member with a priority of 1. of 3 has higher priority than a member with a priority of 1.
type: int
version_added: 2.5 version_added: 2.5
fqdn_auto_populate: fqdn_auto_populate:
description: description:
@ -128,13 +140,14 @@ options:
reuse_nodes: reuse_nodes:
description: description:
- Reuses node definitions if requested. - Reuses node definitions if requested.
default: yes
type: bool type: bool
default: yes
version_added: 2.6 version_added: 2.6
monitors: monitors:
description: description:
- Specifies the health monitors that the system currently uses to monitor - Specifies the health monitors that the system currently uses to monitor
this resource. this resource.
type: list
version_added: 2.8 version_added: 2.8
availability_requirements: availability_requirements:
description: description:
@ -147,13 +160,18 @@ options:
- Monitor rule type when C(monitors) is specified. - Monitor rule type when C(monitors) is specified.
- When creating a new pool, if this value is not specified, the default of - When creating a new pool, if this value is not specified, the default of
'all' will be used. 'all' will be used.
choices: ['all', 'at_least'] type: str
choices:
- all
- at_least
at_least: at_least:
description: description:
- Specifies the minimum number of active health monitors that must be successful - Specifies the minimum number of active health monitors that must be successful
before the link is considered up. before the link is considered up.
- This parameter is only relevant when a C(type) of C(at_least) is used. - This parameter is only relevant when a C(type) of C(at_least) is used.
- This parameter will be ignored if a type of C(all) is used. - This parameter will be ignored if a type of C(all) is used.
type: int
type: dict
version_added: 2.8 version_added: 2.8
ip_encapsulation: ip_encapsulation:
description: description:
@ -163,10 +181,12 @@ options:
- When C(none), disables IP encapsulation. - When C(none), disables IP encapsulation.
- When C(inherit), inherits IP encapsulation setting from the member's pool. - When C(inherit), inherits IP encapsulation setting from the member's pool.
- When any other value, Options are None, Inherit from Pool, and Member Specific. - When any other value, Options are None, Inherit from Pool, and Member Specific.
type: str
version_added: 2.8 version_added: 2.8
aggregate: aggregate:
description: description:
- List of pool member definitions to be created, modified or removed. - List of pool member definitions to be created, modified or removed.
type: list
aliases: aliases:
- members - members
version_added: 2.8 version_added: 2.8
@ -175,8 +195,8 @@ options:
- Remove members not defined in the C(aggregate) parameter. - Remove members not defined in the C(aggregate) parameter.
- This operation is all or none, meaning that it will stop if there are some pool members - This operation is all or none, meaning that it will stop if there are some pool members
that cannot be removed. that cannot be removed.
default: no
type: bool type: bool
default: no
aliases: aliases:
- purge - purge
version_added: 2.8 version_added: 2.8
@ -257,16 +277,16 @@ EXAMPLES = '''
password: secret password: secret
delegate_to: localhost delegate_to: localhost
loop: loop:
- host: 1.1.1.1 - address: 1.1.1.1
name: web1 name: web1
priority_group: 4 priority_group: 4
- host: 2.2.2.2 - address: 2.2.2.2
name: web2 name: web2
priority_group: 3 priority_group: 3
- host: 3.3.3.3 - address: 3.3.3.3
name: web3 name: web3
priority_group: 2 priority_group: 2
- host: 4.4.4.4 - address: 4.4.4.4
name: web4 name: web4
priority_group: 1 priority_group: 1
@ -403,10 +423,7 @@ try:
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 fq_name from library.module_utils.network.f5.common import fq_name
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 exit_json
from library.module_utils.network.f5.common import fail_json
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 is_valid_hostname from library.module_utils.network.f5.common import is_valid_hostname
from library.module_utils.network.f5.common import flatten_boolean from library.module_utils.network.f5.common import flatten_boolean
@ -419,13 +436,9 @@ except ImportError:
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 fq_name from ansible.module_utils.network.f5.common import fq_name
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 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.common import is_valid_hostname from ansible.module_utils.network.f5.common import is_valid_hostname
from ansible.module_utils.network.f5.common import f5_argument_spec
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
from ansible.module_utils.network.f5.ipaddress import is_valid_ip from ansible.module_utils.network.f5.ipaddress import is_valid_ip
@ -990,7 +1003,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 = None self.want = None
self.have = None self.have = None
self.changes = None self.changes = None
@ -1618,16 +1631,12 @@ def main():
required_one_of=spec.required_one_of, required_one_of=spec.required_one_of,
) )
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__':

View file

@ -23,15 +23,18 @@ options:
name: name:
description: description:
- Specifies the name of the profile. - Specifies the name of the profile.
type: str
required: True required: True
parent: parent:
description: description:
- Specifies the profile from which this profile inherits settings. - Specifies the profile from which this profile inherits settings.
- When creating a new profile, if this parameter is not specified, the default - When creating a new profile, if this parameter is not specified, the default
is the system-supplied C(analytics) profile. is the system-supplied C(analytics) profile.
type: str
description: description:
description: description:
- Description of the profile. - Description of the profile.
type: str
collect_geo: collect_geo:
description: description:
- Enables or disables the collection of the names of the countries - Enables or disables the collection of the names of the countries
@ -77,6 +80,7 @@ options:
description: description:
- Specifies the external logging publisher used to send statistical - Specifies the external logging publisher used to send statistical
data to one or more destinations. data to one or more destinations.
type: str
notification_by_syslog: notification_by_syslog:
description: description:
- Enables or disables logging of the analytics alerts into the - Enables or disables logging of the analytics alerts into the
@ -90,18 +94,21 @@ options:
description: description:
- Specifies which email addresses receive alerts by email when - Specifies which email addresses receive alerts by email when
C(notification_by_email) is enabled. C(notification_by_email) is enabled.
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 profile exists. - When C(present), ensures that the profile exists.
- When C(absent), ensures the profile is removed. - When C(absent), ensures the profile 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)
@ -138,24 +145,18 @@ 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 transform_name from library.module_utils.network.f5.common import transform_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 flatten_boolean from library.module_utils.network.f5.common import flatten_boolean
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 fq_name from ansible.module_utils.network.f5.common import fq_name
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 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 flatten_boolean from ansible.module_utils.network.f5.common import flatten_boolean
from ansible.module_utils.network.f5.compare import cmp_simple_list from ansible.module_utils.network.f5.compare import cmp_simple_list
@ -523,7 +524,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()
@ -748,16 +749,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__':

View file

@ -23,17 +23,20 @@ options:
name: name:
description: description:
- Specifies the name of the profile. - Specifies the name of the profile.
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(clientssl) been set, it cannot be changed. By default, this value is the C(clientssl)
parent on the C(Common) partition. parent on the C(Common) partition.
type: str
default: /Common/clientssl default: /Common/clientssl
ciphers: ciphers:
description: description:
- Specifies the list of ciphers that the system supports. When creating a new - Specifies the list of ciphers that the system supports. When creating a new
profile, the default cipher list is provided by the parent profile. profile, the default cipher list is provided by the parent profile.
type: str
cert_key_chain: cert_key_chain:
description: description:
- One or more certificates and keys to associate with the SSL profile. This - One or more certificates and keys to associate with the SSL profile. This
@ -47,25 +50,31 @@ options:
cert: cert:
description: description:
- Specifies a cert name for use. - Specifies a cert name for use.
type: str
required: True required: True
key: key:
description: description:
- Contains a key name. - Contains a key name.
type: str
required: True required: True
chain: chain:
description: description:
- Contains a certificate chain that is relevant to the certificate and key - Contains a certificate chain that is relevant to the certificate and key
mentioned earlier. mentioned earlier.
- This key is optional. - This key is optional.
type: str
passphrase: passphrase:
description: description:
- Contains the passphrase of the key file, should it require one. - Contains the passphrase of the key file, should it require one.
- Passphrases are encrypted on the remote BIG-IP device. Therefore, there is no way - Passphrases are encrypted on the remote BIG-IP device. Therefore, there is no way
to compare them when updating a client SSL profile. Due to this, if you specify a to compare them when updating a client SSL profile. Due to this, if you specify a
passphrase, this module will always register a C(changed) event. passphrase, this module will always register a C(changed) event.
type: str
type: list
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
options: options:
@ -73,6 +82,7 @@ options:
- Options that the system uses for SSL processing in the form of a list. When - Options that the system uses for SSL processing in the form of a list. When
creating a new profile, the list is provided by the parent profile. creating a new profile, the list is provided by the parent profile.
- When a C('') or C(none) value is provided all options for SSL processing are disabled. - When a C('') or C(none) value is provided all options for SSL processing are disabled.
type: list
choices: choices:
- netscape-reuse-cipher-change-bug - netscape-reuse-cipher-change-bug
- microsoft-big-sslv3-buffer - microsoft-big-sslv3-buffer
@ -111,6 +121,7 @@ options:
- The C(require-strict) setting the system requires strict renegotiation of SSL - The C(require-strict) setting the system requires strict renegotiation of SSL
connections. In this mode the system refuses connections to insecure servers, connections. In this mode the system refuses connections to insecure servers,
and terminates existing SSL connections to insecure servers. and terminates existing SSL connections to insecure servers.
type: str
choices: choices:
- require - require
- require-strict - require-strict
@ -138,8 +149,15 @@ options:
version_added: 2.8 version_added: 2.8
sni_require: sni_require:
description: description:
- Requires that the network peers also provide SNI support. This setting only takes effect when C(sni_default) is - Requires that the network peers also provide SNI support, this setting only takes effect when C(sni_default) is
set to C(true). When creating a new profile, the setting is provided by the parent profile. set to C(true).
- When creating a new profile, the setting is provided by the parent profile.
type: bool
version_added: 2.8
strict_resume:
description:
- Enables or disables the resumption of SSL sessions after an unclean shutdown.
- When creating a new profile, the setting is provided by the parent profile.
type: bool type: bool
version_added: 2.8 version_added: 2.8
client_certificate: client_certificate:
@ -151,6 +169,7 @@ options:
valid certificate. valid certificate.
- When C(request), specifies that the system requests a valid certificate from a - When C(request), specifies that the system requests a valid certificate from a
client but always authenticate the client. client but always authenticate the client.
type: str
choices: choices:
- ignore - ignore
- require - require
@ -163,10 +182,17 @@ options:
SSL session. SSL session.
- When C(always), specifies that the system authenticates the client once for an - When C(always), specifies that the system authenticates the client once for an
SSL session and also upon reuse of that session. SSL session and also upon reuse of that session.
type: str
choices: choices:
- once - once
- always - always
version_added: 2.8 version_added: 2.8
renegotiation:
description:
- Enables or disables SSL renegotiation.
- When creating a new profile, the setting is provided by the parent profile.
type: bool
version_added: 2.8
retain_certificate: retain_certificate:
description: description:
- When C(yes), client certificate is retained in SSL session. - When C(yes), client certificate is retained in SSL session.
@ -176,19 +202,23 @@ options:
description: description:
- Specifies the maximum number of certificates to be traversed in a client - Specifies the maximum number of certificates to be traversed in a client
certificate chain. certificate chain.
type: int
version_added: 2.8 version_added: 2.8
trusted_cert_authority: trusted_cert_authority:
description: description:
- Specifies a client CA that the system trusts. - Specifies a client CA that the system trusts.
type: str
version_added: 2.8 version_added: 2.8
advertised_cert_authority: advertised_cert_authority:
description: description:
- Specifies that the CAs that the system advertises to clients is being trusted - Specifies that the CAs that the system advertises to clients is being trusted
by the profile. by the profile.
type: str
version_added: 2.8 version_added: 2.8
client_auth_crl: client_auth_crl:
description: description:
- Specifies the name of a file containing a list of revoked client certificates. - Specifies the name of a file containing a list of revoked client certificates.
type: str
version_added: 2.8 version_added: 2.8
allow_expired_crl: allow_expired_crl:
description: description:
@ -199,10 +229,11 @@ options:
description: description:
- When C(present), ensures that the profile exists. - When C(present), ensures that the profile exists.
- When C(absent), ensures the profile is removed. - When C(absent), ensures the profile 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
@ -251,7 +282,7 @@ EXAMPLES = r'''
bigip_profile_client_ssl: bigip_profile_client_ssl:
state: present state: present
name: my_profile name: my_profile
secure_renegotation: request secure_renegotiation: request
provider: provider:
server: lb.mydomain.com server: lb.mydomain.com
user: admin user: admin
@ -284,7 +315,7 @@ options:
returned: changed returned: changed
type: list type: list
sample: ['no-sslv2', 'no-sslv3'] sample: ['no-sslv2', 'no-sslv3']
secure_renegotation: secure_renegotiation:
description: The method of secure SSL renegotiation. description: The method of secure SSL renegotiation.
returned: changed returned: changed
type: str type: str
@ -294,6 +325,16 @@ allow_non_ssl:
returned: changed returned: changed
type: bool type: bool
sample: yes sample: yes
strict_resume:
description: Resumption of SSL sessions after an unclean shutdown.
returned: changed
type: bool
sample: yes
renegotiation:
description: Renegotiation of SSL sessions.
returned: changed
type: bool
sample: yes
''' '''
import os import os
@ -306,25 +347,19 @@ 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 flatten_boolean from library.module_utils.network.f5.common import flatten_boolean
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 is_empty_list from library.module_utils.network.f5.common import is_empty_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 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 flatten_boolean from ansible.module_utils.network.f5.common import flatten_boolean
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 is_empty_list from ansible.module_utils.network.f5.common import is_empty_list
@ -346,6 +381,8 @@ class Parameters(AnsibleF5Parameters):
'clientCertCa': 'advertised_cert_authority', 'clientCertCa': 'advertised_cert_authority',
'crlFile': 'client_auth_crl', 'crlFile': 'client_auth_crl',
'allowExpiredCrl': 'allow_expired_crl', 'allowExpiredCrl': 'allow_expired_crl',
'strictResume': 'strict_resume',
'renegotiation': 'renegotiation',
} }
api_attributes = [ api_attributes = [
@ -366,6 +403,8 @@ class Parameters(AnsibleF5Parameters):
'clientCertCa', 'clientCertCa',
'crlFile', 'crlFile',
'allowExpiredCrl', 'allowExpiredCrl',
'strictResume',
'renegotiation',
] ]
returnables = [ returnables = [
@ -386,6 +425,8 @@ class Parameters(AnsibleF5Parameters):
'advertised_cert_authority', 'advertised_cert_authority',
'client_auth_crl', 'client_auth_crl',
'allow_expired_crl', 'allow_expired_crl',
'strict_resume',
'renegotiation',
] ]
updatables = [ updatables = [
@ -405,6 +446,8 @@ class Parameters(AnsibleF5Parameters):
'advertised_cert_authority', 'advertised_cert_authority',
'client_auth_crl', 'client_auth_crl',
'allow_expired_crl', 'allow_expired_crl',
'strict_resume',
'renegotiation',
] ]
@property @property
@ -485,6 +528,24 @@ class ModuleParameters(Parameters):
return 'enabled' return 'enabled'
return 'disabled' return 'disabled'
@property
def strict_resume(self):
result = flatten_boolean(self._values['strict_resume'])
if result is None:
return None
if result == 'yes':
return 'enabled'
return 'disabled'
@property
def renegotiation(self):
result = flatten_boolean(self._values['renegotiation'])
if result is None:
return None
if result == 'yes':
return 'enabled'
return 'disabled'
@property @property
def options(self): def options(self):
options = self._values['options'] options = self._values['options']
@ -634,6 +695,14 @@ class ReportableChanges(Changes):
return 'yes' return 'yes'
return 'no' return 'no'
@property
def strict_resume(self):
if self._values['strict_resume'] is None:
return None
elif self._values['strict_resume'] == 'enabled':
return 'yes'
return 'no'
@property @property
def retain_certificate(self): def retain_certificate(self):
return flatten_boolean(self._values['retain_certificate']) return flatten_boolean(self._values['retain_certificate'])
@ -757,7 +826,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()
@ -1008,6 +1077,8 @@ class ArgumentSpec(object):
advertised_cert_authority=dict(), advertised_cert_authority=dict(),
client_auth_crl=dict(), client_auth_crl=dict(),
allow_expired_crl=dict(type='bool'), allow_expired_crl=dict(type='bool'),
strict_resume=dict(type='bool'),
renegotiation=dict(type='bool'),
partition=dict( partition=dict(
default='Common', default='Common',
fallback=(env_fallback, ['F5_PARTITION']) fallback=(env_fallback, ['F5_PARTITION'])
@ -1026,16 +1097,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__':

View file

@ -26,12 +26,14 @@ options:
name: name:
description: description:
- Specifies the name of the DNS profile. - Specifies the name of the DNS profile.
type: str
required: True required: True
parent: parent:
description: description:
- Specifies the profile from which this profile inherits settings. - Specifies the profile from which this profile inherits settings.
- When creating a new profile, if this parameter is not specified, the default - When creating a new profile, if this parameter is not specified, the default
is the system-supplied C(dns) profile. is the system-supplied C(dns) profile.
type: str
enable_dns_express: enable_dns_express:
description: description:
- Specifies whether the DNS Express engine is enabled. - Specifies whether the DNS Express engine is enabled.
@ -112,6 +114,7 @@ options:
- Specifies the user-created cache that the system uses to cache DNS responses. - Specifies the user-created cache that the system uses to cache DNS responses.
- When you select a cache for the system to use, you must also set C(enable_dns_cache) - When you select a cache for the system to use, you must also set C(enable_dns_cache)
to C(yes) to C(yes)
type: str
version_added: 2.7 version_added: 2.7
unhandled_query_action: unhandled_query_action:
description: description:
@ -125,6 +128,7 @@ options:
- When C(no-error), the BIG-IP system returns the query with the NOERROR return code. - When C(no-error), the BIG-IP system returns the query with the NOERROR return code.
- When creating a new profile, if this parameter is not specified, the default - When creating a new profile, if this parameter is not specified, the default
is provided by the parent profile. is provided by the parent profile.
type: str
choices: choices:
- allow - allow
- drop - drop
@ -135,15 +139,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 profile exists. - When C(present), ensures that the profile exists.
- When C(absent), ensures the profile is removed. - When C(absent), ensures the profile 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)
@ -226,7 +232,6 @@ 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
@ -234,7 +239,6 @@ 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
@ -503,7 +507,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()
@ -735,15 +739,11 @@ 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) module.exit_json(**results)
except F5ModuleError as ex: except F5ModuleError as ex:
cleanup_tokens(client)
module.fail_json(msg=str(ex)) module.fail_json(msg=str(ex))

View file

@ -23,12 +23,14 @@ options:
name: name:
description: description:
- Specifies the name of the profile. - Specifies the name of the profile.
type: str
required: True required: True
parent: parent:
description: description:
- Specifies the profile from which this profile inherits settings. - Specifies the profile from which this profile inherits settings.
- When creating a new profile, if this parameter is not specified, the default - When creating a new profile, if this parameter is not specified, the default
is the system-supplied C(fastL4) profile. is the system-supplied C(fastL4) profile.
type: str
idle_timeout: idle_timeout:
description: description:
- Specifies the length of time that a connection is idle (has no traffic) before - Specifies the length of time that a connection is idle (has no traffic) before
@ -42,6 +44,7 @@ options:
regardless of how long they remain idle. regardless of how long they remain idle.
- When C(0), or C(immediate), specifies that the system deletes connections - When C(0), or C(immediate), specifies that the system deletes connections
immediately when they become idle. immediately when they become idle.
type: str
client_timeout: client_timeout:
description: description:
- Specifies a timeout for Late Binding. - Specifies a timeout for Late Binding.
@ -53,9 +56,11 @@ options:
transmission. transmission.
- When C(indefinite), disables the limit. This allows the client unlimited time - When C(indefinite), disables the limit. This allows the client unlimited time
to send the sender and target information. to send the sender and target information.
type: str
description: description:
description: description:
- Description of the profile. - Description of the profile.
type: str
explicit_flow_migration: explicit_flow_migration:
description: description:
- Specifies whether a qualified late-binding connection requires an explicit iRule - Specifies whether a qualified late-binding connection requires an explicit iRule
@ -75,6 +80,7 @@ options:
Header DF bit. Header DF bit.
- When C(set), sets the outgoing packet's IP Header DF bit. - When C(set), sets the outgoing packet's IP Header DF bit.
- When C(clear), clears the outgoing packet's IP Header DF bit. - When C(clear), clears the outgoing packet's IP Header DF bit.
type: str
choices: choices:
- pmtu - pmtu
- preserve - preserve
@ -89,6 +95,7 @@ options:
- When C(pass-through), specifies that the IP ToS setting remains unchanged. - When C(pass-through), specifies that the IP ToS setting remains unchanged.
- When C(mimic), specifies that the system sets the ToS level of outgoing packets to - When C(mimic), specifies that the system sets the ToS level of outgoing packets to
the same ToS level of the most-recently received incoming packet. the same ToS level of the most-recently received incoming packet.
type: str
ip_tos_to_server: ip_tos_to_server:
description: description:
- Specifies, for IP traffic passing through the system to back-end servers, whether - Specifies, for IP traffic passing through the system to back-end servers, whether
@ -98,6 +105,7 @@ options:
- When C(pass-through), specifies that the IP ToS setting remains unchanged. - When C(pass-through), specifies that the IP ToS setting remains unchanged.
- When C(mimic), specifies that the system sets the ToS level of outgoing packets to - When C(mimic), specifies that the system sets the ToS level of outgoing packets to
the same ToS level of the most-recently received incoming packet. the same ToS level of the most-recently received incoming packet.
type: str
ip_ttl_mode: ip_ttl_mode:
description: description:
- Specifies the outgoing TCP packet's IP Header TTL mode. - Specifies the outgoing TCP packet's IP Header TTL mode.
@ -108,6 +116,7 @@ options:
incoming TTL value. incoming TTL value.
- When C(set), sets the outgoing IP Header TTL value to a specific value(as specified - When C(set), sets the outgoing IP Header TTL value to a specific value(as specified
by C(ip_ttl_v4) or C(ip_ttl_v6). by C(ip_ttl_v4) or C(ip_ttl_v6).
type: str
choices: choices:
- proxy - proxy
- preserve - preserve
@ -117,13 +126,16 @@ options:
description: description:
- Specifies the outgoing packet's IP Header TTL value for IPv4 traffic. - Specifies the outgoing packet's IP Header TTL value for IPv4 traffic.
- Maximum TTL value that can be specified is 255. - Maximum TTL value that can be specified is 255.
type: int
ip_ttl_v6: ip_ttl_v6:
description: description:
- Specifies the outgoing packet's IP Header TTL value for IPv6 traffic. - Specifies the outgoing packet's IP Header TTL value for IPv6 traffic.
- Maximum TTL value that can be specified is 255. - Maximum TTL value that can be specified is 255.
type: int
keep_alive_interval: keep_alive_interval:
description: description:
- Specifies the keep-alive probe interval, in seconds. - Specifies the keep-alive probe interval, in seconds.
type: int
late_binding: late_binding:
description: description:
- Enables intelligent selection of a back-end server or pool, using an - Enables intelligent selection of a back-end server or pool, using an
@ -140,6 +152,7 @@ options:
- When a number, specifies the link QoS setting that the system inserts - When a number, specifies the link QoS setting that the system inserts
in the IP packet header. in the IP packet header.
- When C(pass-through), specifies that the link QoS setting remains unchanged. - When C(pass-through), specifies that the link QoS setting remains unchanged.
type: str
link_qos_to_server: link_qos_to_server:
description: description:
- Specifies, for IP traffic passing through the system to back-end servers, - Specifies, for IP traffic passing through the system to back-end servers,
@ -151,6 +164,7 @@ options:
- When a number, specifies the link QoS setting that the system inserts - When a number, specifies the link QoS setting that the system inserts
in the IP packet header. in the IP packet header.
- When C(pass-through), specifies that the link QoS setting remains unchanged. - When C(pass-through), specifies that the link QoS setting remains unchanged.
type: str
loose_close: loose_close:
description: description:
- When C(yes), specifies, that the system closes a loosely-initiated connection - When C(yes), specifies, that the system closes a loosely-initiated connection
@ -166,6 +180,7 @@ options:
description: description:
- Specifies a maximum segment size (MSS) override for server-side connections. - Specifies a maximum segment size (MSS) override for server-side connections.
- Valid range is 256 to 9162 or 0 to disable. - Valid range is 256 to 9162 or 0 to disable.
type: int
reassemble_fragments: reassemble_fragments:
description: description:
- When C(yes), specifies that the system reassembles IP fragments. - When C(yes), specifies that the system reassembles IP fragments.
@ -174,6 +189,7 @@ options:
description: description:
- Specifies the amount of data the BIG-IP system can accept without acknowledging - Specifies the amount of data the BIG-IP system can accept without acknowledging
the server. the server.
type: int
reset_on_timeout: reset_on_timeout:
description: description:
- When C(yes), specifies that the system sends a reset packet (RST) in addition - When C(yes), specifies that the system sends a reset packet (RST) in addition
@ -204,9 +220,11 @@ options:
- Specifies a value that overrides the SYN cookie maximum segment size (MSS) - Specifies a value that overrides the SYN cookie maximum segment size (MSS)
value in the SYN-ACK packet that is returned to the client. value in the SYN-ACK packet that is returned to the client.
- Valid values are 0, and values from 256 through 9162. - Valid values are 0, and values from 256 through 9162.
type: int
tcp_close_timeout: tcp_close_timeout:
description: description:
- Specifies the length of time a connection can remain idle before deletion. - Specifies the length of time a connection can remain idle before deletion.
type: str
tcp_generate_isn: tcp_generate_isn:
description: description:
- When C(yes), specifies that the system generates initial sequence numbers - When C(yes), specifies that the system generates initial sequence numbers
@ -223,6 +241,7 @@ options:
- When C(disabled), specifies that the system does not apply a timeout to a - When C(disabled), specifies that the system does not apply a timeout to a
TCP handshake. TCP handshake.
- When C(indefinite), specifies that attempting a TCP handshake never times out. - When C(indefinite), specifies that attempting a TCP handshake never times out.
type: str
tcp_strip_sack: tcp_strip_sack:
description: description:
- When C(yes), specifies that the system blocks a TCP selective ACK SackOK - When C(yes), specifies that the system blocks a TCP selective ACK SackOK
@ -232,9 +251,11 @@ options:
description: description:
- Specifies the number of milliseconds that a connection is in the TIME-WAIT - Specifies the number of milliseconds that a connection is in the TIME-WAIT
state before closing. state before closing.
type: int
tcp_timestamp_mode: tcp_timestamp_mode:
description: description:
- Specifies the action that the system should take on TCP timestamps. - Specifies the action that the system should take on TCP timestamps.
type: str
choices: choices:
- preserve - preserve
- rewrite - rewrite
@ -242,6 +263,7 @@ options:
tcp_wscale_mode: tcp_wscale_mode:
description: description:
- Specifies the action that the system should take on TCP windows. - Specifies the action that the system should take on TCP windows.
type: str
choices: choices:
- preserve - preserve
- rewrite - rewrite
@ -254,21 +276,24 @@ options:
- When C(fallback), reverts the connection to normal FastL4 load-balancing, - When C(fallback), reverts the connection to normal FastL4 load-balancing,
based on the client's TCP header. This causes the BIG-IP system to choose based on the client's TCP header. This causes the BIG-IP system to choose
a back-end server based only on the source address and port. a back-end server based only on the source address and port.
type: str
choices: choices:
- disconnect - disconnect
- fallback - fallback
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 profile exists. - When C(present), ensures that the profile exists.
- When C(absent), ensures the profile is removed. - When C(absent), ensures the profile 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)
@ -460,22 +485,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.common import flatten_boolean from library.module_utils.network.f5.common import flatten_boolean
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.common import flatten_boolean from ansible.module_utils.network.f5.common import flatten_boolean
@ -1115,7 +1134,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()
@ -1368,16 +1387,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__':

View file

@ -23,21 +23,25 @@ options:
name: name:
description: description:
- Specifies the name of the profile. - Specifies the name of the profile.
type: str
required: True required: True
parent: parent:
description: description:
- Specifies the profile from which this profile inherits settings. - Specifies the profile from which this profile inherits settings.
- When creating a new profile, if this parameter is not specified, the default - When creating a new profile, if this parameter is not specified, the default
is the system-supplied C(http) profile. is the system-supplied C(http) profile.
type: str
default: /Common/http default: /Common/http
description: description:
description: description:
- Description of the profile. - Description of the profile.
type: str
proxy_type: proxy_type:
description: description:
- Specifies the proxy mode for the profile. - Specifies the proxy mode for the profile.
- When creating a new profile, if this parameter is not specified, the - When creating a new profile, if this parameter is not specified, the
default is provided by the parent profile. default is provided by the parent profile.
type: str
choices: choices:
- reverse - reverse
- transparent - transparent
@ -50,6 +54,7 @@ options:
just as an object name (C(foo)). just as an object name (C(foo)).
- To remove the entry a value of C(none) or C('') can be set, however the profile C(proxy_type) - To remove the entry a value of C(none) or C('') can be set, however the profile C(proxy_type)
must not be set as C(explicit). must not be set as C(explicit).
type: str
insert_xforwarded_for: insert_xforwarded_for:
description: description:
- When specified system inserts an X-Forwarded-For header in an HTTP request - When specified system inserts an X-Forwarded-For header in an HTTP request
@ -70,6 +75,7 @@ options:
the system changes it to the virtual server address. the system changes it to the virtual server address.
- When creating a new profile, if this parameter is not specified, the - When creating a new profile, if this parameter is not specified, the
default is provided by the parent profile. default is provided by the parent profile.
type: str
choices: choices:
- none - none
- all - all
@ -87,14 +93,16 @@ options:
- Passphrase for cookie encryption. - Passphrase for cookie encryption.
- When creating a new profile, if this parameter is not specified, the - When creating a new profile, if this parameter is not specified, the
default is provided by the parent profile. default is provided by the parent profile.
type: str
update_password: update_password:
description: description:
- C(always) will update passwords if the C(encrypt_cookie_secret) is specified. - C(always) will update passwords if the C(encrypt_cookie_secret) is specified.
- C(on_create) will only set the password for newly created profiles. - C(on_create) will only set the password for newly created profiles.
default: always type: str
choices: choices:
- always - always
- on_create - on_create
default: always
header_erase: header_erase:
description: description:
- The name of a header, in an HTTP request, which the system removes from request. - The name of a header, in an HTTP request, which the system removes from request.
@ -102,6 +110,7 @@ options:
- The format of the header must be in C(KEY:VALUE) format, otherwise error is raised. - The format of the header must be in C(KEY:VALUE) format, otherwise error is raised.
- When creating a new profile, if this parameter is not specified, the - When creating a new profile, if this parameter is not specified, the
default is provided by the parent profile. default is provided by the parent profile.
type: str
version_added: 2.8 version_added: 2.8
header_insert: header_insert:
description: description:
@ -110,6 +119,7 @@ options:
- The format of the header must be in C(KEY:VALUE) format, otherwise error is raised. - The format of the header must be in C(KEY:VALUE) format, otherwise error is raised.
- When creating a new profile, if this parameter is not specified, the - When creating a new profile, if this parameter is not specified, the
default is provided by the parent profile. default is provided by the parent profile.
type: str
version_added: 2.8 version_added: 2.8
server_agent_name: server_agent_name:
description: description:
@ -117,6 +127,7 @@ options:
- To remove the entry completely a value of C(none) or C('') should be set. - To remove the entry completely a value of C(none) or C('') should be set.
- When creating a new profile, if this parameter is not specified, the - When creating a new profile, if this parameter is not specified, the
default is provided by the parent profile. default is provided by the parent profile.
type: str
version_added: 2.8 version_added: 2.8
include_subdomains: include_subdomains:
description: description:
@ -134,6 +145,7 @@ options:
re-enables plaintext HTTP access, while specifying C(indefinite) will set it to the maximum value. re-enables plaintext HTTP access, while specifying C(indefinite) will set it to the maximum value.
- When creating a new profile, if this parameter is not specified, the - When creating a new profile, if this parameter is not specified, the
default is provided by the parent profile. default is provided by the parent profile.
type: str
version_added: 2.8 version_added: 2.8
hsts_mode: hsts_mode:
description: description:
@ -145,15 +157,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 profile exists. - When C(present), ensures that the profile exists.
- When C(absent), ensures the profile is removed. - When C(absent), ensures the profile is removed.
default: present type: str
choices: choices:
- present - present
- absent - absent
default: present
extends_documentation_fragment: f5 extends_documentation_fragment: f5
author: author:
- Wojciech Wypior (@wojtek0806) - Wojciech Wypior (@wojtek0806)
@ -233,25 +247,19 @@ 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 flatten_boolean from library.module_utils.network.f5.common import flatten_boolean
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.urls import check_header_validity from library.module_utils.network.f5.urls import check_header_validity
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 flatten_boolean from ansible.module_utils.network.f5.common import flatten_boolean
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.urls import check_header_validity from ansible.module_utils.network.f5.urls import check_header_validity
@ -639,7 +647,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()
@ -880,16 +888,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__':

View file

@ -23,16 +23,19 @@ options:
name: name:
description: description:
- Specifies the name of the profile. - Specifies the name of the profile.
type: str
required: True required: True
parent: parent:
description: description:
- Specifies the profile from which this profile inherits settings. - Specifies the profile from which this profile inherits settings.
- When creating a new profile, if this parameter is not specified, the default - When creating a new profile, if this parameter is not specified, the default
is the system-supplied C(http2) profile. is the system-supplied C(http2) profile.
type: str
default: /Common/http2 default: /Common/http2
description: description:
description: description:
- Description of the profile. - Description of the profile.
type: str
streams: streams:
description: description:
- Specifies the number of outstanding concurrent requests that are allowed on a single HTTP/2 connection. - Specifies the number of outstanding concurrent requests that are allowed on a single HTTP/2 connection.
@ -54,6 +57,7 @@ options:
description: description:
- Specifies the name of the HTTP header controlled by C(insert_header) parameter. - Specifies the name of the HTTP header controlled by C(insert_header) parameter.
- When creating a new profile, if this parameter is not specified, the default is provided by the parent profile. - When creating a new profile, if this parameter is not specified, the default is provided by the parent profile.
type: str
enforce_tls_requirements: enforce_tls_requirements:
description: description:
- Specifies whether the system requires TLS for communications between specified senders and recipients. - Specifies whether the system requires TLS for communications between specified senders and recipients.
@ -64,10 +68,10 @@ options:
- Specifies what will cause an incoming connection to be handled as a HTTP/2 connection. - Specifies what will cause an incoming connection to be handled as a HTTP/2 connection.
- The C(alpn) and C(always) are mutually exclusive. - The C(alpn) and C(always) are mutually exclusive.
- When creating a new profile, if this parameter is not specified, the default is provided by the parent profile. - When creating a new profile, if this parameter is not specified, the default is provided by the parent profile.
type: list
choices: choices:
- alpn - alpn
- always - always
type: list
frame_size: frame_size:
description: description:
- Specifies the size of data frames, in bytes, that HTTP/2 sends to the client. - Specifies the size of data frames, in bytes, that HTTP/2 sends to the client.
@ -95,15 +99,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 profile exists. - When C(present), ensures that the profile exists.
- When C(absent), ensures the profile is removed. - When C(absent), ensures the profile is removed.
default: present type: str
choices: choices:
- present - present
- absent - absent
default: present
extends_documentation_fragment: f5 extends_documentation_fragment: f5
author: author:
- Wojciech Wypior (@wojtek0806) - Wojciech Wypior (@wojtek0806)
@ -184,26 +190,20 @@ 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 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.common import is_empty_list from library.module_utils.network.f5.common import is_empty_list
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 fq_name from ansible.module_utils.network.f5.common import fq_name
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.common import is_empty_list from ansible.module_utils.network.f5.common import is_empty_list
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):
@ -440,7 +440,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()
@ -667,16 +667,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__':

View file

@ -23,27 +23,32 @@ options:
name: name:
description: description:
- Specifies the name of the compression profile. - Specifies the name of the compression profile.
type: str
required: True required: True
parent: parent:
description: description:
- Specifies the profile from which this profile inherits settings. - Specifies the profile from which this profile inherits settings.
- When creating a new profile, if this parameter is not specified, the default - When creating a new profile, if this parameter is not specified, the default
is the system-supplied C(httpcompression) profile. is the system-supplied C(httpcompression) profile.
type: str
description: description:
description: description:
- Description of the HTTP compression profile. - Description of the HTTP compression profile.
type: str
buffer_size: buffer_size:
description: description:
- Maximum number of compressed bytes that the system buffers before inserting - Maximum number of compressed bytes that the system buffers before inserting
a Content-Length header (which specifies the compressed size) into the response. a Content-Length header (which specifies the compressed size) into the response.
- When creating a new profile, if this parameter is not specified, the default - When creating a new profile, if this parameter is not specified, the default
is provided by the parent profile. is provided by the parent profile.
type: int
gzip_level: gzip_level:
description: description:
- Specifies the degree to which the system compresses the content. - Specifies the degree to which the system compresses the content.
- Higher compression levels cause the compression process to be slower. - Higher compression levels cause the compression process to be slower.
- Valid values are between 1 (least compression and fastest) to 9 (most - Valid values are between 1 (least compression and fastest) to 9 (most
compression and slowest). compression and slowest).
type: int
choices: choices:
- 1 - 1
- 2 - 2
@ -58,6 +63,7 @@ options:
description: description:
- Number of kilobytes of memory that the system uses for internal compression - Number of kilobytes of memory that the system uses for internal compression
buffers when compressing a server response. buffers when compressing a server response.
type: int
choices: choices:
- 1 - 1
- 2 - 2
@ -72,6 +78,7 @@ options:
description: description:
- Number of kilobytes in the window size that the system uses when compressing - Number of kilobytes in the window size that the system uses when compressing
a server response. a server response.
type: int
choices: choices:
- 1 - 1
- 2 - 2
@ -84,15 +91,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 profile exists. - When C(present), ensures that the profile exists.
- When C(absent), ensures the profile is removed. - When C(absent), ensures the profile 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)
@ -149,21 +158,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
@ -303,7 +306,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()
@ -527,16 +530,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__':

View file

@ -23,12 +23,14 @@ options:
name: name:
description: description:
- Specifies the name of the OneConnect profile. - Specifies the name of the OneConnect profile.
type: str
required: True required: True
parent: parent:
description: description:
- Specifies the profile from which this profile inherits settings. - Specifies the profile from which this profile inherits settings.
- When creating a new profile, if this parameter is not specified, the default - When creating a new profile, if this parameter is not specified, the default
is the system-supplied C(oneconnect) profile. is the system-supplied C(oneconnect) profile.
type: str
source_mask: source_mask:
description: description:
- Specifies a value that the system applies to the source address to determine - Specifies a value that the system applies to the source address to determine
@ -42,9 +44,11 @@ options:
connections originating from the same source address. connections originating from the same source address.
- When you are using a SNAT or SNAT pool, the server-side source address is - When you are using a SNAT or SNAT pool, the server-side source address is
translated first and then the OneConnect mask is applied to the translated address. translated first and then the OneConnect mask is applied to the translated address.
type: str
description: description:
description: description:
- Description of the profile. - Description of the profile.
type: str
maximum_size: maximum_size:
description: description:
- Specifies the maximum number of connections that the system holds in the - Specifies the maximum number of connections that the system holds in the
@ -53,6 +57,7 @@ options:
response is completed. response is completed.
- When creating a new profile, if this parameter is not specified, the - When creating a new profile, if this parameter is not specified, the
default is provided by the parent profile. default is provided by the parent profile.
type: int
maximum_age: maximum_age:
description: description:
- Specifies the maximum number of seconds allowed for a connection in the connection - Specifies the maximum number of seconds allowed for a connection in the connection
@ -61,11 +66,13 @@ options:
connection from the re-use pool. connection from the re-use pool.
- When creating a new profile, if this parameter is not specified, the - When creating a new profile, if this parameter is not specified, the
default is provided by the parent profile. default is provided by the parent profile.
type: int
maximum_reuse: maximum_reuse:
description: description:
- Specifies the maximum number of times that a server-side connection can be reused. - Specifies the maximum number of times that a server-side connection can be reused.
- When creating a new profile, if this parameter is not specified, the - When creating a new profile, if this parameter is not specified, the
default is provided by the parent profile. default is provided by the parent profile.
type: int
idle_timeout_override: idle_timeout_override:
description: description:
- Specifies the number of seconds that a connection is idle before the connection - Specifies the number of seconds that a connection is idle before the connection
@ -76,6 +83,7 @@ options:
- When C(disabled), specifies that there is no timeout override for the connection. - When C(disabled), specifies that there is no timeout override for the connection.
- When C(indefinite), Specifies that a connection may be idle with no timeout - When C(indefinite), Specifies that a connection may be idle with no timeout
override. override.
type: str
limit_type: limit_type:
description: description:
- When C(none), simultaneous in-flight requests and responses over TCP connections - When C(none), simultaneous in-flight requests and responses over TCP connections
@ -91,6 +99,7 @@ options:
short expiration timeouts. short expiration timeouts.
- When creating a new profile, if this parameter is not specified, the default - When creating a new profile, if this parameter is not specified, the default
is provided by the parent profile. is provided by the parent profile.
type: str
choices: choices:
- none - none
- idle - idle
@ -107,15 +116,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 profile exists. - When C(present), ensures that the profile exists.
- When C(absent), ensures the profile is removed. - When C(absent), ensures the profile 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)
@ -183,23 +194,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.ipaddress import is_valid_ip from library.module_utils.network.f5.ipaddress import is_valid_ip
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.ipaddress import is_valid_ip from ansible.module_utils.network.f5.ipaddress import is_valid_ip
@ -379,7 +384,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()
@ -600,16 +605,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__':

View file

@ -23,15 +23,18 @@ options:
name: name:
description: description:
- Specifies the name of the profile. - Specifies the name of the profile.
type: str
required: True required: True
description: description:
description: description:
- Description of the profile. - Description of the profile.
type: str
parent: parent:
description: description:
- Specifies the profile from which this profile inherits settings. - Specifies the profile from which this profile inherits settings.
- When creating a new profile, if this parameter is not specified, the default - When creating a new profile, if this parameter is not specified, the default
is the system-supplied C(cookie) profile. is the system-supplied C(cookie) profile.
type: str
default: cookie default: cookie
cookie_method: cookie_method:
description: description:
@ -47,6 +50,7 @@ options:
- When C(rewrite), specifies that the system intercepts the BIGipCookie - When C(rewrite), specifies that the system intercepts the BIGipCookie
header, sent from the server, and overwrites the name and value of that header, sent from the server, and overwrites the name and value of that
cookie. cookie.
type: str
choices: choices:
- hash - hash
- insert - insert
@ -55,6 +59,7 @@ options:
cookie_name: cookie_name:
description: description:
- Specifies a unique name for the cookie. - Specifies a unique name for the cookie.
type: str
http_only: http_only:
description: description:
- Specifies whether the httponly attribute should be enabled or - Specifies whether the httponly attribute should be enabled or
@ -87,6 +92,7 @@ options:
- When C(disabled), generates the cookie format unencrypted. - When C(disabled), generates the cookie format unencrypted.
- When C(preferred), generate an encrypted cookie, but accepts both encrypted and unencrypted formats. - When C(preferred), generate an encrypted cookie, but accepts both encrypted and unencrypted formats.
- When C(required), cookie format must be encrypted. - When C(required), cookie format must be encrypted.
type: str
choices: choices:
- disabled - disabled
- preferred - preferred
@ -114,33 +120,62 @@ options:
encryption_passphrase: encryption_passphrase:
description: description:
- Specifies a passphrase to be used for cookie encryption. - Specifies a passphrase to be used for cookie encryption.
type: str
update_password: update_password:
description: description:
- C(always) will allow to update passphrases if the user chooses to do so. - C(always) will allow to update passphrases if the user chooses to do so.
C(on_create) will only set the passphrase for newly created profiles. C(on_create) will only set the passphrase for newly created profiles.
default: always type: str
choices: choices:
- always - always
- on_create - on_create
default: always
expiration:
description:
- Specifies the expiration time of the cookie. By default the system generates and uses session cookie.
This cookie expires when the user session expires, that is when the browser is closed.
suboptions:
days:
description:
- Cookie expiration time in days, the value must be in range from C(0) to C(24855) days.
type: int
hours:
description:
- Cookie expiration time in hours, the value must be in the range from C(0) to C(23) hours.
type: int
minutes:
description:
- Cookie expiration time in minutes, the value must be in the range from C(0) to C(59) minutes.
type: int
seconds:
description:
- Cookie expiration time in seconds, the value must be in the range from C(0) to C(59) seconds.
type: int
default: 0
type: dict
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 profile exists. - When C(present), ensures that the profile exists.
- When C(absent), ensures the profile is removed. - When C(absent), ensures the profile 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)
- Wojciech Wypior (@wojtek0806)
''' '''
EXAMPLES = r''' EXAMPLES = r'''
- name: Create a ... - name: Create a persistence cookie profile
bigip_profile_persistence_cookie: bigip_profile_persistence_cookie:
name: foo name: foo
provider: provider:
@ -148,6 +183,18 @@ EXAMPLES = r'''
server: lb.mydomain.com server: lb.mydomain.com
user: admin user: admin
delegate_to: localhost delegate_to: localhost
- name: Create a persistence cookie profile with expiration time
bigip_profile_persistence_cookie:
name: foo
expiration:
days: 7
hours: 12
minutes: 30
provider:
password: secret
server: lb.mydomain.com
user: admin
delegate_to: localhost
''' '''
RETURN = r''' RETURN = r'''
@ -216,6 +263,32 @@ secure:
returned: changed returned: changed
type: bool type: bool
sample: no sample: no
expiration:
description: The expiration time of the cookie.
returned: changed
type: complex
contains:
days:
description: Cookie expiration time in days.
returned: changed
type: int
sample: 125
hours:
description: Cookie expiration time in hours.
returned: changed
type: int
sample: 22
minutes:
description: Cookie expiration time in minutes.
returned: changed
type: int
sample: 58
seconds:
description: Cookie expiration time in seconds.
returned: changed
type: int
sample: 20
sample: hash/dictionary of values
''' '''
from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import AnsibleModule
@ -225,11 +298,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
@ -237,11 +307,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
@ -278,6 +345,7 @@ class Parameters(AnsibleF5Parameters):
'secure', 'secure',
'cookieEncryptionPassphrase', 'cookieEncryptionPassphrase',
'method', 'method',
'expiration'
] ]
returnables = [ returnables = [
@ -295,6 +363,7 @@ class Parameters(AnsibleF5Parameters):
'encryption_passphrase', 'encryption_passphrase',
'description', 'description',
'secure', 'secure',
'expiration',
] ]
updatables = [ updatables = [
@ -312,6 +381,7 @@ class Parameters(AnsibleF5Parameters):
'encryption_passphrase', 'encryption_passphrase',
'description', 'description',
'secure', 'secure',
'expiration',
] ]
@property @property
@ -371,6 +441,86 @@ class ModuleParameters(Parameters):
return '' return ''
return self._values['description'] return self._values['description']
@property
def expiration(self):
if self._values['expiration'] is None:
return None
days = self.days
hours = self.hours
minutes = self.minutes
seconds = self.seconds
if days is not None:
if hours is None:
raise F5ModuleError(
"Incorrect format, 'hours' parameter is missing value."
)
if minutes is None:
raise F5ModuleError(
"Incorrect format, 'minutes' parameter is missing value."
)
expiry_time = '{0}:{1}:{2}:{3}'.format(days, hours, minutes, seconds)
return expiry_time
if hours is not None:
if minutes is None:
raise F5ModuleError(
"Incorrect format, 'minutes' parameter is missing value."
)
expiry_time = '{0}:{1}:{2}'.format(hours, minutes, seconds)
return expiry_time
if minutes is not None:
expiry_time = '{0}:{1}'.format(minutes, seconds)
return expiry_time
return str(seconds)
@property
def days(self):
days = self._values['expiration']['days']
if days is None:
return None
if days < 0 or days >= 24856:
raise F5ModuleError(
'The provided value is invalid, the correct value range is: 0 - 24855 days.'
)
return days
@property
def hours(self):
hours = self._values['expiration']['hours']
if hours is None:
return None
if hours < 0 or hours > 23:
raise F5ModuleError(
'The provided value is invalid, the correct value range is: 0 - 23 hours.'
)
return hours
@property
def minutes(self):
minutes = self._values['expiration']['minutes']
if minutes is None:
return None
if minutes < 0 or minutes > 59:
raise F5ModuleError(
'The provided value is invalid, the correct value range is: 0 - 59 minutes.'
)
return minutes
@property
def seconds(self):
seconds = self._values['expiration']['seconds']
if seconds < 0 or seconds > 59:
raise F5ModuleError(
'The provided value is invalid, the correct value range is: 0 - 59 seconds.'
)
return seconds
class Changes(Parameters): class Changes(Parameters):
def to_return(self): def to_return(self):
@ -487,6 +637,32 @@ class ReportableChanges(Changes):
def encryption_passphrase(self): def encryption_passphrase(self):
return None return None
@property
def expiration(self):
expire = self._values['expiration']
result = dict()
if expire is None:
return None
tmp = expire.split(':')
if len(tmp) == 1:
result['seconds'] = int(tmp[0])
if len(tmp) == 2:
result['minutes'] = int(tmp[0])
result['seconds'] = int(tmp[1])
if len(tmp) == 3:
result['hours'] = int(tmp[0])
result['minutes'] = int(tmp[1])
result['seconds'] = int(tmp[2])
if len(tmp) == 4:
result['days'] = int(tmp[0])
result['hours'] = int(tmp[1])
result['minutes'] = int(tmp[2])
result['seconds'] = int(tmp[3])
return result
class Difference(object): class Difference(object):
def __init__(self, want, have=None): def __init__(self, want, have=None):
@ -524,7 +700,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()
@ -744,6 +920,24 @@ class ArgumentSpec(object):
default='always', default='always',
choices=['always', 'on_create'] choices=['always', 'on_create']
), ),
expiration=dict(
type='dict',
options=dict(
days=dict(
type='int'
),
hours=dict(
type='int'
),
minutes=dict(
type='int'
),
seconds=dict(
type='int',
default=0
)
)
),
state=dict( state=dict(
default='present', default='present',
choices=['present', 'absent'] choices=['present', 'absent']
@ -766,16 +960,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__':

View file

@ -23,12 +23,14 @@ options:
name: name:
description: description:
- Specifies the name of the profile. - Specifies the name of the profile.
type: str
required: True required: True
parent: parent:
description: description:
- Specifies the profile from which this profile inherits settings. - Specifies the profile from which this profile inherits settings.
- When creating a new profile, if this parameter is not specified, the default - When creating a new profile, if this parameter is not specified, the default
is the system-supplied C(source_addr) profile. is the system-supplied C(source_addr) profile.
type: str
match_across_services: match_across_services:
description: description:
- When C(yes), specifies that all persistent connections from a client IP address that go - When C(yes), specifies that all persistent connections from a client IP address that go
@ -60,6 +62,7 @@ options:
to obtain the hash result for the input to the algorithm. to obtain the hash result for the input to the algorithm.
- When creating a new profile, if this parameter is not specified, the - When creating a new profile, if this parameter is not specified, the
default is provided by the parent profile. default is provided by the parent profile.
type: str
choices: choices:
- default - default
- carp - carp
@ -70,6 +73,7 @@ options:
default is provided by the parent profile. default is provided by the parent profile.
- To specify an indefinite timeout, use the value C(indefinite). - To specify an indefinite timeout, use the value C(indefinite).
- If specifying a numeric timeout, the value must be between C(1) and C(4294967295). - If specifying a numeric timeout, the value must be between C(1) and C(4294967295).
type: str
override_connection_limit: override_connection_limit:
description: description:
- When C(yes), specifies that the system allows you to specify that pool member connection - When C(yes), specifies that the system allows you to specify that pool member connection
@ -79,15 +83,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 profile exists. - When C(present), ensures that the profile exists.
- When C(absent), ensures the profile is removed. - When C(absent), ensures the profile 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)
@ -128,24 +134,18 @@ 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 flatten_boolean from library.module_utils.network.f5.common import flatten_boolean
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 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 flatten_boolean from ansible.module_utils.network.f5.common import flatten_boolean
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):
@ -328,7 +328,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()
@ -544,16 +544,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__':

View file

@ -23,16 +23,19 @@ options:
name: name:
description: description:
- Specifies the name of the profile. - Specifies the name of the profile.
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. been set, it cannot be changed.
type: str
default: /Common/serverssl default: /Common/serverssl
ciphers: ciphers:
description: description:
- Specifies the list of ciphers that the system supports. When creating a new - Specifies the list of ciphers that the system supports. When creating a new
profile, the default cipher list is provided by the parent profile. profile, the default cipher list is provided by the parent profile.
type: str
secure_renegotiation: secure_renegotiation:
description: description:
- Specifies the method of secure renegotiations for SSL connections. When - Specifies the method of secure renegotiations for SSL connections. When
@ -44,6 +47,7 @@ options:
- The C(require-strict) setting the system requires strict renegotiation of SSL - The C(require-strict) setting the system requires strict renegotiation of SSL
connections. In this mode the system refuses connections to insecure servers, connections. In this mode the system refuses connections to insecure servers,
and terminates existing SSL connections to insecure servers. and terminates existing SSL connections to insecure servers.
type: str
choices: choices:
- require - require
- require-strict - require-strict
@ -53,6 +57,7 @@ options:
- Specifies the fully qualified DNS hostname of the server used in Server Name - Specifies the fully qualified DNS hostname of the server used in Server Name
Indication communications. When creating a new profile, the setting is provided Indication communications. When creating a new profile, the setting is provided
by the parent profile. by the parent profile.
type: str
sni_default: sni_default:
description: description:
- Indicates that the system uses this profile as the default SSL profile when there - Indicates that the system uses this profile as the default SSL profile when there
@ -62,9 +67,9 @@ options:
type: bool type: bool
sni_require: sni_require:
description: description:
- Requires that the network peers also provide SNI support. This setting only takes - Requires that the network peers also provide SNI support, setting only takes
effect when C(sni_default) is C(yes). When creating a new profile, the setting effect when C(sni_default) is C(yes).
is provided by the parent profile. - When creating a new profile, the setting is provided by the parent profile.
type: bool type: bool
server_certificate: server_certificate:
description: description:
@ -72,6 +77,7 @@ options:
- When C(ignore), specifies that the system ignores certificates from server systems. - When C(ignore), specifies that the system ignores certificates from server systems.
- When C(require), specifies that the system requires a server to present a valid - When C(require), specifies that the system requires a server to present a valid
certificate. certificate.
type: str
choices: choices:
- ignore - ignore
- require - require
@ -79,39 +85,47 @@ options:
description: description:
- Specifies the name of the certificate that the system uses for server-side SSL - Specifies the name of the certificate that the system uses for server-side SSL
processing. processing.
type: str
key: key:
description: description:
- Specifies the file name of the SSL key. - Specifies the file name of the SSL key.
type: str
chain: chain:
description: description:
- Specifies the certificates-key chain to associate with the SSL profile. - Specifies the certificates-key chain to associate with the SSL profile.
type: str
passphrase: passphrase:
description: description:
- Specifies a passphrase used to encrypt the key. - Specifies a passphrase used to encrypt the key.
type: str
update_password: update_password:
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 profiles. C(on_create) will only set the password for newly created profiles.
default: always type: str
choices: choices:
- always - always
- on_create - on_create
default: always
ocsp_profile: ocsp_profile:
description: description:
- Specifies the name of the OCSP profile for purpose of validating status - Specifies the name of the OCSP profile for purpose of validating status
of server certificate. of server certificate.
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 profile exists. - When C(present), ensures that the profile exists.
- When C(absent), ensures the profile is removed. - When C(absent), ensures the profile 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)
@ -134,7 +148,7 @@ ciphers:
returned: changed returned: changed
type: str type: str
sample: "!SSLv3:!SSLv2:ECDHE+AES-GCM+SHA256:ECDHE-RSA-AES128-CBC-SHA" sample: "!SSLv3:!SSLv2:ECDHE+AES-GCM+SHA256:ECDHE-RSA-AES128-CBC-SHA"
secure_renegotation: secure_renegotiation:
description: The method of secure SSL renegotiation. description: The method of secure SSL renegotiation.
returned: changed returned: changed
type: str type: str
@ -148,22 +162,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 flatten_boolean from library.module_utils.network.f5.common import flatten_boolean
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 flatten_boolean from ansible.module_utils.network.f5.common import flatten_boolean
from ansible.module_utils.network.f5.common import transform_name from ansible.module_utils.network.f5.common import transform_name
@ -404,7 +412,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()
@ -645,16 +653,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__':

View file

@ -26,12 +26,14 @@ options:
name: name:
description: description:
- Specifies the name of the profile. - Specifies the name of the profile.
type: str
required: True required: True
parent: parent:
description: description:
- Specifies the profile from which this profile inherits settings. - Specifies the profile from which this profile inherits settings.
- When creating a new profile, if this parameter is not specified, the default - When creating a new profile, if this parameter is not specified, the default
is the system-supplied C(tcp) profile. is the system-supplied C(tcp) profile.
type: str
idle_timeout: idle_timeout:
description: description:
- Specifies the length of time that a connection is idle (has no traffic) before - Specifies the length of time that a connection is idle (has no traffic) before
@ -43,6 +45,7 @@ options:
connection can remain idle before the system deletes it. connection can remain idle before the system deletes it.
- When C(0), or C(indefinite), specifies that the system does not delete TCP connections - When C(0), or C(indefinite), specifies that the system does not delete TCP connections
regardless of how long they remain idle. regardless of how long they remain idle.
type: str
time_wait_recycle: time_wait_recycle:
description: description:
- Specifies that connections in a TIME-WAIT state are reused, if a SYN packet, - Specifies that connections in a TIME-WAIT state are reused, if a SYN packet,
@ -55,15 +58,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 profile exists. - When C(present), ensures that the profile exists.
- When C(absent), ensures the profile is removed. - When C(absent), ensures the profile 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)
@ -110,24 +115,18 @@ 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 flatten_boolean from library.module_utils.network.f5.common import flatten_boolean
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 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 flatten_boolean from ansible.module_utils.network.f5.common import flatten_boolean
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):
@ -254,7 +253,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()
@ -469,16 +468,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__':

View file

@ -26,12 +26,14 @@ options:
name: name:
description: description:
- Specifies the name of the profile. - Specifies the name of the profile.
type: str
required: True required: True
parent: parent:
description: description:
- Specifies the profile from which this profile inherits settings. - Specifies the profile from which this profile inherits settings.
- When creating a new profile, if this parameter is not specified, the default - When creating a new profile, if this parameter is not specified, the default
is the system-supplied C(udp) profile. is the system-supplied C(udp) profile.
type: str
idle_timeout: idle_timeout:
description: description:
- Specifies the length of time that a connection is idle (has no traffic) before - Specifies the length of time that a connection is idle (has no traffic) before
@ -45,6 +47,7 @@ options:
indefinitely. indefinitely.
- When C(immediate), specifies that you do not want the UDP connection to - When C(immediate), specifies that you do not want the UDP connection to
remain idle, and that it is therefore immediately eligible for deletion. remain idle, and that it is therefore immediately eligible for deletion.
type: str
datagram_load_balancing: datagram_load_balancing:
description: description:
- Specifies, when C(yes), that the system load balances UDP traffic - Specifies, when C(yes), that the system load balances UDP traffic
@ -53,15 +56,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 profile exists. - When C(present), ensures that the profile exists.
- When C(absent), ensures the profile is removed. - When C(absent), ensures the profile 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)
@ -107,22 +112,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 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 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
class Parameters(AnsibleF5Parameters): class Parameters(AnsibleF5Parameters):
@ -235,7 +234,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()
@ -448,16 +447,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__':

View file

@ -24,7 +24,8 @@ options:
module: module:
description: description:
- The module to provision in BIG-IP. - The module to provision in BIG-IP.
required: true type: str
required: True
choices: choices:
- am - am
- afm - afm
@ -52,11 +53,12 @@ options:
the module is not activated. the module is not activated.
- This parameter is not relevant to C(cgnat) and will not be applied to the - This parameter is not relevant to C(cgnat) and will not be applied to the
C(cgnat) module. C(cgnat) module.
default: nominal type: str
choices: choices:
- dedicated - dedicated
- nominal - nominal
- minimum - minimum
default: nominal
state: state:
description: description:
- The state of the provisioned module on the system. When C(present), - The state of the provisioned module on the system. When C(present),
@ -64,10 +66,11 @@ options:
level provided that there are sufficient resources on the device (such level provided that there are sufficient resources on the device (such
as physical RAM) to support the provisioned module. When C(absent), as physical RAM) to support the provisioned module. When C(absent),
de-provision the module. de-provision the module.
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)
@ -111,19 +114,13 @@ 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.icontrol import TransactionContextManager from library.module_utils.network.f5.icontrol import TransactionContextManager
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.icontrol import TransactionContextManager from ansible.module_utils.network.f5.icontrol import TransactionContextManager
@ -205,7 +202,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()
@ -883,14 +880,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()
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__':

View file

@ -98,14 +98,17 @@ class TestManager(unittest.TestCase):
], ],
partition='Common', partition='Common',
state='present', state='present',
password='password', provider=dict(
server='localhost', server='localhost',
password='password',
user='admin' 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
) )
mm = ModuleManager(module=module) mm = ModuleManager(module=module)
@ -126,16 +129,19 @@ class TestManager(unittest.TestCase):
], ],
partition='Common', partition='Common',
state='present', state='present',
password='password', provider=dict(
server='localhost', server='localhost',
password='password',
user='admin' user='admin'
)
)) ))
current = ApiParameters(params=load_fixture('load_ltm_node_3.json')) current = ApiParameters(params=load_fixture('load_ltm_node_3.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
) )
mm = ModuleManager(module=module) mm = ModuleManager(module=module)
@ -156,14 +162,17 @@ class TestManager(unittest.TestCase):
], ],
partition='Common', partition='Common',
state='present', state='present',
password='password', provider=dict(
server='localhost', server='localhost',
password='password',
user='admin' 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
) )
mm = ModuleManager(module=module) mm = ModuleManager(module=module)
@ -185,15 +194,18 @@ class TestManager(unittest.TestCase):
], ],
partition='Common', partition='Common',
state='present', state='present',
password='password', provider=dict(
server='localhost', server='localhost',
password='password',
user='admin' user='admin'
)
)) ))
current = ApiParameters(params=load_fixture('load_ltm_node_2.json')) current = ApiParameters(params=load_fixture('load_ltm_node_2.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
) )
mm = ModuleManager(module=module) mm = ModuleManager(module=module)
@ -217,15 +229,18 @@ class TestManager(unittest.TestCase):
], ],
partition='Common', partition='Common',
state='present', state='present',
password='password', provider=dict(
server='localhost', server='localhost',
password='password',
user='admin' user='admin'
)
)) ))
current = ApiParameters(params=load_fixture('load_ltm_node_2.json')) current = ApiParameters(params=load_fixture('load_ltm_node_2.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
) )
mm = ModuleManager(module=module) mm = ModuleManager(module=module)

View file

@ -109,9 +109,11 @@ class TestManagerEcho(unittest.TestCase):
set_module_args(dict( set_module_args(dict(
name='foo', name='foo',
description='my description', description='my description',
provider=dict(
server='localhost', server='localhost',
password='password', password='password',
user='admin' user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(
@ -133,9 +135,11 @@ class TestManagerEcho(unittest.TestCase):
set_module_args(dict( set_module_args(dict(
name='foo', name='foo',
description='my description', description='my description',
provider=dict(
server='localhost', server='localhost',
password='password', password='password',
user='admin' user='admin'
)
)) ))
current = ApiParameters(params=load_fixture('load_tm_auth_partition.json')) current = ApiParameters(params=load_fixture('load_tm_auth_partition.json'))
@ -158,9 +162,11 @@ class TestManagerEcho(unittest.TestCase):
set_module_args(dict( set_module_args(dict(
name='foo', name='foo',
description='another description', description='another description',
provider=dict(
server='localhost', server='localhost',
password='password', password='password',
user='admin' user='admin'
)
)) ))
current = ApiParameters(params=load_fixture('load_tm_auth_partition.json')) current = ApiParameters(params=load_fixture('load_tm_auth_partition.json'))
@ -185,9 +191,11 @@ class TestManagerEcho(unittest.TestCase):
set_module_args(dict( set_module_args(dict(
name='foo', name='foo',
route_domain=1, route_domain=1,
provider=dict(
server='localhost', server='localhost',
password='password', password='password',
user='admin' user='admin'
)
)) ))
current = ApiParameters(params=load_fixture('load_tm_auth_partition.json')) current = ApiParameters(params=load_fixture('load_tm_auth_partition.json'))

View file

@ -128,9 +128,11 @@ class TestManager(unittest.TestCase):
required_numeric=0, required_numeric=0,
required_special=0, required_special=0,
required_uppercase=0, required_uppercase=0,
provider=dict(
server='localhost', server='localhost',
password='password', password='password',
user='admin' user='admin'
)
)) ))
current = ApiParameters(params=load_fixture('load_tm_auth_password_policy_1.json')) current = ApiParameters(params=load_fixture('load_tm_auth_password_policy_1.json'))

View file

@ -71,9 +71,6 @@ class TestParameters(unittest.TestCase):
args = dict( args = dict(
name='foo', name='foo',
description='asdf asdf asdf', description='asdf asdf asdf',
password='password',
server='localhost',
user='admin'
) )
p = Parameters(params=args) p = Parameters(params=args)
assert p.name == 'foo' assert p.name == 'foo'
@ -84,10 +81,7 @@ class TestParameters(unittest.TestCase):
args = dict( args = dict(
name='foo', name='foo',
description='asdf asdf asdf', description='asdf asdf asdf',
password='password',
server='localhost',
strategy='foo', strategy='foo',
user='admin',
partition='Common' partition='Common'
) )
p = Parameters(params=args) p = Parameters(params=args)
@ -99,10 +93,7 @@ class TestParameters(unittest.TestCase):
args = dict( args = dict(
name='foo', name='foo',
description='asdf asdf asdf', description='asdf asdf asdf',
password='password',
server='localhost',
strategy='/Common/foo', strategy='/Common/foo',
user='admin',
partition='Common' partition='Common'
) )
p = Parameters(params=args) p = Parameters(params=args)
@ -114,10 +105,7 @@ class TestParameters(unittest.TestCase):
args = dict( args = dict(
name='foo', name='foo',
description='asdf asdf asdf', description='asdf asdf asdf',
password='password',
server='localhost',
strategy='/Foo/bar', strategy='/Foo/bar',
user='admin',
partition='Common' partition='Common'
) )
p = Parameters(params=args) p = Parameters(params=args)
@ -147,9 +135,11 @@ class TestSimpleTrafficPolicyManager(unittest.TestCase):
name="Policy-Foo", name="Policy-Foo",
state='present', state='present',
strategy='best', strategy='best',
password='password', provider=dict(
server='localhost', server='localhost',
password='password',
user='admin' user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(

View file

@ -134,9 +134,11 @@ class TestManager(unittest.TestCase):
path_begins_with_any=['/ABC'] path_begins_with_any=['/ABC']
) )
], ],
password='password', provider=dict(
server='localhost', server='localhost',
password='password',
user='admin' user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(
@ -173,9 +175,11 @@ class TestManager(unittest.TestCase):
path_begins_with_any=['/ABC'] path_begins_with_any=['/ABC']
) )
], ],
password='password', provider=dict(
server='localhost', server='localhost',
password='password',
user='admin' user='admin'
)
)) ))
current = ApiParameters(params=load_fixture('load_ltm_policy_draft_rule_http-uri_forward.json')) current = ApiParameters(params=load_fixture('load_ltm_policy_draft_rule_http-uri_forward.json'))

View file

@ -101,9 +101,11 @@ class TestManager(unittest.TestCase):
description='foo', description='foo',
collect_geo=True, collect_geo=True,
collect_ip=True, collect_ip=True,
password='password', provider=dict(
server='localhost', server='localhost',
password='password',
user='admin' user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(

View file

@ -109,9 +109,11 @@ class TestManager(unittest.TestCase):
chain='bigip_ssl_cert1' chain='bigip_ssl_cert1'
) )
], ],
password='password', provider=dict(
server='localhost', server='localhost',
password='password',
user='admin' user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(

View file

@ -120,9 +120,11 @@ class TestManager(unittest.TestCase):
process_recursion_desired=True, process_recursion_desired=True,
use_local_bind=True, use_local_bind=True,
enable_dns_firewall=True, enable_dns_firewall=True,
password='password', provider=dict(
server='localhost', server='localhost',
password='password',
user='admin' user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(

View file

@ -158,9 +158,11 @@ class TestManager(unittest.TestCase):
set_module_args(dict( set_module_args(dict(
name='foo', name='foo',
parent='bar', parent='bar',
password='password', provider=dict(
server='localhost', server='localhost',
password='password',
user='admin' user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(

View file

@ -106,9 +106,11 @@ class TestManager(unittest.TestCase):
name='foo', name='foo',
insert_xforwarded_for='yes', insert_xforwarded_for='yes',
parent='bar', parent='bar',
password='password', provider=dict(
server='localhost', server='localhost',
password='password',
user='admin' user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(

View file

@ -109,9 +109,11 @@ class TestManager(unittest.TestCase):
name='foo', name='foo',
enforce_tls_requirements='yes', enforce_tls_requirements='yes',
parent='bar', parent='bar',
password='password', provider=dict(
server='localhost', server='localhost',
password='password',
user='admin' user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(

View file

@ -109,9 +109,11 @@ class TestManager(unittest.TestCase):
gzip_memory_level=64, gzip_memory_level=64,
gzip_level=2, gzip_level=2,
gzip_window_size=128, gzip_window_size=128,
password='password', provider=dict(
server='localhost', server='localhost',
password='password',
user='admin' user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(

View file

@ -103,9 +103,11 @@ class TestManager(unittest.TestCase):
name='foo', name='foo',
parent='bar', parent='bar',
maximum_reuse=1000, maximum_reuse=1000,
password='password', provider=dict(
server='localhost', server='localhost',
password='password',
user='admin' user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(

View file

@ -103,9 +103,11 @@ class TestManager(unittest.TestCase):
name='foo', name='foo',
match_across_virtuals='yes', match_across_virtuals='yes',
parent='bar', parent='bar',
password='password', provider=dict(
server='localhost', server='localhost',
password='password',
user='admin' user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(

View file

@ -107,9 +107,11 @@ class TestManager(unittest.TestCase):
name='foo', name='foo',
match_across_virtuals='yes', match_across_virtuals='yes',
parent='bar', parent='bar',
password='password', provider=dict(
server='localhost', server='localhost',
password='password',
user='admin' user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(

View file

@ -94,14 +94,17 @@ class TestManager(unittest.TestCase):
set_module_args(dict( set_module_args(dict(
name='foo', name='foo',
server_name='foo.bar.com', server_name='foo.bar.com',
password='password', provider=dict(
server='localhost', server='localhost',
password='password',
user='admin' 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_together=self.spec.required_together
) )
mm = ModuleManager(module=module) mm = ModuleManager(module=module)

View file

@ -95,9 +95,11 @@ class TestManager(unittest.TestCase):
name='foo', name='foo',
parent='bar', parent='bar',
idle_timeout=500, idle_timeout=500,
password='password', provider=dict(
server='localhost', server='localhost',
password='password',
user='admin' user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(

View file

@ -98,9 +98,11 @@ class TestManager(unittest.TestCase):
parent='bar', parent='bar',
idle_timeout=500, idle_timeout=500,
datagram_load_balancing=True, datagram_load_balancing=True,
password='password', provider=dict(
server='localhost', server='localhost',
password='password',
user='admin' user='admin'
)
)) ))
module = AnsibleModule( module = AnsibleModule(

View file

@ -66,9 +66,6 @@ class TestParameters(unittest.TestCase):
def test_module_parameters(self): def test_module_parameters(self):
args = dict( args = dict(
module='gtm', module='gtm',
password='password',
server='localhost',
user='admin'
) )
p = Parameters(params=args) p = Parameters(params=args)
assert p.module == 'gtm' assert p.module == 'gtm'
@ -88,9 +85,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(
module='gtm', module='gtm',
password='password', provider=dict(
server='localhost', server='localhost',
password='password',
user='admin' user='admin'
)
)) ))
# Configure the parameters that would be returned by querying the # Configure the parameters that would be returned by querying the
@ -103,7 +102,8 @@ class TestManager(unittest.TestCase):
) )
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
) )
mm = ModuleManager(module=module) mm = ModuleManager(module=module)
@ -133,14 +133,17 @@ 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(
module=module, module=module,
password='password', provider=dict(
server='localhost', server='localhost',
password='password',
user='admin' user='admin'
)
)) ))
with patch('ansible.module_utils.basic.AnsibleModule.fail_json') as mo: with patch('ansible.module_utils.basic.AnsibleModule.fail_json') as mo:
AnsibleModule( 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
) )
mo.assert_not_called() mo.assert_not_called()