Explorar o código

ssh_proxy: added options 'user' and 'key_path'

Fabian Peter Hammerle %!s(int64=7) %!d(string=hai) anos
pai
achega
34abbb687a
Modificáronse 1 ficheiros con 16 adicións e 2 borrados
  1. 16 2
      tasks/main.yml

+ 16 - 2
tasks/main.yml

@@ -13,7 +13,14 @@
           User {{host_config.user}}
       {% endif %}
       {% if host_config.ssh_proxy is defined %}
-          ProxyCommand ssh -W localhost:{{host_config.ssh_proxy.port}} {{host_config.ssh_proxy.host}}
+          ProxyCommand ssh -W localhost:{{host_config.ssh_proxy.port}}
+      {%- if host_config.ssh_proxy.user is defined %}
+       -o User={{host_config.ssh_proxy.user}}
+      {%- endif %}
+      {%- if host_config.ssh_proxy.key_path is defined %}
+       -i '{{host_config.ssh_proxy.key_path}}'
+      {%- endif %}
+       {{host_config.ssh_proxy.host}}
       {% endif %}
       {% endfor %}
   become: yes
@@ -35,7 +42,14 @@
           User {{host_config.user}}
       {% endif %}
       {% if host_config.ssh_proxy is defined %}
-          ProxyCommand ssh -W localhost:{{host_config.ssh_proxy.port}} {{host_config.ssh_proxy.host}}
+          ProxyCommand ssh -W localhost:{{host_config.ssh_proxy.port}}
+      {%- if host_config.ssh_proxy.user is defined %}
+       -o User={{host_config.ssh_proxy.user}}
+      {%- endif %}
+      {%- if host_config.ssh_proxy.key_path is defined %}
+       -i '{{host_config.ssh_proxy.key_path}}'
+      {%- endif %}
+       {{host_config.ssh_proxy.host}}
       {% endif %}
       {% endfor %}
   become: yes