mirror of
https://github.com/davestephens/ansible-nas
synced 2025-01-26 10:15:14 +00:00
Bitwarden starts/stops
This commit is contained in:
parent
3adcf026a1
commit
b8fcfd30c0
4 changed files with 75 additions and 51 deletions
3
nas.yml
3
nas.yml
|
@ -52,7 +52,6 @@
|
||||||
- role: bitwarden
|
- role: bitwarden
|
||||||
tags:
|
tags:
|
||||||
- bitwarden
|
- bitwarden
|
||||||
when: (bitwarden_enabled | default(False))
|
|
||||||
|
|
||||||
- role: booksonic
|
- role: booksonic
|
||||||
tags:
|
tags:
|
||||||
|
@ -459,7 +458,7 @@
|
||||||
when: (znc_enabled | default(False))
|
when: (znc_enabled | default(False))
|
||||||
|
|
||||||
post_tasks:
|
post_tasks:
|
||||||
- name: Clean up stopped applications
|
- name: Clean up stopped applications # noqa no-changed-when
|
||||||
command: /bin/true
|
command: /bin/true
|
||||||
notify: "stop disabled applications"
|
notify: "stop disabled applications"
|
||||||
tags:
|
tags:
|
||||||
|
|
|
@ -20,3 +20,7 @@ bitwarden_allow_signups: false
|
||||||
# specs
|
# specs
|
||||||
bitwarden_memory: 1g
|
bitwarden_memory: 1g
|
||||||
bitwarden_backup_memory: 1g
|
bitwarden_backup_memory: 1g
|
||||||
|
|
||||||
|
# docker
|
||||||
|
bitwarden_container_name: bitwarden
|
||||||
|
bitwarden_backup_container_name: bitwarden-backup
|
||||||
|
|
18
roles/bitwarden/handlers/main.yml
Normal file
18
roles/bitwarden/handlers/main.yml
Normal 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"
|
|
@ -1,52 +1,55 @@
|
||||||
---
|
---
|
||||||
- name: Create Bitwarden Directories
|
- name: Bitwarden
|
||||||
file:
|
block:
|
||||||
path: "{{ item }}"
|
- name: Create Bitwarden Directories
|
||||||
state: directory
|
file:
|
||||||
mode: "0755"
|
path: "{{ item }}"
|
||||||
with_items:
|
state: directory
|
||||||
- "{{ bitwarden_data_directory }}"
|
mode: "0755"
|
||||||
|
with_items:
|
||||||
|
- "{{ bitwarden_data_directory }}"
|
||||||
|
|
||||||
- name: Bitwarden Docker Container
|
- name: Bitwarden Docker Container
|
||||||
docker_container:
|
docker_container:
|
||||||
name: bitwarden
|
name: "{{ bitwarden_container_name }}"
|
||||||
image: bitwardenrs/server:latest
|
image: bitwardenrs/server:latest
|
||||||
pull: true
|
pull: true
|
||||||
ports:
|
ports:
|
||||||
- "{{ bitwarden_port_a }}:80"
|
- "{{ bitwarden_port_a }}:80"
|
||||||
- "{{ bitwarden_port_b }}:3012"
|
- "{{ bitwarden_port_b }}:3012"
|
||||||
volumes:
|
volumes:
|
||||||
- "{{ bitwarden_data_directory }}:/data:rw"
|
- "{{ bitwarden_data_directory }}:/data:rw"
|
||||||
env:
|
env:
|
||||||
SIGNUPS_ALLOWED: "{{ bitwarden_allow_signups }}"
|
SIGNUPS_ALLOWED: "{{ bitwarden_allow_signups }}"
|
||||||
ADMIN_TOKEN: "{{ bitwarden_admin_token }}"
|
ADMIN_TOKEN: "{{ bitwarden_admin_token }}"
|
||||||
LOG_FILE: "/data/bitwarden.log"
|
LOG_FILE: "/data/bitwarden.log"
|
||||||
WEBSOCKET_ENABLED: "true"
|
WEBSOCKET_ENABLED: "true"
|
||||||
labels:
|
labels:
|
||||||
traefik.enable: "{{ bitwarden_available_externally | string }}"
|
traefik.enable: "{{ bitwarden_available_externally | string }}"
|
||||||
traefik.http.routers.bitwarden.rule: "Host(`{{ bitwarden_hostname }}.{{ ansible_nas_domain }}`)"
|
traefik.http.routers.bitwarden.rule: "Host(`{{ bitwarden_hostname }}.{{ ansible_nas_domain }}`)"
|
||||||
traefik.http.routers.bitwarden.tls.certresolver: "letsencrypt"
|
traefik.http.routers.bitwarden.tls.certresolver: "letsencrypt"
|
||||||
traefik.http.routers.bitwarden.tls.domains[0].main: "{{ ansible_nas_domain }}"
|
traefik.http.routers.bitwarden.tls.domains[0].main: "{{ ansible_nas_domain }}"
|
||||||
traefik.http.routers.bitwarden.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
|
traefik.http.routers.bitwarden.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
|
||||||
traefik.http.routers.bitwarden.service: "bitwarden"
|
traefik.http.routers.bitwarden.service: "bitwarden"
|
||||||
traefik.http.routers.bitwarden.middlewares: "bitwarden-ipwhitelist@docker"
|
traefik.http.routers.bitwarden.middlewares: "bitwarden-ipwhitelist@docker"
|
||||||
traefik.http.services.bitwarden.loadbalancer.server.port: "80"
|
traefik.http.services.bitwarden.loadbalancer.server.port: "80"
|
||||||
traefik.http.routers.bitwarden-ws.rule: "Host(`{{ bitwarden_hostname }}.{{ ansible_nas_domain }}`) && Path(`/notifications/hub`)"
|
traefik.http.routers.bitwarden-ws.rule: "Host(`{{ bitwarden_hostname }}.{{ ansible_nas_domain }}`) && Path(`/notifications/hub`)"
|
||||||
traefik.http.routers.bitwarden-ws.tls.certresolver: "letsencrypt"
|
traefik.http.routers.bitwarden-ws.tls.certresolver: "letsencrypt"
|
||||||
traefik.http.routers.bitwarden-ws.tls.domains[0].main: "{{ ansible_nas_domain }}"
|
traefik.http.routers.bitwarden-ws.tls.domains[0].main: "{{ ansible_nas_domain }}"
|
||||||
traefik.http.routers.bitwarden-ws.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
|
traefik.http.routers.bitwarden-ws.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
|
||||||
traefik.http.routers.bitwarden-ws.service: "bitwarden-ws"
|
traefik.http.routers.bitwarden-ws.service: "bitwarden-ws"
|
||||||
traefik.http.routers.bitwarden-ws.middlewares: "bitwarden-ipwhitelist@docker"
|
traefik.http.routers.bitwarden-ws.middlewares: "bitwarden-ipwhitelist@docker"
|
||||||
traefik.http.services.bitwarden-ws.loadbalancer.server.port: "3012"
|
traefik.http.services.bitwarden-ws.loadbalancer.server.port: "3012"
|
||||||
traefik.http.middlewares.bitwarden-ipwhitelist.ipwhitelist.sourcerange: "{{ bitwarden_ip_whitelist }}"
|
traefik.http.middlewares.bitwarden-ipwhitelist.ipwhitelist.sourcerange: "{{ bitwarden_ip_whitelist }}"
|
||||||
memory: "{{ bitwarden_memory }}"
|
memory: "{{ bitwarden_memory }}"
|
||||||
restart_policy: unless-stopped
|
restart_policy: unless-stopped
|
||||||
|
|
||||||
- name: Bitwarden Backup Container
|
- name: Bitwarden Backup Container
|
||||||
docker_container:
|
docker_container:
|
||||||
name: bitwarden-backup
|
name: "{{ bitwarden_backup_container_name }}"
|
||||||
image: bruceforce/bw_backup:latest
|
image: bruceforce/bw_backup:latest
|
||||||
pull: true
|
pull: true
|
||||||
restart_policy: unless-stopped
|
restart_policy: unless-stopped
|
||||||
volumes_from: bitwarden
|
volumes_from: bitwarden
|
||||||
memory: "{{ bitwarden_backup_memory }}"
|
memory: "{{ bitwarden_backup_memory }}"
|
||||||
|
when: bitwarden_enabled is true
|
||||||
|
|
Loading…
Reference in a new issue