diff --git a/lib/ansible/module_utils/ironware.py b/lib/ansible/module_utils/ironware.py index 3d8794b917..2fbb6ac624 100644 --- a/lib/ansible/module_utils/ironware.py +++ b/lib/ansible/module_utils/ironware.py @@ -96,6 +96,7 @@ def run_commands(module, commands, check_rc=True): def get_config(module, source='running', flags=None): + global _DEVICE_CONFIG if source is 'running' and flags is None and _DEVICE_CONFIG is not None: return _DEVICE_CONFIG else: diff --git a/lib/ansible/modules/network/ironware/ironware_config.py b/lib/ansible/modules/network/ironware/ironware_config.py index 6fd4821659..4ecbe4ec62 100644 --- a/lib/ansible/modules/network/ironware/ironware_config.py +++ b/lib/ansible/modules/network/ironware/ironware_config.py @@ -228,7 +228,7 @@ def run(module, result): if result['changed'] or module.params['save_when'] == 'always': result['changed'] = True if not module.check_mode: - cmd = {'command': 'write memory', 'output': 'text'} + cmd = {'command': 'write memory'} run_commands(module, [cmd]) diff --git a/lib/ansible/plugins/action/ironware.py b/lib/ansible/plugins/action/ironware.py index 48c0b6395b..74f626c670 100644 --- a/lib/ansible/plugins/action/ironware.py +++ b/lib/ansible/plugins/action/ironware.py @@ -60,6 +60,8 @@ class ActionModule(_ActionModule): pc.private_key_file = provider['ssh_keyfile'] or self._play_context.private_key_file pc.timeout = int(provider['timeout'] or C.PERSISTENT_COMMAND_TIMEOUT) pc.become = provider['authorize'] or False + if pc.become: + pc.become_method = 'enable' pc.become_pass = provider['auth_pass'] display.vvv('using connection plugin %s' % pc.connection, pc.remote_addr) @@ -78,8 +80,8 @@ class ActionModule(_ActionModule): conn = Connection(socket_path) out = conn.get_prompt() if to_text(out, errors='surrogate_then_replace').strip().endswith(')#'): - display.vvvv('wrong context, sending exit to device', self._play_context.remote_addr) - conn.send_command('exit') + display.vvvv('wrong context, sending end to device', self._play_context.remote_addr) + conn.send_command('end') task_vars['ansible_socket'] = socket_path