From 0a1495d0840706900281e21ac7ee5e40a0aa5649 Mon Sep 17 00:00:00 2001 From: nicoo Date: Sun, 17 Jun 2018 11:59:41 +0200 Subject: [PATCH] localconfig: Rely on ansible_port to configure SSH port --- ansible/roles/localconfig/defaults/main.yml | 2 +- ansible/roles/localconfig/templates/ssh/10r3.conf.j2 | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ansible/roles/localconfig/defaults/main.yml b/ansible/roles/localconfig/defaults/main.yml index ae14b0c..285c37f 100644 --- a/ansible/roles/localconfig/defaults/main.yml +++ b/ansible/roles/localconfig/defaults/main.yml @@ -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 diff --git a/ansible/roles/localconfig/templates/ssh/10r3.conf.j2 b/ansible/roles/localconfig/templates/ssh/10r3.conf.j2 index e133de8..294af58 100644 --- a/ansible/roles/localconfig/templates/ssh/10r3.conf.j2 +++ b/ansible/roles/localconfig/templates/ssh/10r3.conf.j2 @@ -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 %} -- 1.7.10.4