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.

20 lines
695 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 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -W %h:%p {{ real_user }}@{{ bastion_ip }} {% if ansible_ssh_private_key_file is defined %}-i {{ ansible_ssh_private_key_file }}{% endif %}
  17. {% endif %}