Adds minor fixes and features to f5 modules (#39202)

* Add Mac_address parameter to bigip_traffic_group
* Fix docs
* Fix f5 conventions
This commit is contained in:
Tim Rupp 2018-04-23 18:57:43 -07:00 committed by GitHub
parent 0c96863ec6
commit e254121729
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 156 additions and 69 deletions

View file

@ -18,7 +18,7 @@ module: bigip_traffic_group
short_description: Manages traffic groups on BIG-IP
description:
- Supports managing traffic groups and their attributes on a BIG-IP.
version_added: "2.5"
version_added: 2.5
options:
name:
description:
@ -28,7 +28,6 @@ options:
description:
- Device partition to manage resources on.
default: Common
version_added: 2.5
state:
description:
- When C(present), ensures that the traffic group exists.
@ -37,7 +36,18 @@ options:
choices:
- present
- absent
version_added: 2.5
mac_address:
description:
- Specifies the floating Media Access Control (MAC) address associated with the floating IP addresses
defined for a traffic group.
- Primarily, a MAC masquerade address minimizes ARP communications or dropped packets as a result of failover.
- A MAC masquerade address ensures that any traffic destined for a specific traffic group reaches an available
device after failover, which happens because along with the traffic group, the MAC masquerade address floats
to the available device.
- Without a MAC masquerade address, the sending host must learn the MAC address for a newly-active device,
either by sending an ARP request or by relying on the gratuitous ARP from the newly-active device.
- To unset the MAC address, specify an empty value (C("")) to this parameter.
version_added: 2.6
extends_documentation_fragment: f5
author:
- Tim Rupp (@caphrim007)
@ -61,31 +71,26 @@ RETURN = r'''
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.basic import env_fallback
HAS_DEVEL_IMPORTS = False
try:
# Sideband repository used for dev
from library.module_utils.network.f5.bigip import HAS_F5SDK
from library.module_utils.network.f5.bigip import F5Client
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 cleanup_tokens
from library.module_utils.network.f5.common import fqdn_name
from library.module_utils.network.f5.common import f5_argument_spec
try:
from library.module_utils.network.f5.common import iControlUnexpectedHTTPError
except ImportError:
HAS_F5SDK = False
HAS_DEVEL_IMPORTS = True
except ImportError:
# Upstream Ansible
from ansible.module_utils.network.f5.bigip import HAS_F5SDK
from ansible.module_utils.network.f5.bigip import F5Client
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 cleanup_tokens
from ansible.module_utils.network.f5.common import fqdn_name
from ansible.module_utils.network.f5.common import f5_argument_spec
try:
from ansible.module_utils.network.f5.common import iControlUnexpectedHTTPError
except ImportError:
@ -94,19 +99,19 @@ except ImportError:
class Parameters(AnsibleF5Parameters):
api_map = {
'mac': 'mac_address'
}
api_attributes = [
'mac'
]
returnables = [
'mac_address'
]
updatables = [
'mac_address'
]
def to_return(self):
@ -120,6 +125,20 @@ class Parameters(AnsibleF5Parameters):
return result
class ApiParameters(Parameters):
pass
class ModuleParameters(Parameters):
@property
def mac_address(self):
if self._values['mac_address'] is None:
return None
if self._values['mac_address'] == '':
return 'none'
return self._values['mac_address']
class Changes(Parameters):
pass
@ -156,7 +175,7 @@ class ModuleManager(object):
def __init__(self, *args, **kwargs):
self.module = kwargs.get('module', None)
self.client = kwargs.get('client', None)
self.want = Parameters(params=self.module.params)
self.want = ModuleParameters(params=self.module.params)
self.changes = Changes()
def _set_changed_options(self):
@ -294,7 +313,7 @@ class ModuleManager(object):
partition=self.want.partition
)
result = resource.attrs
return Parameters(params=result)
return ApiParameters(params=result)
class ArgumentSpec(object):
@ -306,7 +325,8 @@ class ArgumentSpec(object):
partition=dict(
default='Common',
fallback=(env_fallback, ['F5_PARTITION'])
)
),
mac_address=dict()
)
self.argument_spec = {}
self.argument_spec.update(f5_argument_spec)

View file

@ -18,16 +18,14 @@ module: bigip_ucs
short_description: Manage upload, installation and removal of UCS files
description:
- Manage upload, installation and removal of UCS files.
version_added: "2.4"
version_added: 2.4
options:
include_chassis_level_config:
description:
- During restore of the UCS file, include chassis level configuration
that is shared among boot volume sets. For example, cluster default
configuration.
choices:
- yes
- no
type: bool
ucs:
description:
- The path to the UCS file to install. The parameter must be
@ -42,38 +40,29 @@ options:
device. If C(no), the file will only be uploaded if it does not already
exist. Generally should be C(yes) only in cases where you have reason
to believe that the image was corrupted during upload.
choices:
- yes
- no
type: bool
default: no
no_license:
description:
- Performs a full restore of the UCS file and all the files it contains,
with the exception of the license file. The option must be used to
restore a UCS on RMA devices (Returned Materials Authorization).
choices:
- yes
- no
type: bool
no_platform_check:
description:
- Bypasses the platform check and allows a UCS that was created using a
different platform to be installed. By default (without this option),
a UCS created from a different platform is not allowed to be installed.
choices:
- yes
- no
type: bool
passphrase:
description:
- Specifies the passphrase that is necessary to load the specified UCS file.
choices:
- yes
- no
type: bool
reset_trust:
description:
- When specified, the device and trust domain certs and keys are not
loaded from the UCS. Instead, a new set is regenerated.
choices:
- yes
- no
type: bool
state:
description:
- When C(installed), ensures that the UCS is uploaded and installed,
@ -184,30 +173,23 @@ from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.six import iteritems
from distutils.version import LooseVersion
HAS_DEVEL_IMPORTS = False
try:
# Sideband repository used for dev
from library.module_utils.network.f5.bigip import HAS_F5SDK
from library.module_utils.network.f5.bigip import F5Client
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 cleanup_tokens
from library.module_utils.network.f5.common import fqdn_name
from library.module_utils.network.f5.common import f5_argument_spec
try:
from library.module_utils.network.f5.common import iControlUnexpectedHTTPError
except ImportError:
HAS_F5SDK = False
HAS_DEVEL_IMPORTS = True
except ImportError:
# Upstream Ansible
from ansible.module_utils.network.f5.bigip import HAS_F5SDK
from ansible.module_utils.network.f5.bigip import F5Client
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 cleanup_tokens
from ansible.module_utils.network.f5.common import fqdn_name
from ansible.module_utils.network.f5.common import f5_argument_spec
try:
from ansible.module_utils.network.f5.common import iControlUnexpectedHTTPError

View file

@ -145,30 +145,23 @@ import tempfile
from ansible.module_utils.basic import AnsibleModule
from distutils.version import LooseVersion
HAS_DEVEL_IMPORTS = False
try:
# Sideband repository used for dev
from library.module_utils.network.f5.bigip import HAS_F5SDK
from library.module_utils.network.f5.bigip import F5Client
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 cleanup_tokens
from library.module_utils.network.f5.common import fqdn_name
from library.module_utils.network.f5.common import f5_argument_spec
try:
from library.module_utils.network.f5.common import iControlUnexpectedHTTPError
except ImportError:
HAS_F5SDK = False
HAS_DEVEL_IMPORTS = True
except ImportError:
# Upstream Ansible
from ansible.module_utils.network.f5.bigip import HAS_F5SDK
from ansible.module_utils.network.f5.bigip import F5Client
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 cleanup_tokens
from ansible.module_utils.network.f5.common import fqdn_name
from ansible.module_utils.network.f5.common import f5_argument_spec
try:
from ansible.module_utils.network.f5.common import iControlUnexpectedHTTPError