diff options
-rw-r--r-- | roles/ssh/tasks/generate_dns.yml | 7 | ||||
-rw-r--r-- | roles/ssh/tasks/main.yml | 0 | ||||
-rw-r--r-- | roles/ssh/templates/generate_dns.j2 | 13 |
3 files changed, 20 insertions, 0 deletions
diff --git a/roles/ssh/tasks/generate_dns.yml b/roles/ssh/tasks/generate_dns.yml new file mode 100644 index 0000000..6501299 --- /dev/null +++ b/roles/ssh/tasks/generate_dns.yml @@ -0,0 +1,7 @@ + +# ssh ~~ tasks/local_dns.yml + +- name: Generate template to localhost + template: + src: templates/generate_dns.j2 + dest: "{{ lookup('env', 'HOME') }}/.ssh/config.d/ssh_dns" diff --git a/roles/ssh/tasks/main.yml b/roles/ssh/tasks/main.yml new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/roles/ssh/tasks/main.yml diff --git a/roles/ssh/templates/generate_dns.j2 b/roles/ssh/templates/generate_dns.j2 new file mode 100644 index 0000000..c8d5a44 --- /dev/null +++ b/roles/ssh/templates/generate_dns.j2 @@ -0,0 +1,13 @@ +{% 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 }} + +Match originalhost {{ host.ansible_host }} + HostName {{ host.ip.outbound }} + Port {{ host.services.tcp.ssh }} + User root + +{% endfor %} |