ansible/roles/btrbk/tasks/main.yml

61 lines
1.4 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: make btrbk user ssh directory
file:
state: directory
path: /var/lib/btrbk/.ssh
owner: btrbk
- name: copy btrbk user ssh key
copy:
src: id_ed25519
dest: /var/lib/btrbk/.ssh/id_ed25519
owner: btrbk
mode: '0400'
- name: copy btrbk user ssh public key
copy:
src: id_ed25519.pub
dest: /var/lib/btrbk/.ssh/id_ed25519.pub
owner: btrbk
mode: '0644'
- name: copy btrbk user ssh public key to authorized_keys
copy:
src: id_ed25519.pub
dest: /var/lib/btrbk/.ssh/authorized_keys
owner: btrbk
mode: '0644'
- name: add btrbk files to lbu
lbu:
include:
- /usr/local/bin/btrbk
- /var/lib/btrbk/.ssh/id_ed25519
- /var/lib/btrbk/.ssh/id_ed25519.pub
- /var/lib/btrbk/.ssh/authorized_keys
when: ansible_distribution == "Alpine" and alpine_mode in ["diskless", "data"]