Bitwarden starts/stops

This commit is contained in:
David Stephens 2022-08-28 16:32:18 +01:00
parent 3adcf026a1
commit b8fcfd30c0
4 changed files with 75 additions and 51 deletions

View file

@ -52,7 +52,6 @@
- role: bitwarden
tags:
- bitwarden
when: (bitwarden_enabled | default(False))
- role: booksonic
tags:
@ -459,7 +458,7 @@
when: (znc_enabled | default(False))
post_tasks:
- name: Clean up stopped applications
- name: Clean up stopped applications # noqa no-changed-when
command: /bin/true
notify: "stop disabled applications"
tags:

View file

@ -20,3 +20,7 @@ bitwarden_allow_signups: false
# specs
bitwarden_memory: 1g
bitwarden_backup_memory: 1g
# docker
bitwarden_container_name: bitwarden
bitwarden_backup_container_name: bitwarden-backup

View file

@ -0,0 +1,18 @@
---
- name: Stop Bitwarden
docker_container:
name: "{{ bitwarden_container_name }}"
state: absent
when: bitwarden_enabled is false
listen:
- "stop bitwarden"
- "stop disabled applications"
- name: Stop Bitwarden Backup
docker_container:
name: "{{ bitwarden_backup_container_name }}"
state: absent
when: bitwarden_enabled is false
listen:
- "stop bitwarden"
- "stop disabled applications"

View file

@ -1,4 +1,6 @@
---
- name: Bitwarden
block:
- name: Create Bitwarden Directories
file:
path: "{{ item }}"
@ -9,7 +11,7 @@
- name: Bitwarden Docker Container
docker_container:
name: bitwarden
name: "{{ bitwarden_container_name }}"
image: bitwardenrs/server:latest
pull: true
ports:
@ -44,9 +46,10 @@
- name: Bitwarden Backup Container
docker_container:
name: bitwarden-backup
name: "{{ bitwarden_backup_container_name }}"
image: bruceforce/bw_backup:latest
pull: true
restart_policy: unless-stopped
volumes_from: bitwarden
memory: "{{ bitwarden_backup_memory }}"
when: bitwarden_enabled is true