20 lines
569 B
YAML
20 lines
569 B
YAML
---
|
|
- name: Stat local .ssh/config.d
|
|
delegate_to: localhost
|
|
ansible.builtin.stat:
|
|
path: ~/.ssh/config.d
|
|
register: _stat_ssh_configd
|
|
|
|
- name: Add SSH config on ansible host
|
|
when: _stat_ssh_configd.stat.isdir
|
|
delegate_to: localhost
|
|
ansible.builtin.copy:
|
|
dest: ~/.ssh/config.d/{{ inventory_hostname }}.conf
|
|
content: |
|
|
Host {{ inventory_hostname }} {{ inventory_hostname.split(".")[0] }}
|
|
Hostname {{ ansible_ssh_hostname | default(inventory_hostname) }}
|
|
Port 22
|
|
User root
|
|
ForwardAgent yes
|
|
mode: u=rw,go=r
|