36 lines
995 B
YAML
36 lines
995 B
YAML
---
|
|
- name: "SSH | Ensure directory exist"
|
|
ansible.builtin.file:
|
|
path: "{{ borg_user }}/.ssh/"
|
|
state: directory
|
|
mode: "0700"
|
|
owner: "{{ borg_user }}"
|
|
group: "{{ borg_group }}"
|
|
|
|
- name: "SSH | Generate an OpenSSH keypair"
|
|
community.crypto.openssh_keypair:
|
|
path: "{{ borg_ssh_key_file_path }}"
|
|
type: "{{ borg_ssh_key_type }}"
|
|
owner: "{{ borg_user }}"
|
|
group: "{{ borg_group }}"
|
|
comment: "{{ inventory_hostname }}"
|
|
|
|
- name: "SSH | Ensure configuration file is present"
|
|
ansible.builtin.file:
|
|
path: "{{ borg_user_ssh_config_path }}"
|
|
state: touch
|
|
mode: "644"
|
|
owner: "{{ borg_user }}"
|
|
group: "{{ borg_group }}"
|
|
|
|
- name: "SSH | Ensure configuration exists"
|
|
ansible.builtin.file:
|
|
path: ~/.ssh/config
|
|
state: touch
|
|
mode: "0644"
|
|
|
|
- name: "SSH | Create SSH configuration"
|
|
ansible.builtin.blockinfile:
|
|
path: ~/.ssh/config
|
|
marker: "### {mark} ANSIBLE MANAGED BLOCK"
|
|
block: "{{ lookup('template', 'ssh_config.j2') }}"
|