main.yml 358 B

123456789101112
  1. - blockinfile:
  2. dest: /etc/ssh/ssh_config
  3. marker: '# ANSIBLE SSH CONFIG {mark}'
  4. block: |-
  5. {% for host in ssh_config_hosts %}
  6. {% set host_config = ssh_config_hosts[host] %}
  7. Host {{host}}
  8. {% if host_config.hostname is defined %}
  9. HostName {{host_config.hostname}}
  10. {% endif %}
  11. {% endfor %}
  12. become: yes