feat(ssh): known hosts from profile
refactored to use enabled_profiles var
This commit is contained in:
parent
f09b114cfe
commit
9dc0dbc514
3 changed files with 38 additions and 18 deletions
|
|
@ -24,15 +24,29 @@
|
|||
owner: "{{ user }}"
|
||||
mode: u=rw,g=,o=
|
||||
|
||||
- name: Load known hosts
|
||||
template:
|
||||
src: known_hosts
|
||||
dest: "{{ home }}/.ssh/known_hosts"
|
||||
owner: "{{ user }}"
|
||||
mode: u=rw,g=,o=
|
||||
- name: Create temporary build directory
|
||||
ansible.builtin.tempfile:
|
||||
state: directory
|
||||
suffix: ssh_known_hosts
|
||||
register: tempdir_known_hosts
|
||||
|
||||
- name: Load organization profile
|
||||
when: organization is defined and "ssh" in organization_customize
|
||||
copy:
|
||||
src: "{{ home }}/.dots/profiles/{{ organization }}/configs/ssh"
|
||||
dest: "{{ home }}/.ssh/profiles/{{ organization }}"
|
||||
- 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
|
||||
template:
|
||||
src: ssh/known_hosts
|
||||
dest: "{{ home }}/.ssh/known_hosts"
|
||||
vars:
|
||||
tempdir_known_hosts: "{{ tempdir_known_hosts }}"
|
||||
|
||||
- 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 }}"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue