Add time_wait_recyle param to bigip_profile_tcp (#44543)

Allows for configuring the time-wait-recycle setting on a tcp profile
pull/44547/head
Tim Rupp 6 years ago committed by GitHub
parent fff5fb2077
commit 27059a859e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -17,7 +17,7 @@ DOCUMENTATION = r'''
module: bigip_profile_tcp module: bigip_profile_tcp
short_description: Manage TCP profiles on a BIG-IP short_description: Manage TCP profiles on a BIG-IP
description: description:
- Manage TCP profiles on a BIG-IP. There are a variety of TCP profiles, each with their - Manage TCP profiles on a BIG-IP. Many TCP profiles; each with their
own adjustments to the standard C(tcp) profile. Users of this module should be aware own adjustments to the standard C(tcp) profile. Users of this module should be aware
that many of the adjustable knobs have no module default. Instead, the default is that many of the adjustable knobs have no module default. Instead, the default is
assigned by the BIG-IP system itself which, in most cases, is acceptable. assigned by the BIG-IP system itself which, in most cases, is acceptable.
@ -43,6 +43,15 @@ 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.
time_wait_recycle:
description:
- Specifies that connections in a TIME-WAIT state are reused, if a SYN packet,
indicating a request for a new connection, is received.
- When C(no), connections in a TIME-WAIT state remain unused for a specified length of time.
- When creating a new profile, if this parameter is not specified, the default
is provided by the parent profile.
type: bool
version_added: 2.7
partition: partition:
description: description:
- Device partition to manage resources on. - Device partition to manage resources on.
@ -58,6 +67,7 @@ options:
extends_documentation_fragment: f5 extends_documentation_fragment: f5
author: author:
- Tim Rupp (@caphrim007) - Tim Rupp (@caphrim007)
- Wojciech Wypior (@wojtek0806)
''' '''
EXAMPLES = r''' EXAMPLES = r'''
@ -65,6 +75,7 @@ EXAMPLES = r'''
bigip_profile_tcp: bigip_profile_tcp:
name: foo name: foo
parent: f5-tcp-progressive parent: f5-tcp-progressive
time_wait_recycle: no
idle_timeout: 300 idle_timeout: 300
password: secret password: secret
server: lb.mydomain.com server: lb.mydomain.com
@ -84,6 +95,11 @@ idle_timeout:
returned: changed returned: changed
type: int type: int
sample: 100 sample: 100
time_wait_recycle:
description: Reuse connections in TIME-WAIT state
returned: changed
type: bool
sample: yes
''' '''
from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import AnsibleModule
@ -97,6 +113,7 @@ try:
from library.module_utils.network.f5.common import cleanup_tokens 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 ansible.module_utils.network.f5.common import flatten_boolean
try: try:
from library.module_utils.network.f5.common import iControlUnexpectedHTTPError from library.module_utils.network.f5.common import iControlUnexpectedHTTPError
except ImportError: except ImportError:
@ -109,6 +126,7 @@ except ImportError:
from ansible.module_utils.network.f5.common import cleanup_tokens 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
try: try:
from ansible.module_utils.network.f5.common import iControlUnexpectedHTTPError from ansible.module_utils.network.f5.common import iControlUnexpectedHTTPError
except ImportError: except ImportError:
@ -118,22 +136,27 @@ except ImportError:
class Parameters(AnsibleF5Parameters): class Parameters(AnsibleF5Parameters):
api_map = { api_map = {
'idleTimeout': 'idle_timeout', 'idleTimeout': 'idle_timeout',
'defaultsFrom': 'parent' 'defaultsFrom': 'parent',
'timeWaitRecycle': 'time_wait_recycle'
} }
api_attributes = [ api_attributes = [
'idleTimeout', 'idleTimeout',
'defaultsFrom' 'defaultsFrom',
'timeWaitRecycle'
] ]
returnables = [ returnables = [
'idle_timeout', 'idle_timeout',
'parent' 'parent',
'time_wait_recycle'
] ]
updatables = [ updatables = [
'idle_timeout', 'idle_timeout',
'parent' 'parent',
'time_wait_recycle'
] ]
@ -157,6 +180,15 @@ class ModuleParameters(Parameters):
return 4294967295 return 4294967295
return int(self._values['idle_timeout']) return int(self._values['idle_timeout'])
@property
def time_wait_recycle(self):
result = flatten_boolean(self._values['time_wait_recycle'])
if result is None:
return None
if result == 'yes':
return 'enabled'
return 'disabled'
class Changes(Parameters): class Changes(Parameters):
def to_return(self): def to_return(self):
@ -191,6 +223,14 @@ class ReportableChanges(Changes):
return 'indefinite' return 'indefinite'
return int(self._values['idle_timeout']) return int(self._values['idle_timeout'])
@property
def time_wait_recycle(self):
if self._values['time_wait_recycle'] is None:
return None
elif self._values['time_wait_recycle'] == 'enabled':
return 'yes'
return 'no'
class Difference(object): class Difference(object):
def __init__(self, want, have=None): def __init__(self, want, have=None):
@ -370,6 +410,7 @@ class ArgumentSpec(object):
default='present', default='present',
choices=['present', 'absent'] choices=['present', 'absent']
), ),
time_wait_recycle=dict(type='bool'),
partition=dict( partition=dict(
default='Common', default='Common',
fallback=(env_fallback, ['F5_PARTITION']) fallback=(env_fallback, ['F5_PARTITION'])

Loading…
Cancel
Save