mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 05:10:22 -07:00
Adds provider connection for bigip_facts (#44785)
This is needed because this module will be deprecated and removed *after* the args connection method is removed.
This commit is contained in:
parent
c19a4932eb
commit
47633b8d82
1 changed files with 34 additions and 22 deletions
|
@ -93,9 +93,11 @@ from ansible.module_utils.six.moves import map, zip
|
||||||
try:
|
try:
|
||||||
from library.module_utils.network.f5.legacy import bigip_api, bigsuds_found
|
from library.module_utils.network.f5.legacy import bigip_api, bigsuds_found
|
||||||
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 F5BaseClient
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from ansible.module_utils.network.f5.legacy import bigip_api, bigsuds_found
|
from ansible.module_utils.network.f5.legacy import bigip_api, bigsuds_found
|
||||||
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 F5BaseClient
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from suds import MethodNotFound, WebFault
|
from suds import MethodNotFound, WebFault
|
||||||
|
@ -1652,36 +1654,46 @@ def generate_provision_dict(f5):
|
||||||
return generate_simple_dict(provisioned, fields)
|
return generate_simple_dict(provisioned, fields)
|
||||||
|
|
||||||
|
|
||||||
|
class ArgumentSpec(object):
|
||||||
|
def __init__(self):
|
||||||
|
self.supports_check_mode = False
|
||||||
|
argument_spec = dict(
|
||||||
|
session=dict(type='bool', default='no'),
|
||||||
|
include=dict(
|
||||||
|
type='raw',
|
||||||
|
required=True,
|
||||||
|
choices=[
|
||||||
|
'address_class', 'certificate', 'client_ssl_profile', 'device',
|
||||||
|
'device_group', 'interface', 'key', 'node', 'pool', 'provision',
|
||||||
|
'rule', 'self_ip', 'software', 'system_info', 'traffic_group',
|
||||||
|
'trunk', 'virtual_address', 'virtual_server', 'vlan'
|
||||||
|
]
|
||||||
|
),
|
||||||
|
filter=dict(type='str'),
|
||||||
|
)
|
||||||
|
self.argument_spec = {}
|
||||||
|
self.argument_spec.update(f5_argument_spec)
|
||||||
|
self.argument_spec.update(argument_spec)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
argument_spec = f5_argument_spec
|
spec = ArgumentSpec()
|
||||||
meta_args = dict(
|
|
||||||
session=dict(type='bool', default='no'),
|
|
||||||
include=dict(
|
|
||||||
type='raw',
|
|
||||||
required=True,
|
|
||||||
choices=[
|
|
||||||
'address_class', 'certificate', 'client_ssl_profile', 'device',
|
|
||||||
'device_group', 'interface', 'key', 'node', 'pool', 'provision',
|
|
||||||
'rule', 'self_ip', 'software', 'system_info', 'traffic_group',
|
|
||||||
'trunk', 'virtual_address', 'virtual_server', 'vlan'
|
|
||||||
]
|
|
||||||
),
|
|
||||||
filter=dict(type='str'),
|
|
||||||
)
|
|
||||||
argument_spec.update(meta_args)
|
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=argument_spec
|
argument_spec=spec.argument_spec
|
||||||
)
|
)
|
||||||
|
client = F5BaseClient(**module.params)
|
||||||
|
provider = client.merge_provider_params()
|
||||||
|
|
||||||
if not bigsuds_found:
|
if not bigsuds_found:
|
||||||
module.fail_json(msg="the python suds and bigsuds modules are required")
|
module.fail_json(msg="the python suds and bigsuds modules are required")
|
||||||
|
|
||||||
server = module.params['server']
|
server = provider['server']
|
||||||
server_port = module.params['server_port']
|
server_port = provider['server_port']
|
||||||
user = module.params['user']
|
user = provider['user']
|
||||||
password = module.params['password']
|
password = provider['password']
|
||||||
validate_certs = module.params['validate_certs']
|
validate_certs = provider['validate_certs']
|
||||||
|
|
||||||
session = module.params['session']
|
session = module.params['session']
|
||||||
fact_filter = module.params['filter']
|
fact_filter = module.params['filter']
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue