add borgmatic role
This commit is contained in:
25
roles/borgmatic/tasks/handle-ssh-keys.yml
Normal file
25
roles/borgmatic/tasks/handle-ssh-keys.yml
Normal file
@@ -0,0 +1,25 @@
|
||||
---
|
||||
- name: "Ensure the path for SSH keys exists"
|
||||
ansible.builtin.file:
|
||||
path: "{{ ssh_key_path | dirname }}"
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0700"
|
||||
|
||||
- name: "Generate an ed25519 SSH key pair with 100 KDF rounds"
|
||||
register: ssh_key_pair
|
||||
community.crypto.openssh_keypair:
|
||||
type: ed25519
|
||||
path: "{{ ssh_key_path }}"
|
||||
comment: "Generated by Ansible for Borgmatic"
|
||||
force: false
|
||||
mode: '0600'
|
||||
|
||||
- name: "Push the SSH key pair to the Borg repo host"
|
||||
when: push_pubkey
|
||||
delegate_to: "{{ repo_server_inventory_hostname }}"
|
||||
ansible.posix.authorized_key:
|
||||
user: "{{ repo_server_user }}"
|
||||
key: "{{ ssh_key_pair.public_key }}"
|
||||
state: present
|
||||
Reference in New Issue
Block a user