Browse Source

ssh_proxy: added options 'user' and 'key_path'

Fabian Peter Hammerle 7 years ago
parent
commit
34abbb687a
1 changed files with 16 additions and 2 deletions
  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