mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-02 14:40:19 -07:00
Aggregate ssh arguments in PlayContext instead of the connection plugin
Using set_host_overrides() in the connection plugin to access the ssh argument variables from the inventory didn't see group_vars/host_vars settings, as noted earlier. Instead, we can set the correct values in the PlayContext, which has access to all command-line options, task settings, and variables. The only downside of doing so is that the source of the settings is no longer available in ssh.py, and therefore can't be logged. But the code is simpler, and it actually works. This change was suggested by @jimi-c in response to the FIXME in the earlier commit.
This commit is contained in:
parent
3ad9b4cba6
commit
1981bf2b95
2 changed files with 11 additions and 27 deletions
|
@ -67,6 +67,10 @@ MAGIC_VARIABLE_MAPPING = dict(
|
|||
become_pass = ('ansible_become_password','ansible_become_pass'),
|
||||
become_exe = ('ansible_become_exe',),
|
||||
become_flags = ('ansible_become_flags',),
|
||||
ssh_common_args = ('ansible_ssh_common_args',),
|
||||
sftp_extra_args = ('ansible_sftp_extra_args',),
|
||||
scp_extra_args = ('ansible_scp_extra_args',),
|
||||
ssh_extra_args = ('ansible_ssh_extra_args',),
|
||||
sudo = ('ansible_sudo',),
|
||||
sudo_user = ('ansible_sudo_user',),
|
||||
sudo_pass = ('ansible_sudo_password', 'ansible_sudo_pass'),
|
||||
|
@ -140,6 +144,7 @@ class PlayContext(Base):
|
|||
_private_key_file = FieldAttribute(isa='string', default=C.DEFAULT_PRIVATE_KEY_FILE)
|
||||
_timeout = FieldAttribute(isa='int', default=C.DEFAULT_TIMEOUT)
|
||||
_shell = FieldAttribute(isa='string')
|
||||
_ssh_args = FieldAttribute(isa='string', default=C.ANSIBLE_SSH_ARGS)
|
||||
_ssh_common_args = FieldAttribute(isa='string')
|
||||
_sftp_extra_args = FieldAttribute(isa='string')
|
||||
_scp_extra_args = FieldAttribute(isa='string')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue