From b4327fdc994a0f910ec656570bb8d2777462778f Mon Sep 17 00:00:00 2001 From: Vladimir Rutsky Date: Thu, 2 Feb 2017 18:33:05 +0300 Subject: [PATCH] handle both 'ansible_host' and 'ansible_ssh_host' in bastion configuration 'absible_ssh_host' is deprecated in Ansible 2.0 and at least 'contrib/inventory_builder/inventory.py' uses 'ansible_host' instead. --- roles/bastion-ssh-config/templates/ssh-bastion.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/bastion-ssh-config/templates/ssh-bastion.conf b/roles/bastion-ssh-config/templates/ssh-bastion.conf index 6bcc65dad..ebb380665 100644 --- a/roles/bastion-ssh-config/templates/ssh-bastion.conf +++ b/roles/bastion-ssh-config/templates/ssh-bastion.conf @@ -4,7 +4,7 @@ {% for h in groups['all'] %} {% if h != 'bastion' %} -{% if vars.update({'hosts': vars['hosts'] + ' ' + hostvars[h]['ansible_ssh_host']}) %}{% endif %} +{% if vars.update({'hosts': vars['hosts'] + ' ' + (hostvars[h].get('ansible_ssh_host') or hostvars[h]['ansible_host'])}) %}{% endif %} {% endif %} {% endfor %} @@ -18,4 +18,4 @@ Host {{ bastion_ip }} Host {{ vars['hosts'] }} ProxyCommand ssh -W %h:%p {{ real_user }}@{{ bastion_ip }} StrictHostKeyChecking no -{% endif %} \ No newline at end of file +{% endif %}