mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Various bigiq fixes (#44487)
Fixes usage of the RestClient class. Documentation fixes. Removal of dependency code.
This commit is contained in:
parent
d39a711aa1
commit
07a011cd6f
11 changed files with 68 additions and 112 deletions
|
@ -186,6 +186,7 @@ try:
|
||||||
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 exit_json
|
||||||
from library.module_utils.network.f5.common import fail_json
|
from library.module_utils.network.f5.common import fail_json
|
||||||
|
from library.module_utils.network.f5.ipaddress import is_valid_ip
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from ansible.module_utils.network.f5.bigiq import F5RestClient
|
from ansible.module_utils.network.f5.bigiq import F5RestClient
|
||||||
from ansible.module_utils.network.f5.common import F5ModuleError
|
from ansible.module_utils.network.f5.common import F5ModuleError
|
||||||
|
@ -193,12 +194,7 @@ except ImportError:
|
||||||
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 exit_json
|
||||||
from ansible.module_utils.network.f5.common import fail_json
|
from ansible.module_utils.network.f5.common import fail_json
|
||||||
|
from ansible.module_utils.network.f5.ipaddress import is_valid_ip
|
||||||
try:
|
|
||||||
import netaddr
|
|
||||||
HAS_NETADDR = True
|
|
||||||
except ImportError:
|
|
||||||
HAS_NETADDR = False
|
|
||||||
|
|
||||||
|
|
||||||
class Parameters(AnsibleF5Parameters):
|
class Parameters(AnsibleF5Parameters):
|
||||||
|
@ -275,11 +271,10 @@ class ModuleParameters(Parameters):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def default_device_reference(self):
|
def default_device_reference(self):
|
||||||
try:
|
if is_valid_ip(self.service_environment):
|
||||||
# An IP address was specified
|
# An IP address was specified
|
||||||
netaddr.IPAddress(self.service_environment)
|
|
||||||
filter = "address+eq+'{0}'".format(self.service_environment)
|
filter = "address+eq+'{0}'".format(self.service_environment)
|
||||||
except netaddr.core.AddrFormatError:
|
else:
|
||||||
# Assume a hostname was specified
|
# Assume a hostname was specified
|
||||||
filter = "hostname+eq+'{0}'".format(self.service_environment)
|
filter = "hostname+eq+'{0}'".format(self.service_environment)
|
||||||
|
|
||||||
|
@ -731,11 +726,9 @@ def main():
|
||||||
argument_spec=spec.argument_spec,
|
argument_spec=spec.argument_spec,
|
||||||
supports_check_mode=spec.supports_check_mode
|
supports_check_mode=spec.supports_check_mode
|
||||||
)
|
)
|
||||||
if not HAS_NETADDR:
|
|
||||||
module.fail_json(msg="The python netaddr module is required")
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
client = F5RestClient(module=module)
|
client = F5RestClient(**module.params)
|
||||||
mm = ModuleManager(module=module, client=client)
|
mm = ModuleManager(module=module, client=client)
|
||||||
results = mm.exec_module()
|
results = mm.exec_module()
|
||||||
exit_json(module, results, client)
|
exit_json(module, results, client)
|
||||||
|
|
|
@ -117,7 +117,7 @@ EXAMPLES = r'''
|
||||||
port: 8080
|
port: 8080
|
||||||
- address: 5.6.7.8
|
- address: 5.6.7.8
|
||||||
port: 8080
|
port: 8080
|
||||||
load_balancer:
|
inbound_virtual:
|
||||||
name: foo
|
name: foo
|
||||||
destination: 2.2.2.2
|
destination: 2.2.2.2
|
||||||
netmask: 255.255.255.255
|
netmask: 255.255.255.255
|
||||||
|
@ -174,6 +174,8 @@ servers:
|
||||||
sample: hash/dictionary of values
|
sample: hash/dictionary of values
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
import time
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.basic import env_fallback
|
from ansible.module_utils.basic import env_fallback
|
||||||
|
|
||||||
|
@ -184,6 +186,7 @@ try:
|
||||||
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 exit_json
|
||||||
from library.module_utils.network.f5.common import fail_json
|
from library.module_utils.network.f5.common import fail_json
|
||||||
|
from library.module_utils.network.f5.ipaddress import is_valid_ip
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from ansible.module_utils.network.f5.bigiq import F5RestClient
|
from ansible.module_utils.network.f5.bigiq import F5RestClient
|
||||||
from ansible.module_utils.network.f5.common import F5ModuleError
|
from ansible.module_utils.network.f5.common import F5ModuleError
|
||||||
|
@ -191,15 +194,7 @@ except ImportError:
|
||||||
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 exit_json
|
||||||
from ansible.module_utils.network.f5.common import fail_json
|
from ansible.module_utils.network.f5.common import fail_json
|
||||||
|
from ansible.module_utils.network.f5.ipaddress import is_valid_ip
|
||||||
try:
|
|
||||||
import netaddr
|
|
||||||
HAS_NETADDR = True
|
|
||||||
except ImportError:
|
|
||||||
HAS_NETADDR = False
|
|
||||||
|
|
||||||
|
|
||||||
import time
|
|
||||||
|
|
||||||
|
|
||||||
class Parameters(AnsibleF5Parameters):
|
class Parameters(AnsibleF5Parameters):
|
||||||
|
@ -274,11 +269,10 @@ class ModuleParameters(Parameters):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def default_device_reference(self):
|
def default_device_reference(self):
|
||||||
try:
|
if is_valid_ip(self.service_environment):
|
||||||
# An IP address was specified
|
# An IP address was specified
|
||||||
netaddr.IPAddress(self.service_environment)
|
|
||||||
filter = "address+eq+'{0}'".format(self.service_environment)
|
filter = "address+eq+'{0}'".format(self.service_environment)
|
||||||
except netaddr.core.AddrFormatError:
|
else:
|
||||||
# Assume a hostname was specified
|
# Assume a hostname was specified
|
||||||
filter = "hostname+eq+'{0}'".format(self.service_environment)
|
filter = "hostname+eq+'{0}'".format(self.service_environment)
|
||||||
|
|
||||||
|
@ -338,7 +332,7 @@ class UsableChanges(Changes):
|
||||||
name='virtual',
|
name='virtual',
|
||||||
destinationAddress=self.inbound_virtual['address'],
|
destinationAddress=self.inbound_virtual['address'],
|
||||||
mask=self.inbound_virtual['netmask'],
|
mask=self.inbound_virtual['netmask'],
|
||||||
destinationPort=self.inbound_virtual['port']
|
destinationPort=self.inbound_virtual.get('port', 8080)
|
||||||
),
|
),
|
||||||
subcollectionResources=self.profiles
|
subcollectionResources=self.profiles
|
||||||
)
|
)
|
||||||
|
@ -376,7 +370,7 @@ class UsableChanges(Changes):
|
||||||
for x in self.servers:
|
for x in self.servers:
|
||||||
member = dict(
|
member = dict(
|
||||||
parameters=dict(
|
parameters=dict(
|
||||||
port=x['port'],
|
port=x.get('port', 8000),
|
||||||
nodeReference=dict(
|
nodeReference=dict(
|
||||||
link='#/resources/ltm:node:3e91bd30bbfb/{0}'.format(x['address']),
|
link='#/resources/ltm:node:3e91bd30bbfb/{0}'.format(x['address']),
|
||||||
fullPath='# {0}'.format(x['address'])
|
fullPath='# {0}'.format(x['address'])
|
||||||
|
@ -678,11 +672,9 @@ def main():
|
||||||
argument_spec=spec.argument_spec,
|
argument_spec=spec.argument_spec,
|
||||||
supports_check_mode=spec.supports_check_mode
|
supports_check_mode=spec.supports_check_mode
|
||||||
)
|
)
|
||||||
if not HAS_NETADDR:
|
|
||||||
module.fail_json(msg="The python netaddr module is required")
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
client = F5RestClient(module=module)
|
client = F5RestClient(**module.params)
|
||||||
mm = ModuleManager(module=module, client=client)
|
mm = ModuleManager(module=module, client=client)
|
||||||
results = mm.exec_module()
|
results = mm.exec_module()
|
||||||
exit_json(module, results, client)
|
exit_json(module, results, client)
|
||||||
|
|
|
@ -117,7 +117,7 @@ EXAMPLES = r'''
|
||||||
port: 8080
|
port: 8080
|
||||||
- address: 5.6.7.8
|
- address: 5.6.7.8
|
||||||
port: 8080
|
port: 8080
|
||||||
load_balancer:
|
inbound_virtual:
|
||||||
name: foo
|
name: foo
|
||||||
destination: 2.2.2.2
|
destination: 2.2.2.2
|
||||||
netmask: 255.255.255.255
|
netmask: 255.255.255.255
|
||||||
|
@ -174,6 +174,8 @@ servers:
|
||||||
sample: hash/dictionary of values
|
sample: hash/dictionary of values
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
import time
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.basic import env_fallback
|
from ansible.module_utils.basic import env_fallback
|
||||||
|
|
||||||
|
@ -184,6 +186,7 @@ try:
|
||||||
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 exit_json
|
||||||
from library.module_utils.network.f5.common import fail_json
|
from library.module_utils.network.f5.common import fail_json
|
||||||
|
from library.module_utils.network.f5.ipaddress import is_valid_ip
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from ansible.module_utils.network.f5.bigiq import F5RestClient
|
from ansible.module_utils.network.f5.bigiq import F5RestClient
|
||||||
from ansible.module_utils.network.f5.common import F5ModuleError
|
from ansible.module_utils.network.f5.common import F5ModuleError
|
||||||
|
@ -191,15 +194,7 @@ except ImportError:
|
||||||
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 exit_json
|
||||||
from ansible.module_utils.network.f5.common import fail_json
|
from ansible.module_utils.network.f5.common import fail_json
|
||||||
|
from ansible.module_utils.network.f5.ipaddress import is_valid_ip
|
||||||
try:
|
|
||||||
import netaddr
|
|
||||||
HAS_NETADDR = True
|
|
||||||
except ImportError:
|
|
||||||
HAS_NETADDR = False
|
|
||||||
|
|
||||||
|
|
||||||
import time
|
|
||||||
|
|
||||||
|
|
||||||
class Parameters(AnsibleF5Parameters):
|
class Parameters(AnsibleF5Parameters):
|
||||||
|
@ -274,11 +269,10 @@ class ModuleParameters(Parameters):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def default_device_reference(self):
|
def default_device_reference(self):
|
||||||
try:
|
if is_valid_ip(self.service_environment):
|
||||||
# An IP address was specified
|
# An IP address was specified
|
||||||
netaddr.IPAddress(self.service_environment)
|
|
||||||
filter = "address+eq+'{0}'".format(self.service_environment)
|
filter = "address+eq+'{0}'".format(self.service_environment)
|
||||||
except netaddr.core.AddrFormatError:
|
else:
|
||||||
# Assume a hostname was specified
|
# Assume a hostname was specified
|
||||||
filter = "hostname+eq+'{0}'".format(self.service_environment)
|
filter = "hostname+eq+'{0}'".format(self.service_environment)
|
||||||
|
|
||||||
|
@ -338,7 +332,7 @@ class UsableChanges(Changes):
|
||||||
name='virtual',
|
name='virtual',
|
||||||
destinationAddress=self.inbound_virtual['address'],
|
destinationAddress=self.inbound_virtual['address'],
|
||||||
mask=self.inbound_virtual['netmask'],
|
mask=self.inbound_virtual['netmask'],
|
||||||
destinationPort=self.inbound_virtual['port']
|
destinationPort=self.inbound_virtual.get('port', 53)
|
||||||
),
|
),
|
||||||
subcollectionResources=self.profiles
|
subcollectionResources=self.profiles
|
||||||
)
|
)
|
||||||
|
@ -376,7 +370,7 @@ class UsableChanges(Changes):
|
||||||
for x in self.servers:
|
for x in self.servers:
|
||||||
member = dict(
|
member = dict(
|
||||||
parameters=dict(
|
parameters=dict(
|
||||||
port=x['port'],
|
port=x.get('port', 8000),
|
||||||
nodeReference=dict(
|
nodeReference=dict(
|
||||||
link='#/resources/ltm:node:b19842fe713a/{0}'.format(x['address']),
|
link='#/resources/ltm:node:b19842fe713a/{0}'.format(x['address']),
|
||||||
fullPath='# {0}'.format(x['address'])
|
fullPath='# {0}'.format(x['address'])
|
||||||
|
@ -678,11 +672,9 @@ def main():
|
||||||
argument_spec=spec.argument_spec,
|
argument_spec=spec.argument_spec,
|
||||||
supports_check_mode=spec.supports_check_mode
|
supports_check_mode=spec.supports_check_mode
|
||||||
)
|
)
|
||||||
if not HAS_NETADDR:
|
|
||||||
module.fail_json(msg="The python netaddr module is required")
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
client = F5RestClient(module=module)
|
client = F5RestClient(**module.params)
|
||||||
mm = ModuleManager(module=module, client=client)
|
mm = ModuleManager(module=module, client=client)
|
||||||
results = mm.exec_module()
|
results = mm.exec_module()
|
||||||
exit_json(module, results, client)
|
exit_json(module, results, client)
|
||||||
|
|
|
@ -186,6 +186,7 @@ try:
|
||||||
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 exit_json
|
||||||
from library.module_utils.network.f5.common import fail_json
|
from library.module_utils.network.f5.common import fail_json
|
||||||
|
from library.module_utils.network.f5.ipaddress import is_valid_ip
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from ansible.module_utils.network.f5.bigiq import F5RestClient
|
from ansible.module_utils.network.f5.bigiq import F5RestClient
|
||||||
from ansible.module_utils.network.f5.common import F5ModuleError
|
from ansible.module_utils.network.f5.common import F5ModuleError
|
||||||
|
@ -193,12 +194,7 @@ except ImportError:
|
||||||
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 exit_json
|
||||||
from ansible.module_utils.network.f5.common import fail_json
|
from ansible.module_utils.network.f5.common import fail_json
|
||||||
|
from ansible.module_utils.network.f5.ipaddress import is_valid_ip
|
||||||
try:
|
|
||||||
import netaddr
|
|
||||||
HAS_NETADDR = True
|
|
||||||
except ImportError:
|
|
||||||
HAS_NETADDR = False
|
|
||||||
|
|
||||||
|
|
||||||
class Parameters(AnsibleF5Parameters):
|
class Parameters(AnsibleF5Parameters):
|
||||||
|
@ -275,11 +271,9 @@ class ModuleParameters(Parameters):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def default_device_reference(self):
|
def default_device_reference(self):
|
||||||
try:
|
if is_valid_ip(self.service_environment):
|
||||||
# An IP address was specified
|
|
||||||
netaddr.IPAddress(self.service_environment)
|
|
||||||
filter = "address+eq+'{0}'".format(self.service_environment)
|
filter = "address+eq+'{0}'".format(self.service_environment)
|
||||||
except netaddr.core.AddrFormatError:
|
else:
|
||||||
# Assume a hostname was specified
|
# Assume a hostname was specified
|
||||||
filter = "hostname+eq+'{0}'".format(self.service_environment)
|
filter = "hostname+eq+'{0}'".format(self.service_environment)
|
||||||
|
|
||||||
|
@ -363,7 +357,7 @@ class UsableChanges(Changes):
|
||||||
name='virtual',
|
name='virtual',
|
||||||
destinationAddress=self.inbound_virtual['address'],
|
destinationAddress=self.inbound_virtual['address'],
|
||||||
mask=self.inbound_virtual['netmask'],
|
mask=self.inbound_virtual['netmask'],
|
||||||
destinationPort=self.inbound_virtual['port']
|
destinationPort=self.inbound_virtual.get('port', 80)
|
||||||
),
|
),
|
||||||
subcollectionResources=self.profiles
|
subcollectionResources=self.profiles
|
||||||
)
|
)
|
||||||
|
@ -406,7 +400,7 @@ class UsableChanges(Changes):
|
||||||
for x in self.servers:
|
for x in self.servers:
|
||||||
member = dict(
|
member = dict(
|
||||||
parameters=dict(
|
parameters=dict(
|
||||||
port=x['port'],
|
port=x.get('port', 80),
|
||||||
nodeReference=dict(
|
nodeReference=dict(
|
||||||
link='#/resources/ltm:node:9e76a6323321/{0}'.format(x['address']),
|
link='#/resources/ltm:node:9e76a6323321/{0}'.format(x['address']),
|
||||||
fullPath='# {0}'.format(x['address'])
|
fullPath='# {0}'.format(x['address'])
|
||||||
|
@ -731,11 +725,9 @@ def main():
|
||||||
argument_spec=spec.argument_spec,
|
argument_spec=spec.argument_spec,
|
||||||
supports_check_mode=spec.supports_check_mode
|
supports_check_mode=spec.supports_check_mode
|
||||||
)
|
)
|
||||||
if not HAS_NETADDR:
|
|
||||||
module.fail_json(msg="The python netaddr module is required")
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
client = F5RestClient(module=module)
|
client = F5RestClient(**module.params)
|
||||||
mm = ModuleManager(module=module, client=client)
|
mm = ModuleManager(module=module, client=client)
|
||||||
results = mm.exec_module()
|
results = mm.exec_module()
|
||||||
exit_json(module, results, client)
|
exit_json(module, results, client)
|
||||||
|
|
|
@ -107,8 +107,7 @@ options:
|
||||||
per profile.
|
per profile.
|
||||||
- If you attempt to assign two RSA, DSA, or ECDSA certificate/key combo,
|
- If you attempt to assign two RSA, DSA, or ECDSA certificate/key combo,
|
||||||
the device will reject this.
|
the device will reject this.
|
||||||
- This list is a complex list that specifies a number of keys. There are
|
- This list is a complex list that specifies a number of keys.
|
||||||
several supported keys.
|
|
||||||
- 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 value of C(inherit) will be used.
|
default value of C(inherit) will be used.
|
||||||
suboptions:
|
suboptions:
|
||||||
|
@ -245,6 +244,7 @@ try:
|
||||||
from library.module_utils.network.f5.common import exit_json
|
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 fail_json
|
||||||
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.ipaddress import is_valid_ip
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from ansible.module_utils.network.f5.bigiq import F5RestClient
|
from ansible.module_utils.network.f5.bigiq import F5RestClient
|
||||||
from ansible.module_utils.network.f5.common import F5ModuleError
|
from ansible.module_utils.network.f5.common import F5ModuleError
|
||||||
|
@ -253,12 +253,7 @@ except ImportError:
|
||||||
from ansible.module_utils.network.f5.common import exit_json
|
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 fail_json
|
||||||
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.ipaddress import is_valid_ip
|
||||||
try:
|
|
||||||
import netaddr
|
|
||||||
HAS_NETADDR = True
|
|
||||||
except ImportError:
|
|
||||||
HAS_NETADDR = False
|
|
||||||
|
|
||||||
|
|
||||||
class Parameters(AnsibleF5Parameters):
|
class Parameters(AnsibleF5Parameters):
|
||||||
|
@ -335,11 +330,10 @@ class ModuleParameters(Parameters):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def default_device_reference(self):
|
def default_device_reference(self):
|
||||||
try:
|
if is_valid_ip(self.service_environment):
|
||||||
# An IP address was specified
|
# An IP address was specified
|
||||||
netaddr.IPAddress(self.service_environment)
|
|
||||||
filter = "address+eq+'{0}'".format(self.service_environment)
|
filter = "address+eq+'{0}'".format(self.service_environment)
|
||||||
except netaddr.core.AddrFormatError:
|
else:
|
||||||
# Assume a hostname was specified
|
# Assume a hostname was specified
|
||||||
filter = "hostname+eq+'{0}'".format(self.service_environment)
|
filter = "hostname+eq+'{0}'".format(self.service_environment)
|
||||||
|
|
||||||
|
@ -974,11 +968,9 @@ def main():
|
||||||
argument_spec=spec.argument_spec,
|
argument_spec=spec.argument_spec,
|
||||||
supports_check_mode=spec.supports_check_mode
|
supports_check_mode=spec.supports_check_mode
|
||||||
)
|
)
|
||||||
if not HAS_NETADDR:
|
|
||||||
module.fail_json(msg="The python netaddr module is required")
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
client = F5RestClient(module=module)
|
client = F5RestClient(**module.params)
|
||||||
mm = ModuleManager(module=module, client=client)
|
mm = ModuleManager(module=module, client=client)
|
||||||
results = mm.exec_module()
|
results = mm.exec_module()
|
||||||
exit_json(module, results, client)
|
exit_json(module, results, client)
|
||||||
|
|
|
@ -107,8 +107,7 @@ options:
|
||||||
per profile.
|
per profile.
|
||||||
- If you attempt to assign two RSA, DSA, or ECDSA certificate/key combo,
|
- If you attempt to assign two RSA, DSA, or ECDSA certificate/key combo,
|
||||||
the device will reject this.
|
the device will reject this.
|
||||||
- This list is a complex list that specifies a number of keys. There are
|
- This list is a complex list that specifies a number of keys.
|
||||||
several supported keys.
|
|
||||||
- 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 value of C(inherit) will be used.
|
default value of C(inherit) will be used.
|
||||||
suboptions:
|
suboptions:
|
||||||
|
@ -250,6 +249,7 @@ try:
|
||||||
from library.module_utils.network.f5.common import exit_json
|
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 fail_json
|
||||||
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.ipaddress import is_valid_ip
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from ansible.module_utils.network.f5.bigiq import F5RestClient
|
from ansible.module_utils.network.f5.bigiq import F5RestClient
|
||||||
from ansible.module_utils.network.f5.common import F5ModuleError
|
from ansible.module_utils.network.f5.common import F5ModuleError
|
||||||
|
@ -258,12 +258,7 @@ except ImportError:
|
||||||
from ansible.module_utils.network.f5.common import exit_json
|
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 fail_json
|
||||||
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.ipaddress import is_valid_ip
|
||||||
try:
|
|
||||||
import netaddr
|
|
||||||
HAS_NETADDR = True
|
|
||||||
except ImportError:
|
|
||||||
HAS_NETADDR = False
|
|
||||||
|
|
||||||
|
|
||||||
class Parameters(AnsibleF5Parameters):
|
class Parameters(AnsibleF5Parameters):
|
||||||
|
@ -341,11 +336,10 @@ class ModuleParameters(Parameters):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def default_device_reference(self):
|
def default_device_reference(self):
|
||||||
try:
|
if is_valid_ip(self.service_environment):
|
||||||
# An IP address was specified
|
# An IP address was specified
|
||||||
netaddr.IPAddress(self.service_environment)
|
|
||||||
filter = "address+eq+'{0}'".format(self.service_environment)
|
filter = "address+eq+'{0}'".format(self.service_environment)
|
||||||
except netaddr.core.AddrFormatError:
|
else:
|
||||||
# Assume a hostname was specified
|
# Assume a hostname was specified
|
||||||
filter = "hostname+eq+'{0}'".format(self.service_environment)
|
filter = "hostname+eq+'{0}'".format(self.service_environment)
|
||||||
|
|
||||||
|
@ -999,11 +993,9 @@ def main():
|
||||||
argument_spec=spec.argument_spec,
|
argument_spec=spec.argument_spec,
|
||||||
supports_check_mode=spec.supports_check_mode
|
supports_check_mode=spec.supports_check_mode
|
||||||
)
|
)
|
||||||
if not HAS_NETADDR:
|
|
||||||
module.fail_json(msg="The python netaddr module is required")
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
client = F5RestClient(module=module)
|
client = F5RestClient(**module.params)
|
||||||
mm = ModuleManager(module=module, client=client)
|
mm = ModuleManager(module=module, client=client)
|
||||||
results = mm.exec_module()
|
results = mm.exec_module()
|
||||||
exit_json(module, results, client)
|
exit_json(module, results, client)
|
||||||
|
|
|
@ -15,7 +15,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||||
DOCUMENTATION = r'''
|
DOCUMENTATION = r'''
|
||||||
---
|
---
|
||||||
module: bigiq_regkey_license_assignment
|
module: bigiq_regkey_license_assignment
|
||||||
short_description: Manage regkey license assignment on BIG-IPs from a BIG-IQ.
|
short_description: Manage regkey license assignment on BIG-IPs from a BIG-IQ
|
||||||
description:
|
description:
|
||||||
- Manages the assignment of regkey licenses on a BIG-IQ. Assignment means that
|
- Manages the assignment of regkey licenses on a BIG-IQ. Assignment means that
|
||||||
the license is assigned to a BIG-IP, or, it needs to be assigned to a BIG-IP.
|
the license is assigned to a BIG-IP, or, it needs to be assigned to a BIG-IP.
|
||||||
|
@ -89,7 +89,7 @@ EXAMPLES = r'''
|
||||||
user: admin
|
user: admin
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
|
|
||||||
- name: Register an managed device, by name
|
- name: Register a managed device, by name
|
||||||
bigiq_regkey_license_assignment:
|
bigiq_regkey_license_assignment:
|
||||||
pool: my-regkey-pool
|
pool: my-regkey-pool
|
||||||
key: XXXX-XXXX-XXXX-XXXX-XXXX
|
key: XXXX-XXXX-XXXX-XXXX-XXXX
|
||||||
|
@ -101,7 +101,7 @@ EXAMPLES = r'''
|
||||||
user: admin
|
user: admin
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
|
|
||||||
- name: Register an managed device, by UUID
|
- name: Register a managed device, by UUID
|
||||||
bigiq_regkey_license_assignment:
|
bigiq_regkey_license_assignment:
|
||||||
pool: my-regkey-pool
|
pool: my-regkey-pool
|
||||||
key: XXXX-XXXX-XXXX-XXXX-XXXX
|
key: XXXX-XXXX-XXXX-XXXX-XXXX
|
||||||
|
@ -119,6 +119,7 @@ RETURN = r'''
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
import time
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
|
@ -129,6 +130,7 @@ try:
|
||||||
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 exit_json
|
||||||
from library.module_utils.network.f5.common import fail_json
|
from library.module_utils.network.f5.common import fail_json
|
||||||
|
from library.module_utils.network.f5.ipaddress import is_valid_ip
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from ansible.module_utils.network.f5.bigiq import F5RestClient
|
from ansible.module_utils.network.f5.bigiq import F5RestClient
|
||||||
from ansible.module_utils.network.f5.common import F5ModuleError
|
from ansible.module_utils.network.f5.common import F5ModuleError
|
||||||
|
@ -136,11 +138,7 @@ except ImportError:
|
||||||
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 exit_json
|
||||||
from ansible.module_utils.network.f5.common import fail_json
|
from ansible.module_utils.network.f5.common import fail_json
|
||||||
try:
|
from ansible.module_utils.network.f5.ipaddress import is_valid_ip
|
||||||
import netaddr
|
|
||||||
HAS_NETADDR = True
|
|
||||||
except ImportError:
|
|
||||||
HAS_NETADDR = False
|
|
||||||
|
|
||||||
|
|
||||||
class Parameters(AnsibleF5Parameters):
|
class Parameters(AnsibleF5Parameters):
|
||||||
|
@ -205,11 +203,9 @@ class ModuleParameters(Parameters):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_is_address(self):
|
def device_is_address(self):
|
||||||
try:
|
if is_valid_ip(self.device):
|
||||||
netaddr.IPAddress(self.device)
|
|
||||||
return True
|
return True
|
||||||
except (ValueError, netaddr.core.AddrFormatError):
|
return False
|
||||||
return False
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_is_id(self):
|
def device_is_id(self):
|
||||||
|
@ -484,6 +480,10 @@ class ModuleManager(object):
|
||||||
self.remove_from_device()
|
self.remove_from_device()
|
||||||
if self.exists():
|
if self.exists():
|
||||||
raise F5ModuleError("Failed to delete the resource.")
|
raise F5ModuleError("Failed to delete the resource.")
|
||||||
|
# Artificial sleeping to wait for remote licensing (on BIG-IP) to complete
|
||||||
|
#
|
||||||
|
# This should be something that BIG-IQ can do natively in 6.1-ish time.
|
||||||
|
time.sleep(60)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def create(self):
|
def create(self):
|
||||||
|
@ -505,6 +505,11 @@ class ModuleManager(object):
|
||||||
"Failed to license the remote device."
|
"Failed to license the remote device."
|
||||||
)
|
)
|
||||||
self.wait_for_device_to_be_licensed()
|
self.wait_for_device_to_be_licensed()
|
||||||
|
|
||||||
|
# Artificial sleeping to wait for remote licensing (on BIG-IP) to complete
|
||||||
|
#
|
||||||
|
# This should be something that BIG-IQ can do natively in 6.1-ish time.
|
||||||
|
time.sleep(60)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def create_on_device(self):
|
def create_on_device(self):
|
||||||
|
@ -530,7 +535,7 @@ class ModuleManager(object):
|
||||||
if 'message' in response:
|
if 'message' in response:
|
||||||
raise F5ModuleError(response['message'])
|
raise F5ModuleError(response['message'])
|
||||||
else:
|
else:
|
||||||
raise F5ModuleError(resp._content)
|
raise F5ModuleError(resp.content)
|
||||||
|
|
||||||
def wait_for_device_to_be_licensed(self):
|
def wait_for_device_to_be_licensed(self):
|
||||||
count = 0
|
count = 0
|
||||||
|
@ -552,7 +557,7 @@ class ModuleManager(object):
|
||||||
if 'message' in response:
|
if 'message' in response:
|
||||||
raise F5ModuleError(response['message'])
|
raise F5ModuleError(response['message'])
|
||||||
else:
|
else:
|
||||||
raise F5ModuleError(resp._content)
|
raise F5ModuleError(resp.content)
|
||||||
if response['status'] == 'LICENSED':
|
if response['status'] == 'LICENSED':
|
||||||
count += 1
|
count += 1
|
||||||
else:
|
else:
|
||||||
|
@ -611,11 +616,9 @@ def main():
|
||||||
supports_check_mode=spec.supports_check_mode,
|
supports_check_mode=spec.supports_check_mode,
|
||||||
required_if=spec.required_if
|
required_if=spec.required_if
|
||||||
)
|
)
|
||||||
if not HAS_NETADDR:
|
|
||||||
module.fail_json(msg="The python netaddr module is required")
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
client = F5RestClient(module=module)
|
client = F5RestClient(**module.params)
|
||||||
mm = ModuleManager(module=module, client=client)
|
mm = ModuleManager(module=module, client=client)
|
||||||
results = mm.exec_module()
|
results = mm.exec_module()
|
||||||
exit_json(module, results, client)
|
exit_json(module, results, client)
|
||||||
|
|
|
@ -449,7 +449,7 @@ def main():
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
client = F5RestClient(module=module)
|
client = F5RestClient(**module.params)
|
||||||
mm = ModuleManager(module=module, client=client)
|
mm = ModuleManager(module=module, client=client)
|
||||||
results = mm.exec_module()
|
results = mm.exec_module()
|
||||||
exit_json(module, results, client)
|
exit_json(module, results, client)
|
||||||
|
|
|
@ -100,7 +100,7 @@ class TestManager(unittest.TestCase):
|
||||||
license_key='XXXX-XXXX-XXXX-XXXX-XXXX',
|
license_key='XXXX-XXXX-XXXX-XXXX-XXXX',
|
||||||
accept_eula=True,
|
accept_eula=True,
|
||||||
description='this is a description',
|
description='this is a description',
|
||||||
password='passsword',
|
password='password',
|
||||||
server='localhost',
|
server='localhost',
|
||||||
user='admin'
|
user='admin'
|
||||||
))
|
))
|
||||||
|
|
|
@ -112,7 +112,7 @@ class TestManager(unittest.TestCase):
|
||||||
device_password='secret',
|
device_password='secret',
|
||||||
managed='no',
|
managed='no',
|
||||||
state='present',
|
state='present',
|
||||||
password='passsword',
|
password='password',
|
||||||
server='localhost',
|
server='localhost',
|
||||||
user='admin'
|
user='admin'
|
||||||
))
|
))
|
||||||
|
|
|
@ -86,7 +86,7 @@ class TestManager(unittest.TestCase):
|
||||||
set_module_args(dict(
|
set_module_args(dict(
|
||||||
license_key='XXXX-XXXX-XXXX-XXXX-XXXX',
|
license_key='XXXX-XXXX-XXXX-XXXX-XXXX',
|
||||||
accept_eula=True,
|
accept_eula=True,
|
||||||
password='passsword',
|
password='password',
|
||||||
server='localhost',
|
server='localhost',
|
||||||
user='admin'
|
user='admin'
|
||||||
))
|
))
|
||||||
|
|
Loading…
Reference in a new issue