homelab/tasks/vaultwarden.yml

65 lines
1.7 KiB
YAML
Raw Normal View History

2024-09-09 22:37:51 +10:00
---
- name: Create directories
file:
path: "{{ item }}"
state: directory
with_items:
- "{{ data_folder }}/vaultwarden"
- "{{ data_folder }}/vaultwarden/config"
2024-10-07 12:40:54 +10:00
- "{{ data_folder }}/vaultwardenbackup"
- "{{ data_folder }}/vaultwardenbackup/config"
- "{{ data_folder }}/vaultwardenbackup/config/rclone"
2024-09-09 22:37:51 +10:00
- name: Create the vaultwarden container
docker_container:
name: vaultwarden
image: vaultwarden/server:1.32.2
2024-09-09 22:37:51 +10:00
restart_policy: unless-stopped
recreate: true
networks:
- name: proxy
env:
PUID: "1000"
PGID: "1000"
TZ: "Australia/Brisbane"
volumes:
- "{{ data_folder }}/vaultwarden/data:/data"
labels:
traefik.enable: "true"
traefik.http.routers.vaultwarden.rule: "Host(`vault.comprofix.com`)"
traefik.http.routers.vaultwarden.entrypoints: "https"
traefik.http.routers.vaultwarden.tls: "true"
traefik.http.routers.vaultwarden.service: "vaultwarden"
traefik.http.services.vaultwarden.loadbalancer.server.port: "80"
register: container
- name: Copy rclone config
copy:
src: scripts/rclone.conf
2024-10-07 12:40:54 +10:00
dest: "{{ data_folder }}/vaultwardenbackup/config/rclone/rclone.conf"
2024-09-09 22:37:51 +10:00
decrypt: yes
mode: "0600"
2024-10-07 12:40:54 +10:00
- name: Create the vaultwarden container
docker_container:
name: vaultwardenbackup
image: ttionya/vaultwarden-backup:1.21.2
restart_policy: unless-stopped
recreate: true
env:
PUID: "1000"
PGID: "1000"
TZ: "Australia/Brisbane"
CRON: "0 4 * * *"
BACKUP_KEEP_DAYS: "14"
ZIP_PASSWORD: "{{ VAULTWARDEN_BACKUP_ZIP_PASSWORD }}"
volumes:
- "{{ data_folder }}/vaultwarden/data:/bitwarden/data"
- "{{ data_folder }}/vaultwardenbackup/config:/config"
register: container
2024-09-09 22:37:51 +10:00