From c2370f14dd4ef8ff984231239f5bfe54dcc9b29e Mon Sep 17 00:00:00 2001 From: Peter Sprygada Date: Fri, 14 Apr 2017 06:08:52 -0400 Subject: [PATCH] fixes issue where network modules would ignore provider host value (#23589) This addresses a problem where the action plugin would ignore the remote_addr value for the host. In this case, only the inventory values for the hostname would be considered and populate the remote host remote_addr value for the connection plugin. --- lib/ansible/plugins/action/eos.py | 1 + lib/ansible/plugins/action/ios.py | 1 + lib/ansible/plugins/action/iosxr.py | 1 + lib/ansible/plugins/action/vyos.py | 1 + 4 files changed, 4 insertions(+) diff --git a/lib/ansible/plugins/action/eos.py b/lib/ansible/plugins/action/eos.py index 3a8268e831d..f40d6179721 100644 --- a/lib/ansible/plugins/action/eos.py +++ b/lib/ansible/plugins/action/eos.py @@ -57,6 +57,7 @@ class ActionModule(_ActionModule): pc = copy.deepcopy(self._play_context) pc.connection = 'network_cli' pc.network_os = 'eos' + pc.remote_addr = provider['host'] or self._play_context.remote_addr pc.remote_user = provider['username'] or self._play_context.connection_user pc.password = provider['password'] or self._play_context.password pc.private_key_file = provider['ssh_keyfile'] or self._play_context.private_key_file diff --git a/lib/ansible/plugins/action/ios.py b/lib/ansible/plugins/action/ios.py index e4d721c2dec..cbfef17e079 100644 --- a/lib/ansible/plugins/action/ios.py +++ b/lib/ansible/plugins/action/ios.py @@ -54,6 +54,7 @@ class ActionModule(_ActionModule): pc = copy.deepcopy(self._play_context) pc.connection = 'network_cli' pc.network_os = 'ios' + pc.remote_addr = provider['host'] or self._play_context.remote_addr pc.port = provider['port'] or self._play_context.port or 22 pc.remote_user = provider['username'] or self._play_context.connection_user pc.password = provider['password'] or self._play_context.password diff --git a/lib/ansible/plugins/action/iosxr.py b/lib/ansible/plugins/action/iosxr.py index 661b2d37e36..f7e78d2c0a0 100644 --- a/lib/ansible/plugins/action/iosxr.py +++ b/lib/ansible/plugins/action/iosxr.py @@ -54,6 +54,7 @@ class ActionModule(_ActionModule): pc = copy.deepcopy(self._play_context) pc.connection = 'network_cli' pc.network_os = 'iosxr' + pc.remote_addr = provider['host'] or self._play_context.remote_addr pc.port = provider['port'] or self._play_context.port or 22 pc.remote_user = provider['username'] or self._play_context.connection_user pc.password = provider['password'] or self._play_context.password diff --git a/lib/ansible/plugins/action/vyos.py b/lib/ansible/plugins/action/vyos.py index 2ac1218abea..9da1f64ebea 100644 --- a/lib/ansible/plugins/action/vyos.py +++ b/lib/ansible/plugins/action/vyos.py @@ -53,6 +53,7 @@ class ActionModule(_ActionModule): pc = copy.deepcopy(self._play_context) pc.connection = 'network_cli' pc.network_os = 'vyos' + pc.remote_addr = provider['host'] or self._play_context.remote_addr pc.port = provider['port'] or self._play_context.port or 22 pc.remote_user = provider['username'] or self._play_context.connection_user pc.password = provider['password'] or self._play_context.password