You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
565 B

  1. {% if has_bastion %}
  2. {% set vars={'hosts': ''} %}
  3. {% set user='' %}
  4. {% for h in groups['all'] %}
  5. {% if h != 'bastion' %}
  6. {% if vars.update({'hosts': vars['hosts'] + ' ' + (hostvars[h].get('ansible_ssh_host') or hostvars[h]['ansible_host'])}) %}{% endif %}
  7. {% endif %}
  8. {% endfor %}
  9. Host {{ bastion_ip }}
  10. Hostname {{ bastion_ip }}
  11. StrictHostKeyChecking no
  12. ControlMaster auto
  13. ControlPath ~/.ssh/ansible-%r@%h:%p
  14. ControlPersist 5m
  15. Host {{ vars['hosts'] }}
  16. ProxyCommand ssh -W %h:%p {{ real_user }}@{{ bastion_ip }}
  17. StrictHostKeyChecking no
  18. {% endif %}