aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/ssh_prepare/templates/config.j2
blob: 375efd7ca50b55f803de54e0765a6becc85c9557 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Host *
{% if creds_stat.stat.exists %}
  IdentityFile {{ base_dir }}/id_rsa
{% endif %}
  UserKnownHostsFile=/dev/null
  StrictHostKeyChecking=no

{% if gw_stat.stat.exists %}
{% for gw in ssh_gateways | default([]) %}
host {{ gw.name }}
  Hostname {{ gw.public_fqdn | default(gw.ansible_host) }}
  User {{ gw.ansible_user }}
{% if gw.ansible_port is defined %}
  Port {{ gw.ansible_port }}
{% endif %}
{% if gw.proxy_command is defined %}
  ProxyCommand  {{ gw.proxy_command }}
{% endif %}

{% endfor %}
{% endif %}

{% for node in groups.all %}
{% if hostvars[node].ansible_host is defined %}
host {{ node }} {{ hostvars[node].public_fqdn | default('') }} {{ hostvars[node].ansible_host }}
  Hostname {{ hostvars[node].public_fqdn | default(hostvars[node].ansible_host) }}
  User {{ hostvars[node].ansible_user }}
{% if gw_stat.stat.exists %}
  ProxyCommand ssh -F {{ base_dir }}/ssh_config -W %h:%p {{ ssh_gateways[0].name }}
{% endif %}
{% endif %}

{% endfor %}