From a669e34f5765c2dbe2b155b64835f579cf65bf76 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Sat, 1 May 2021 23:00:37 +0100 Subject: [PATCH] Update bitwarden_rs to vaultwarden I'll do the full rename of everything another time --- ansible/main.yml | 2 +- .../bitwarden_rs/files/docker-compose.yml | 48 ------------------- ansible/roles/bitwarden_rs/handlers/main.yml | 4 -- .../vaultwarden/files/docker-compose.yml | 48 +++++++++++++++++++ ansible/roles/vaultwarden/handlers/main.yml | 4 ++ .../tasks/main.yml | 6 +-- .../vars/main.yml | 0 7 files changed, 56 insertions(+), 56 deletions(-) delete mode 100644 ansible/roles/bitwarden_rs/files/docker-compose.yml delete mode 100644 ansible/roles/bitwarden_rs/handlers/main.yml create mode 100644 ansible/roles/vaultwarden/files/docker-compose.yml create mode 100644 ansible/roles/vaultwarden/handlers/main.yml rename ansible/roles/{bitwarden_rs => vaultwarden}/tasks/main.yml (77%) rename ansible/roles/{bitwarden_rs => vaultwarden}/vars/main.yml (100%) diff --git a/ansible/main.yml b/ansible/main.yml index 39111cc..c8e625e 100644 --- a/ansible/main.yml +++ b/ansible/main.yml @@ -63,7 +63,7 @@ - yourls - pve_nebula_route - privatebin - - bitwarden_rs + - vaultwarden - hosts: ingress roles: diff --git a/ansible/roles/bitwarden_rs/files/docker-compose.yml b/ansible/roles/bitwarden_rs/files/docker-compose.yml deleted file mode 100644 index 1fa64ed..0000000 --- a/ansible/roles/bitwarden_rs/files/docker-compose.yml +++ /dev/null @@ -1,48 +0,0 @@ -version: "2.3" - -services: - bitwarden: - image: bitwardenrs/server:1.20.0-alpine - restart: unless-stopped - user: "{{ docker_user.id }}:{{ docker_user.id }}" - volumes: - - "{{ app_data_dir }}/bitwarden_rs/:/data" - depends_on: - - db - dns: 1.1.1.1 - labels: - - traefik.enable=true - - - traefik.http.routers.bitwarden-ui.rule=Host(`bw.jakehoward.tech`) - - traefik.http.routers.bitwarden-ui.service=bitwarden-ui - - traefik.http.services.bitwarden-ui.loadbalancer.server.port=80 - - traefik.http.routers.bitwarden-ui.tls.certresolver=le - - - traefik.http.routers.bitwarden-websocket.rule=Host(`bw.jakehoward.tech`) && Path(`/notifications/hub`) - - traefik.http.routers.bitwarden-websocket.service=bitwarden-websocket - - traefik.http.services.bitwarden-websocket.loadbalancer.server.port=3012 - - traefik.http.routers.bitwarden-websocket.tls.certresolver=le - - - traefik.http.middlewares.bw-ratelimit.ratelimit.average=5 - - traefik.http.middlewares.bw-ratelimit.ratelimit.burst=1000 - - traefik.http.middlewares.bw-compress.compress=true - - - traefik.http.routers.bitwarden-ui.middlewares=bw-ratelimit,bw-compress - - traefik.http.routers.bitwarden-websocket.middlewares=bw-ratelimit,bw-compress - environment: - - SIGNUPS_ALLOWED=false - - DOMAIN=https://bw.jakehoward.tech - - SHOW_PASSWORD_HINT=false - - DATABASE_URL=postgres://bitwarden:{{ bitwarden_database_password }}@db/bitwarden - - INVITATIONS_ALLOWED=false - - ROCKET_WORKERS={{ ansible_processor_nproc }} - - WEBSOCKET_ENABLED=true - - db: - image: postgres:12-alpine - restart: unless-stopped - volumes: - - /mnt/tank/dbs/postgres/bitwarden_rs/:/var/lib/postgresql/data - environment: - - POSTGRES_PASSWORD={{ bitwarden_database_password }} - - POSTGRES_USER=bitwarden diff --git a/ansible/roles/bitwarden_rs/handlers/main.yml b/ansible/roles/bitwarden_rs/handlers/main.yml deleted file mode 100644 index f5c145d..0000000 --- a/ansible/roles/bitwarden_rs/handlers/main.yml +++ /dev/null @@ -1,4 +0,0 @@ -- name: restart bitwarden_rs - shell: - chdir: /opt/bitwarden_rs - cmd: "{{ docker_update_command }}" diff --git a/ansible/roles/vaultwarden/files/docker-compose.yml b/ansible/roles/vaultwarden/files/docker-compose.yml new file mode 100644 index 0000000..ecece52 --- /dev/null +++ b/ansible/roles/vaultwarden/files/docker-compose.yml @@ -0,0 +1,48 @@ +version: "2.3" + +services: + vaultwarden: + image: vaultwarden/server:1.21.0-alpine + restart: unless-stopped + user: "{{ docker_user.id }}:{{ docker_user.id }}" + volumes: + - "{{ app_data_dir }}/vaultwarden/:/data" + depends_on: + - db + dns: 1.1.1.1 + labels: + - traefik.enable=true + + - traefik.http.routers.vaultwarden-ui.rule=Host(`bw.jakehoward.tech`) + - traefik.http.routers.vaultwarden-ui.service=vaultwarden-ui + - traefik.http.services.vaultwarden-ui.loadbalancer.server.port=80 + - traefik.http.routers.vaultwarden-ui.tls.certresolver=le + + - traefik.http.routers.vaultwarden-websocket.rule=Host(`bw.jakehoward.tech`) && Path(`/notifications/hub`) + - traefik.http.routers.vaultwarden-websocket.service=vaultwarden-websocket + - traefik.http.services.vaultwarden-websocket.loadbalancer.server.port=3012 + - traefik.http.routers.vaultwarden-websocket.tls.certresolver=le + + - traefik.http.middlewares.vaultwarden-ratelimit.ratelimit.average=5 + - traefik.http.middlewares.vaultwarden-ratelimit.ratelimit.burst=1000 + - traefik.http.middlewares.vaultwarden-compress.compress=true + + - traefik.http.routers.vaultwarden-ui.middlewares=vaultwarden-ratelimit,vaultwarden-compress + - traefik.http.routers.vaultwarden-websocket.middlewares=vaultwarden-ratelimit,vaultwarden-compress + environment: + - SIGNUPS_ALLOWED=false + - DOMAIN=https://bw.jakehoward.tech + - SHOW_PASSWORD_HINT=false + - DATABASE_URL=postgres://bitwarden:{{ bitwarden_database_password }}@db/bitwarden + - INVITATIONS_ALLOWED=false + - ROCKET_WORKERS={{ ansible_processor_nproc }} + - WEBSOCKET_ENABLED=true + + db: + image: postgres:12-alpine + restart: unless-stopped + volumes: + - /mnt/tank/dbs/postgres/vaultwarden/:/var/lib/postgresql/data + environment: + - POSTGRES_PASSWORD={{ bitwarden_database_password }} + - POSTGRES_USER=bitwarden diff --git a/ansible/roles/vaultwarden/handlers/main.yml b/ansible/roles/vaultwarden/handlers/main.yml new file mode 100644 index 0000000..7fed055 --- /dev/null +++ b/ansible/roles/vaultwarden/handlers/main.yml @@ -0,0 +1,4 @@ +- name: restart vaultwarden + shell: + chdir: /opt/vaultwarden + cmd: "{{ docker_update_command }}" diff --git a/ansible/roles/bitwarden_rs/tasks/main.yml b/ansible/roles/vaultwarden/tasks/main.yml similarity index 77% rename from ansible/roles/bitwarden_rs/tasks/main.yml rename to ansible/roles/vaultwarden/tasks/main.yml index 231671d..229a4d6 100644 --- a/ansible/roles/bitwarden_rs/tasks/main.yml +++ b/ansible/roles/vaultwarden/tasks/main.yml @@ -1,6 +1,6 @@ - name: Create install directory file: - path: /opt/bitwarden_rs + path: /opt/vaultwarden state: directory owner: "{{ docker_user.name }}" mode: "{{ docker_compose_directory_mask }}" @@ -9,9 +9,9 @@ - name: Install compose file template: src: files/docker-compose.yml - dest: /opt/bitwarden_rs/docker-compose.yml + dest: /opt/vaultwarden/docker-compose.yml mode: "{{ docker_compose_file_mask }}" owner: "{{ docker_user.name }}" validate: docker-compose -f %s config - notify: restart bitwarden_rs + notify: restart vaultwarden become: true diff --git a/ansible/roles/bitwarden_rs/vars/main.yml b/ansible/roles/vaultwarden/vars/main.yml similarity index 100% rename from ansible/roles/bitwarden_rs/vars/main.yml rename to ansible/roles/vaultwarden/vars/main.yml