diff --git a/lib/ansible/plugins/action/net_base.py b/lib/ansible/plugins/action/net_base.py index 3ca75f7476..6abe1590a8 100644 --- a/lib/ansible/plugins/action/net_base.py +++ b/lib/ansible/plugins/action/net_base.py @@ -67,12 +67,19 @@ class ActionModule(ActionBase): socket_path = self._start_connection(play_context) task_vars['ansible_socket'] = socket_path + if 'fail_on_missing_module' not in self._task.args: + self._task.args['fail_on_missing_module'] = False + result = super(ActionModule, self).run(tmp, task_vars) module = self._get_implementation_module(play_context.network_os, self._task.action) if not module: - result['failed'] = True + if self._task.args['fail_on_missing_module']: + result['failed'] = True + else: + result['failed'] = False + result['msg'] = ('Could not find implementation module %s for %s' % (self._task.action, play_context.network_os)) else: @@ -83,6 +90,8 @@ class ActionModule(ActionBase): if 'network_os' in new_module_args: del new_module_args['network_os'] + del new_module_args['fail_on_missing_module'] + display.vvvv('Running implementation module %s' % module) result.update(self._execute_module(module_name=module, module_args=new_module_args, task_vars=task_vars,