homelab/roles/bitwarden/tasks/main.yml

80 lines
2.1 KiB
YAML
Raw Normal View History

2020-06-13 05:12:23 +00:00
- name: Install expect
apt:
name: expect
state: present
- name: Create Bitwarden directory
file:
2021-02-27 05:00:52 +00:00
path: "{{ bitwarden_root }}"
2020-06-13 05:12:23 +00:00
state: directory
- name: Download Bitwarden script
get_url:
url: "https://raw.githubusercontent.com/\
2022-05-20 03:19:09 +00:00
bitwarden/self-host/master/bitwarden.sh"
2021-02-27 05:00:52 +00:00
dest: "{{ bitwarden_root }}"
2020-06-13 05:12:23 +00:00
mode: u+x
- name: Install Bitwarden script wrapper
template:
src: bw_wrapper.j2
2021-02-27 05:00:52 +00:00
dest: "{{ bitwarden_root }}/bw_wrapper"
2020-06-13 05:12:23 +00:00
mode: u+x
2021-02-27 05:00:52 +00:00
- name: Run Bitwarden installation script
shell: "{{ bitwarden_root }}/bw_wrapper"
args:
creates: "{{ bitwarden_root }}/bwdata/config.yml"
- name: Install docker-compose override
template:
src: compose.override.yml.j2
dest: "{{ bitwarden_root }}/bwdata/docker/docker-compose.override.yml"
2022-05-22 04:19:56 +00:00
when: traefik_version is defined
2022-05-27 02:26:35 +00:00
notify: rebuild_bitwarden
2021-02-27 05:00:52 +00:00
- name: Disable bitwarden-nginx HTTP on 80
replace:
path: "{{ bitwarden_root }}/bwdata/config.yml"
regexp: "^http_port: 80$"
replace: "http_port: 8080"
when: not bitwarden_standalone
2022-05-27 02:26:35 +00:00
notify: rebuild_bitwarden
2021-02-27 05:00:52 +00:00
- name: Disable bitwarden-nginx HTTPS on 443
replace:
path: "{{ bitwarden_root }}/bwdata/config.yml"
regexp: "^https_port: 443$"
replace: "https_port: 8443"
when: not bitwarden_standalone
2022-05-27 02:26:35 +00:00
notify: rebuild_bitwarden
2021-02-27 05:00:52 +00:00
- name: Disable Bitwarden managed Lets Encrypt
replace:
path: "{{ bitwarden_root }}/bwdata/config.yml"
regexp: "^ssl_managed_lets_encrypt: true$"
replace: "ssl_managed_lets_encrypt: false"
when: not bitwarden_standalone or not bitwarden_production
2022-05-27 02:26:35 +00:00
notify: rebuild_bitwarden
2021-02-27 05:00:52 +00:00
- name: Disable Bitwarden managed SSL
replace:
path: "{{ bitwarden_root }}/bwdata/config.yml"
regexp: "^ssl: true$"
replace: "ssl: false"
when: not bitwarden_standalone
2022-05-27 02:26:35 +00:00
notify: rebuild_bitwarden
- name: Install Bitwarden systemd service
template:
src: bitwarden.service.j2
dest: "/etc/systemd/system/{{ bitwarden_name }}.service"
register: bitwarden_systemd
notify: rebuild_bitwarden
- name: Reload systemd manager configuration
systemd:
daemon_reload: true
when: bitwarden_systemd.changed
notify: rebuild_bitwarden