ansible/roles/btrbk/tasks/main.yml

60 lines
1.2 KiB
YAML

---
- 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'
- name: copy btrbk config
copy:
src: "host_files/btrbk/{{ ansible_hostname }}/btrbk.conf"
dest: /etc/btrbk/btrbk.conf
- name: copy btrbk ssh private key
copy:
src: id_ed25519
dest: /etc/btrbk/id_ed25519
owner: btrbk
mode: '0400'
- name: copy btrbk ssh public key
copy:
src: id_ed25519.pub
dest: /etc/btrbk/id_ed25519.pub
owner: btrbk
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'
- name: add btrbk to cron
cron:
name: btrbk
special_time: daily
user: btrbk
job: "btrbk run"
- name: add btrbk files to lbu
lbu:
include:
- /usr/local/bin/btrbk
when: ansible_distribution == "Alpine" and alpine_mode in ["diskless", "data"]