27 lines
661 B
YAML
27 lines
661 B
YAML
---
|
|
- name: generate ssh_config
|
|
hosts: localhost
|
|
connection: local
|
|
gather_facts: no
|
|
tasks:
|
|
- name: generate ssh_config file
|
|
copy:
|
|
content: |
|
|
{% for host in hostvars %}
|
|
Host {{ host }}
|
|
User root
|
|
Hostname {{ hostvars[host]["ip"] }}
|
|
{% if jumphost is defined and jumphost != host %}
|
|
ProxyJump {{ jumphost }}
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
|
dest: ~/.ssh/ffl_eae_adp_config
|
|
mode: 0600
|
|
|
|
- name: include custom ssh_config
|
|
lineinfile:
|
|
path: ~/.ssh/config
|
|
line: "Include ~/.ssh/ffl_eae_adp_config"
|
|
create: yes
|