mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-09 20:20:31 -07:00
add the user_known_hosts_file option
This commit is contained in:
parent
d974206df0
commit
7dab8c8b56
1 changed files with 13 additions and 2 deletions
|
@ -214,6 +214,17 @@ options:
|
|||
cli:
|
||||
- name: private_key_file
|
||||
option: "--private-key"
|
||||
user_known_hosts_file:
|
||||
description:
|
||||
- Path to the user known hosts file.
|
||||
- Used to verify the ssh hosts keys.
|
||||
type: string
|
||||
default: ~/.ssh/known_hosts
|
||||
ini:
|
||||
- section: paramiko_connection
|
||||
key: user_known_hosts_file
|
||||
vars:
|
||||
- name: ansible_paramiko_user_known_hosts_file
|
||||
wsl_distribution:
|
||||
description:
|
||||
- WSL distribution name
|
||||
|
@ -457,10 +468,10 @@ class Connection(ConnectionBase):
|
|||
if self._log_channel is not None:
|
||||
ssh.set_log_channel(self._log_channel)
|
||||
|
||||
self.keyfile = os.path.expanduser('~/.ssh/known_hosts')
|
||||
self.keyfile = os.path.expanduser(self.get_option('user_known_hosts_file'))
|
||||
|
||||
if self.get_option('host_key_checking'):
|
||||
for ssh_known_hosts in ('/etc/ssh/ssh_known_hosts', '/etc/openssh/ssh_known_hosts'):
|
||||
for ssh_known_hosts in ('/etc/ssh/ssh_known_hosts', '/etc/openssh/ssh_known_hosts', self.keyfile):
|
||||
try:
|
||||
ssh.load_system_host_keys(ssh_known_hosts)
|
||||
break
|
||||
|
|
Loading…
Add table
Reference in a new issue