kanboard: add config
parent
b313c246ec
commit
781b9c31de
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
dependencies:
|
||||||
|
- role: caddy
|
|
@ -0,0 +1,9 @@
|
||||||
|
---
|
||||||
|
- name: Ensure Caddyfile is present
|
||||||
|
template:
|
||||||
|
src: 'kanboard.Caddyfile.j2'
|
||||||
|
dest: '/etc/caddy/kanboard.Caddyfile'
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: '0644'
|
||||||
|
notify: caddy-reload
|
|
@ -0,0 +1,3 @@
|
||||||
|
kanban.roosens.me {
|
||||||
|
reverse_proxy {{ hostvars[groups['kanboard'][0]].static_ip }}:8011
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
services:
|
||||||
|
kanboard:
|
||||||
|
image: 'kanboard/kanboard:v1.2.39'
|
||||||
|
restart: 'always'
|
||||||
|
|
||||||
|
ports:
|
||||||
|
- '8011:80'
|
||||||
|
volumes:
|
||||||
|
- '/mnt/data1/kanboard/data:/var/www/app/data'
|
||||||
|
- '/mnt/data1/kanboard/plugins:/var/www/app/plugins'
|
|
@ -0,0 +1,12 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
data_dir='/mnt/data1/kanboard/data'
|
||||||
|
snapshot_dir="${data_dir}.snapshot"
|
||||||
|
|
||||||
|
# Read-only snapshot for atomic backup
|
||||||
|
btrfs subvolume snapshot -r "$data_dir" "$snapshot_dir" || exit $?
|
||||||
|
|
||||||
|
/usr/local/bin/restic backup "$snapshot_dir"
|
||||||
|
|
||||||
|
# Always remove snapshot subvolume, even if restic fails
|
||||||
|
btrfs subvolume delete "$snapshot_dir"
|
|
@ -0,0 +1,12 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
data_dir='/mnt/data1/kanboard/plugins'
|
||||||
|
snapshot_dir="${data_dir}.snapshot"
|
||||||
|
|
||||||
|
# Read-only snapshot for atomic backup
|
||||||
|
btrfs subvolume snapshot -r "$data_dir" "$snapshot_dir" || exit $?
|
||||||
|
|
||||||
|
/usr/local/bin/restic backup "$snapshot_dir"
|
||||||
|
|
||||||
|
# Always remove snapshot subvolume, even if restic fails
|
||||||
|
btrfs subvolume delete "$snapshot_dir"
|
|
@ -0,0 +1,13 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Project management software that focuses on the Kanban methodology
|
||||||
|
After=docker.service
|
||||||
|
Requires=docker.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=exec
|
||||||
|
WorkingDirectory=/etc/kanboard
|
||||||
|
ExecStart=/usr/bin/docker compose up
|
||||||
|
ExecStop=/usr/bin/docker compose down
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
- name: 'restart kanboard'
|
||||||
|
ansible.builtin.service:
|
||||||
|
name: 'kanboard'
|
||||||
|
state: 'restarted'
|
|
@ -0,0 +1,71 @@
|
||||||
|
---
|
||||||
|
- 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
|
Loading…
Reference in New Issue