homelab/roles/baikal/tasks/main.yml

45 lines
998 B
YAML
Raw Normal View History

2024-02-13 09:41:35 +01:00
---
2024-02-18 09:10:01 +01:00
- name: Ensure data subvolume is present
community.general.btrfs_subvolume:
name: '/baikal'
- name: Ensure data directories are present
2024-02-13 09:41:35 +01:00
ansible.builtin.file:
2024-02-18 09:10:01 +01:00
path: '/mnt/data1/baikal/{{ item }}'
2024-02-13 09:41:35 +01:00
state: directory
mode: '0755'
owner: 'root'
group: 'root'
loop:
- 'Specific'
- 'config'
- name: Ensure configuration directory is present
ansible.builtin.file:
path: '/etc/baikal'
state: directory
mode: '0755'
- name: Ensure compose file is present
ansible.builtin.copy:
src: 'compose.yml'
dest: '/etc/baikal/compose.yml'
mode: '0644'
owner: 'root'
group: 'root'
register: res
- name: Ensure stack is deployed
ansible.builtin.shell:
chdir: '/etc/baikal'
cmd: 'docker compose up -d --remove-orphans'
when: 'res.changed'
- name: Ensure backup script is present
ansible.builtin.copy:
src: 'baikal.backup.sh'
dest: '/etc/backups/baikal.backup.sh'
owner: 'root'
group: 'root'
mode: '0644'