Merge pull request #9999 from jumpserver/pr@dev@perf_ansible_config

perf: 优化 ansible 写法
pull/10009/head
老广 2023-03-17 17:03:46 +08:00 committed by GitHub
commit 074c9c85b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -49,12 +49,12 @@ class JMSInventory:
if gateway.password:
proxy_command_list.insert(
0, "sshpass -p '{}'".format(gateway.password)
0, "sshpass -p {}".format(gateway.password)
)
if gateway.private_key:
proxy_command_list.append("-i {}".format(gateway.private_key_path))
proxy_command = '-o ProxyCommand=\"{}\"'.format(
proxy_command = "-o ProxyCommand='{}'".format(
" ".join(proxy_command_list)
)
return {"ansible_ssh_common_args": proxy_command}