perf: 优化 ansible 写法

pull/9999/head
ibuler 2023-03-17 16:57:40 +08:00
parent cad6fffd74
commit c094bce71e
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}