ssh connection - use get_option() rather than _play_context (#70438)
The ssh_args were sometimes not correctly applied to the connection when using _play_context. Use get_option() instead to ensure the correct ssh_args are always applied.
This commit is contained in:
parent
47c809aca1
commit
b4184aa50e
2 changed files with 7 additions and 2 deletions
4
changelogs/fragments/70437-ssh-args.yml
Normal file
4
changelogs/fragments/70437-ssh-args.yml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
bugfixes:
|
||||||
|
- >
|
||||||
|
ssh connection plugin - use ``get_option()`` rather than ``_play_context`` to
|
||||||
|
ensure ``ANSBILE_SSH_ARGS`` are applied properly (https://github.com/ansible/ansible/issues/70437)
|
|
@ -611,9 +611,10 @@ class Connection(ConnectionBase):
|
||||||
# Next, we add [ssh_connection]ssh_args from ansible.cfg.
|
# Next, we add [ssh_connection]ssh_args from ansible.cfg.
|
||||||
#
|
#
|
||||||
|
|
||||||
if self._play_context.ssh_args:
|
ssh_args = self.get_option('ssh_args')
|
||||||
|
if ssh_args:
|
||||||
b_args = [to_bytes(a, errors='surrogate_or_strict') for a in
|
b_args = [to_bytes(a, errors='surrogate_or_strict') for a in
|
||||||
self._split_ssh_args(self._play_context.ssh_args)]
|
self._split_ssh_args(ssh_args)]
|
||||||
self._add_args(b_command, b_args, u"ansible.cfg set ssh_args")
|
self._add_args(b_command, b_args, u"ansible.cfg set ssh_args")
|
||||||
|
|
||||||
# Now we add various arguments controlled by configuration file settings
|
# Now we add various arguments controlled by configuration file settings
|
||||||
|
|
Loading…
Reference in a new issue