mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Allow delegate_to if transport is not cli (#29945)
Fixes #29060 Allow delegate_to if transport is either nxapi or eapi. Persistent connection uses `cli` transport and create a local socket on control node. Hence delegate_to is not allowed for `cli` transport. However as `nxapi` and `eapi` transport does not use persistent connection it is possible to use delegate_to in this case.
This commit is contained in:
parent
b02937f3c3
commit
530988666a
3 changed files with 12 additions and 12 deletions
|
@ -213,10 +213,10 @@ Will result in:
|
|||
delegate_to vs ProxyCommand
|
||||
---------------------------
|
||||
|
||||
The new connection framework for Network Modules in Ansible 2.3 no longer supports the use of the
|
||||
``delegate_to`` directive. In order to use a bastion or intermediate jump host
|
||||
to connect to network devices, network modules now support the use of
|
||||
``ProxyCommand``.
|
||||
The new connection framework for Network Modules in Ansible 2.3 that uses ``cli`` transport
|
||||
no longer supports the use of the ``delegate_to`` directive.
|
||||
In order to use a bastion or intermediate jump host to connect to network devices over ``cli``
|
||||
transport, network modules now support the use of ``ProxyCommand``.
|
||||
|
||||
To use ``ProxyCommand`` configure the proxy settings in the Ansible inventory
|
||||
file to specify the proxy host.
|
||||
|
|
|
@ -37,16 +37,16 @@ except ImportError:
|
|||
class ActionModule(_ActionModule):
|
||||
|
||||
def run(self, tmp=None, task_vars=None):
|
||||
if self._play_context.connection != 'local':
|
||||
provider = load_provider(eos_provider_spec, self._task.args)
|
||||
transport = provider['transport'] or 'cli'
|
||||
|
||||
if self._play_context.connection != 'local' and transport == 'cli':
|
||||
return dict(
|
||||
failed=True,
|
||||
msg='invalid connection specified, expected connection=local, '
|
||||
'got %s' % self._play_context.connection
|
||||
)
|
||||
|
||||
provider = load_provider(eos_provider_spec, self._task.args)
|
||||
transport = provider['transport'] or 'cli'
|
||||
|
||||
display.vvvv('connection transport is %s' % transport, self._play_context.remote_addr)
|
||||
|
||||
if transport == 'cli':
|
||||
|
|
|
@ -37,16 +37,16 @@ except ImportError:
|
|||
class ActionModule(_ActionModule):
|
||||
|
||||
def run(self, tmp=None, task_vars=None):
|
||||
if self._play_context.connection != 'local':
|
||||
provider = load_provider(nxos_provider_spec, self._task.args)
|
||||
transport = provider['transport'] or 'cli'
|
||||
|
||||
if self._play_context.connection != 'local' and transport == 'cli':
|
||||
return dict(
|
||||
failed=True,
|
||||
msg='invalid connection specified, expected connection=local, '
|
||||
'got %s' % self._play_context.connection
|
||||
)
|
||||
|
||||
provider = load_provider(nxos_provider_spec, self._task.args)
|
||||
transport = provider['transport'] or 'cli'
|
||||
|
||||
display.vvvv('connection transport is %s' % transport, self._play_context.remote_addr)
|
||||
|
||||
if transport == 'cli':
|
||||
|
|
Loading…
Reference in a new issue