diff --git a/plugins/modules/baremetal_inspect.py b/plugins/modules/baremetal_inspect.py index 8e9c88e1..d85191d1 100644 --- a/plugins/modules/baremetal_inspect.py +++ b/plugins/modules/baremetal_inspect.py @@ -102,15 +102,21 @@ def main(): module = AnsibleModule(argument_spec, **module_kwargs) if ( - module.params['auth_type'] in [None, 'None'] + module.params['auth_type'] in [None, 'None', 'none'] and module.params['ironic_url'] is None + and not module.params['cloud'] + and not (module.params['auth'] + and module.params['auth'].get('endpoint')) ): module.fail_json(msg="Authentication appears to be disabled, " - "Please define an ironic_url parameter") + "Please define either ironic_url, or cloud, " + "or auth.endpoint") if ( module.params['ironic_url'] - and module.params['auth_type'] in [None, 'None'] + and module.params['auth_type'] in [None, 'None', 'none'] + and not (module.params['auth'] + and module.params['auth'].get('endpoint')) ): module.params['auth'] = dict( endpoint=module.params['ironic_url'] diff --git a/plugins/modules/baremetal_node.py b/plugins/modules/baremetal_node.py index d53b313f..e8c51067 100644 --- a/plugins/modules/baremetal_node.py +++ b/plugins/modules/baremetal_node.py @@ -248,15 +248,21 @@ def main(): if not HAS_JSONPATCH: module.fail_json(msg='jsonpatch is required for this module') if ( - module.params['auth_type'] in [None, 'None'] + module.params['auth_type'] in [None, 'None', 'none'] and module.params['ironic_url'] is None + and not module.params['cloud'] + and not (module.params['auth'] + and module.params['auth'].get('endpoint')) ): module.fail_json(msg="Authentication appears to be disabled, " - "Please define an ironic_url parameter") + "Please define either ironic_url, or cloud, " + "or auth.endpoint") if ( module.params['ironic_url'] - and module.params['auth_type'] in [None, 'None'] + and module.params['auth_type'] in [None, 'None', 'none'] + and not (module.params['auth'] + and module.params['auth'].get('endpoint')) ): module.params['auth'] = dict( endpoint=module.params['ironic_url'] diff --git a/plugins/modules/baremetal_node_action.py b/plugins/modules/baremetal_node_action.py index 73207878..ae0bef97 100644 --- a/plugins/modules/baremetal_node_action.py +++ b/plugins/modules/baremetal_node_action.py @@ -245,15 +245,21 @@ def main(): module = AnsibleModule(argument_spec, **module_kwargs) if ( - module.params['auth_type'] in [None, 'None'] + module.params['auth_type'] in [None, 'None', 'none'] and module.params['ironic_url'] is None + and not module.params['cloud'] + and not (module.params['auth'] + and module.params['auth'].get('endpoint')) ): - module.fail_json(msg="Authentication appears disabled, Please " - "define an ironic_url parameter") + module.fail_json(msg="Authentication appears to be disabled, " + "Please define either ironic_url, or cloud, " + "or auth.endpoint") if ( module.params['ironic_url'] - and module.params['auth_type'] in [None, 'None'] + and module.params['auth_type'] in [None, 'None', 'none'] + and not (module.params['auth'] + and module.params['auth'].get('endpoint')) ): module.params['auth'] = dict( endpoint=module.params['ironic_url']