diff options
author | binary <me@rgoncalves.se> | 2020-11-07 20:39:07 +0100 |
---|---|---|
committer | binary <me@rgoncalves.se> | 2020-11-07 20:39:07 +0100 |
commit | 8ff8f1fa4037defebab29c7c7775ae3372cbe9a7 (patch) | |
tree | e395508f5a962fc9afce777cff08dbfecb0862d4 /roles/ssh/templates | |
parent | 352c98322771af117a85904d580e1c062062d634 (diff) | |
download | infrastructure-8ff8f1fa4037defebab29c7c7775ae3372cbe9a7.tar.gz |
Automate network deployment
Diffstat (limited to 'roles/ssh/templates')
-rw-r--r-- | roles/ssh/templates/generate_dns.j2 | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/roles/ssh/templates/generate_dns.j2 b/roles/ssh/templates/generate_dns.j2 index c8d5a44..59c6233 100644 --- a/roles/ssh/templates/generate_dns.j2 +++ b/roles/ssh/templates/generate_dns.j2 @@ -1,13 +1,24 @@ -{% for host in groups["servers"] %} -{% set host = hostvars[host] %} -Match originalhost dcontroller exec "systemctl is-active wg-quick@{{ _i.dcontroller }}.service" - HostName {{ host.ip.inbound }} - Port {{ host.services.tcp.ssh }} +# ssh configuration for dns ~~ ~/.ssh/.config.d/ +# managed by Ansible -Match originalhost {{ host.ansible_host }} - HostName {{ host.ip.outbound }} - Port {{ host.services.tcp.ssh }} +{% for h in groups["all"] %} +{% set h = hostvars[h] %} +{##} +{% if h.ip is defined %} +{% set _port = h.services | selectattr("name", "equalto", "ssh") | map(attribute="port") | list | join(' ') %} +{##} +# {{ h.ansible_host }} + +Match originalhost {{ h.ansible_host }} exec "systemctl is-active wg-quick@{{ _i.dcontroller }}.service" + HostName {{ h.ip.in }} + Port {{ _port }} + +Match originalhost {{ h.ansible_host }} + HostName {{ h.ip.out }} + Port {{ _port }} User root +{% endif %} +{##} {% endfor %} |