Fabian Peter Hammerle 7 years ago
parent
commit
9808aaaffd
2 changed files with 13 additions and 0 deletions
  1. 1 0
      defaults/main.yml
  2. 12 0
      tasks/main.yml

+ 1 - 0
defaults/main.yml

@@ -0,0 +1 @@
+ssh_config_hosts: []

+ 12 - 0
tasks/main.yml

@@ -0,0 +1,12 @@
+- blockinfile:
+    dest: /etc/ssh/ssh_config
+    marker: '# ANSIBLE SSH CONFIG {mark}'
+    block: |-
+      {% for host in ssh_config_hosts %}
+      {% set host_config = ssh_config_hosts[host] %}
+      Host {{host}}
+      {% if host_config.hostname is defined %}
+          HostName {{host_config.hostname}} 
+      {% endif %}
+      {% endfor %}
+  become: yes