Move id_remote to /etc/borgmatic

This commit is contained in:
jeltz 2021-03-14 18:42:26 +01:00
parent c6cae75031
commit d9f1104309
1 changed files with 23 additions and 28 deletions

View File

@ -33,17 +33,28 @@
retries: 3 retries: 3
until: apt_result is succeeded until: apt_result is succeeded
- name: Create /etc/borgbackup - name: Create configuration direcotory for borgmatic
file: file:
path: /etc/borgbackup path: /etc/borgmatic
state: directory state: directory
owner: root owner: root
group: 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 - name: Create SSH key
openssh_keypair: openssh_keypair:
path: "/etc/borgbackup/id_remote" path: "/etc/borgmatic/id_remote"
type: ed25519 type: ed25519
regenerate: full_idempotence regenerate: full_idempotence
owner: root owner: root
@ -58,10 +69,6 @@
- all - all
register: server_facts 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 - name: Add server key to known hosts
known_hosts: known_hosts:
hash_host: true hash_host: true
@ -79,28 +86,16 @@
exclusive: false exclusive: false
user: "{{ borg_server_user }}" user: "{{ borg_server_user }}"
key: "{{ ssh_key.public_key }}" 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 key_options: "{{ options | join(',') }}"
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=
vars: vars:
borg_host_dir: "/borg/{{ ansible_fqdn }}" 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 - name: Init repository
command: borgmatic init --encryption repokey command: borgmatic init --encryption repokey