homelab/tasks/vaultwarden.yml
2024-09-09 22:37:51 +10:00

65 lines
1.4 KiB
YAML

---
- name: Create directories
file:
path: "{{ item }}"
state: directory
with_items:
- "{{ data_folder }}/vaultwarden"
- "{{ data_folder }}/vaultwarden/config"
- name: Create the vaultwarden container
docker_container:
name: vaultwarden
image: vaultwarden/server:1.32.0
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: Create rclone config folder
file:
path: "/root/.config/rclone"
state: directory
- name: Copy rclone config
copy:
src: scripts/rclone.conf
dest: /root/.config/rclone/rclone.conf
decrypt: yes
mode: "0600"
- name: copy backup script
copy:
src: scripts/backupvpsdocker
dest: /usr/local/sbin/backupvpsdocker
mode: 0755
- name: Setup cron job for backup
cron:
name: backup backupvpsdocker
minute: 0
hour: 4
job: "/usr/local/sbin/backupvpsdocker >/dev/null 2>&1"