2024-07-10 09:06:57 +00:00
|
|
|
- name: Setup ssh dir
|
|
|
|
file:
|
|
|
|
path: "{{ home }}/.ssh"
|
|
|
|
state: directory
|
|
|
|
recurse: true
|
|
|
|
owner: "{{ user }}"
|
|
|
|
|
|
|
|
- name: Copy pre-generated ssh keys
|
|
|
|
when: "not target_is_real"
|
|
|
|
block:
|
|
|
|
- copy:
|
2024-07-11 10:05:59 +00:00
|
|
|
src: ./vm_files/remote_key
|
|
|
|
dest: "{{ home }}/.ssh/{{ device_name }}_generic_ed25519"
|
|
|
|
mode: u=rw,g=,o=
|
2024-07-10 09:06:57 +00:00
|
|
|
- copy:
|
2024-07-11 10:05:59 +00:00
|
|
|
src: ./vm_files/remote_key.pub
|
|
|
|
dest: "{{ home }}/.ssh/{{ device_name }}_generic_ed25519.pub"
|
|
|
|
mode: u=rw,g=,o=
|
2024-07-10 09:06:57 +00:00
|
|
|
|
|
|
|
- name: Config git
|
|
|
|
template:
|
|
|
|
src: ssh_config
|
|
|
|
dest: "{{ home }}/.ssh/config"
|
|
|
|
owner: "{{ user }}"
|
|
|
|
mode: u=rw,g=,o=
|
|
|
|
|
2024-07-16 18:37:20 +00:00
|
|
|
- name: Create temporary build directory
|
|
|
|
ansible.builtin.tempfile:
|
|
|
|
state: directory
|
|
|
|
suffix: ssh_known_hosts
|
|
|
|
register: tempdir_known_hosts
|
|
|
|
|
|
|
|
- name: Load known hosts from profiles
|
|
|
|
template:
|
|
|
|
# load from controller host
|
|
|
|
src: "{{ home }}/.dots/profiles/{{ item.name }}/configs/ssh/known_hosts"
|
|
|
|
dest: "{{ tempdir_known_hosts.path }}/{{ item.name }}"
|
|
|
|
with_items: "{{ enabled_profiles }}"
|
|
|
|
|
|
|
|
- name: Concat known hosts
|
2024-07-10 09:06:57 +00:00
|
|
|
template:
|
2024-07-16 18:37:20 +00:00
|
|
|
src: ssh/known_hosts
|
2024-07-10 09:06:57 +00:00
|
|
|
dest: "{{ home }}/.ssh/known_hosts"
|
2024-07-16 18:37:20 +00:00
|
|
|
vars:
|
|
|
|
tempdir_known_hosts: "{{ tempdir_known_hosts }}"
|
2024-07-10 09:06:57 +00:00
|
|
|
|
2024-07-16 18:37:20 +00:00
|
|
|
- name: Load ssh config of profiles
|
|
|
|
template:
|
|
|
|
src: "{{ home }}/.dots/profiles/{{ item.name }}/configs/ssh/config"
|
|
|
|
dest: "{{ home }}/.ssh/profiles/{{ item.name }}"
|
|
|
|
mode: u=rw,g=,o=
|
|
|
|
with_items: "{{ enabled_profiles }}"
|