ansible/roles/btrbk/tasks/main.yml

60 lines
1.2 KiB
YAML
Raw Permalink Normal View History

2022-11-04 14:34:44 +01:00
---
- name: alpine setup
include_tasks: alpine.yml
when: ansible_distribution == "Alpine"
- name: debian/ubuntu setup
include_tasks: debian.yml
when: ansible_distribution in ["Debian", "Ubuntu"]
- name: create btrbk directory config
file:
state: directory
path: /etc/btrbk
- name: download btrbk executable
get_url:
url: '{{ btrbk_url }}'
dest: /usr/local/bin/btrbk
mode: '0755'
2022-11-04 14:34:44 +01:00
- name: copy btrbk config
copy:
src: "host_files/btrbk/{{ ansible_hostname }}/btrbk.conf"
dest: /etc/btrbk/btrbk.conf
2022-11-04 15:24:55 +01:00
2023-04-05 12:07:17 +02:00
- name: copy btrbk ssh private key
2022-11-04 15:24:55 +01:00
copy:
src: id_ed25519
2022-11-04 17:07:41 +01:00
dest: /etc/btrbk/id_ed25519
2022-11-04 15:24:55 +01:00
owner: btrbk
mode: '0400'
2023-04-05 12:07:17 +02:00
- name: copy btrbk ssh public key
2022-11-04 15:24:55 +01:00
copy:
src: id_ed25519.pub
2023-04-05 12:07:17 +02:00
dest: /etc/btrbk/id_ed25519.pub
2022-11-04 15:24:55 +01:00
owner: btrbk
2023-04-05 12:07:17 +02:00
mode: '0444'
- name: copy btrbk ssh public key certificate
copy:
src: id_ed25519-cert.pub
dest: /etc/btrbk/id_ed25519-cert.pub
owner: btrbk
mode: '0444'
2022-11-04 15:24:55 +01:00
2023-04-10 21:25:41 +02:00
- name: add btrbk to cron
cron:
name: btrbk
special_time: daily
user: btrbk
job: "btrbk run"
- name: add btrbk files to lbu
2022-11-04 15:24:55 +01:00
lbu:
include:
- /usr/local/bin/btrbk
2022-11-04 15:24:55 +01:00
when: ansible_distribution == "Alpine" and alpine_mode in ["diskless", "data"]