Move id_remote to /etc/borgmatic

This commit is contained in:
jeltz 2021-03-14 18:42:26 +01:00
parent c6cae75031
commit d9f1104309

View file

@ -33,17 +33,28 @@
retries: 3
until: apt_result is succeeded
- name: Create /etc/borgbackup
- name: Create configuration direcotory for borgmatic
file:
path: /etc/borgbackup
path: /etc/borgmatic
state: directory
owner: root
group: root
mode: u=rwx,g=rx,o=
mode: u=rw,g=r,o=
- name: Add borgmatic configuration file
become: true
template:
src: config.yaml.j2
dest: /etc/borgmatic/config.yaml
owner: root
group: root
mode: u=rw,g=r,o=
vars:
borg_host_dir: "/borg/{{ ansible_fqdn }}"
- name: Create SSH key
openssh_keypair:
path: "/etc/borgbackup/id_remote"
path: "/etc/borgmatic/id_remote"
type: ed25519
regenerate: full_idempotence
owner: root
@ -58,10 +69,6 @@
- all
register: server_facts
- name: debug
debug:
var: "server_facts['ansible_facts'].ansible_ssh_host_key_ecdsa_public_keytype"
- name: Add server key to known hosts
known_hosts:
hash_host: true
@ -79,28 +86,16 @@
exclusive: false
user: "{{ borg_server_user }}"
key: "{{ ssh_key.public_key }}"
key_options: command="borg serve --restrict-to-path {{ borg_host_dir }}",no-agent-forwarding,no-port-forwarding,no-pty,no-user-rc,no-X11-forwarding
vars:
borg_host_dir: "/borg/{{ ansible_fqdn }}"
- name: Create configuration direcotory for borgmatic
file:
state: directory
owner: root
group: root
mode: u=rw,g=r,o=
path: /etc/borgmatic
- name: Add borgmatic configuration file
become: true
template:
src: config.yaml.j2
dest: /etc/borgmatic/config.yaml
owner: root
group: root
mode: u=rw,g=r,o=
key_options: "{{ options | join(',') }}"
vars:
borg_host_dir: "/borg/{{ ansible_fqdn }}"
options:
- 'command="borg serve --restrict-to-path {{ borg_host_dir }}"'
- no-agent-forwarding
- no-port-forwarding
- no-pty
- no-user-rc
- no-X11-forwarding
- name: Init repository
command: borgmatic init --encryption repokey