123456789101112131415161718 |
- - 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 %}
- {% if host_config.user is defined %}
- User {{host_config.user}}
- {% endif %}
- {% if host_config.ssh_proxy is defined %}
- ProxyCommand ssh -W localhost:{{host_config.ssh_proxy.port}} {{host_config.ssh_proxy.host}}
- {% endif %}
- {% endfor %}
- become: yes
|