localconfig: Rely on ansible_port to configure SSH port
authornicoo <nicoo@realraum.at>
Sun, 17 Jun 2018 09:59:41 +0000 (11:59 +0200)
committernicoo <nicoo@realraum.at>
Sun, 17 Jun 2018 10:06:58 +0000 (12:06 +0200)
ansible/roles/localconfig/defaults/main.yml
ansible/roles/localconfig/templates/ssh/10r3.conf.j2

index ae14b0c..285c37f 100644 (file)
@@ -10,4 +10,4 @@ localconfig_ssh_ids:
 ### to be set inhost_vars and group_vars
 # localconfig_ssh_config_proxycommand:
 # localconfig_ssh_config_user:
-# localconfig_ssh_config_port:
+# ansible_port
index e133de8..294af58 100644 (file)
@@ -13,8 +13,8 @@ Host {{ hostvars[host].ansible_host }} r3-{{ host }} r3g-{{ host }} r3e-{{ host
 {% if 'localconfig_ssh_config_user' in hostvars[host] %}
     User {{ hostvars[host].localconfig_ssh_config_user }}
 {% endif %}
-{% if 'localconfig_ssh_config_port' in hostvars[host] %}
-    Port {{ hostvars[host].localconfig_ssh_config_port }}
+{% if hostvars[host].ansible_port != 22000 %}
+    Port {{ hostvars[host].ansible_port }}
 {% endif %}
 
 {% endfor %}