homelab/roles/kanboard/tasks/main.yml

72 lines
1.5 KiB
YAML
Raw Normal View History

2024-10-01 14:35:42 +02:00
---
- name: Ensure data directory is present
ansible.builtin.file:
path: '/mnt/data1/kanboard'
state: directory
mode: '0755'
owner: 'root'
group: 'root'
- name: Ensure data subvolumes are present
community.general.btrfs_subvolume:
name: '/kanboard/{{ item }}'
loop:
- 'data'
- 'plugins'
- name: Ensure subvolume permissions are correct
ansible.builtin.file:
path: "/mnt/data1/kanboard/{{ item }}"
state: directory
mode: '0755'
owner: '100'
group: '101'
loop:
- 'data'
- 'plugins'
- name: Ensure configuration directory is present
ansible.builtin.file:
path: '/etc/kanboard'
state: directory
mode: '0755'
- name: Ensure compose file is present
ansible.builtin.copy:
src: 'compose.yml'
dest: '/etc/kanboard/compose.yml'
mode: '0644'
owner: 'root'
group: 'root'
notify: 'restart kanboard'
- name: Ensure backup scripts are present
ansible.builtin.copy:
src: "kanboard.{{ item }}.backup.sh"
dest: "/etc/backups/kanboard.{{ item }}.backup.sh"
owner: 'root'
group: 'root'
mode: '0644'
loop:
- 'data'
- 'plugins'
- name: Ensure service file is present
ansible.builtin.copy:
src: 'kanboard.service'
dest: '/lib/systemd/system/kanboard.service'
owner: 'root'
group: 'root'
mode: '0644'
register: res
- name: systemd-reload
ansible.builtin.systemd_service:
daemon_reload: true
when: 'res.changed'
- name: Ensure kanboard service is enabled
ansible.builtin.service:
name: 'kanboard'
enabled: true