Skip to content

Commit

Permalink
Ajoute le rôle vaultwarden
Browse files Browse the repository at this point in the history
  • Loading branch information
philippemilink committed May 19, 2024
1 parent 396f4ff commit ca3da1a
Show file tree
Hide file tree
Showing 9 changed files with 729 additions and 0 deletions.
3 changes: 3 additions & 0 deletions group_vars/all/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ zds_antispam_dir: /opt/zds-antispam
logdir: /var/log/zds
appuser: zds
latex_template_version: c285c1c1a60807b732472b036ecb204ac2cb48f3
pass_manager_user: vaultwarden
pass_manager_dir: /opt/vaultwarden
pass_manager_port: 8081
4 changes: 4 additions & 0 deletions group_vars/production/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ certificate:
munin_certificate:
cert: /etc/letsencrypt/live/munin.zestedesavoir.com/fullchain.pem
key: /etc/letsencrypt/live/munin.zestedesavoir.com/privkey.pem
pass_manager_host: "vault-ro.{{ http_host }}"
pass_manager_certificate:
cert: "/etc/letsencrypt/live/{{ pass_manager_host }}/fullchain.pem"
key: "/etc/letsencrypt/live/{{ pass_manager_host }}/privkey.pem"
3 changes: 3 additions & 0 deletions playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@
when: env == "beta"
- role: munin
tags: bootstrap
# - role: vaultwarden # not used in practice
# tags: bootstrap
# when: (env == "prod") or (env == "vagrant")
37 changes: 37 additions & 0 deletions roles/vaultwarden/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
- name: should have a user named {{ pass_manager_user }}
ansible.builtin.user:
name: "{{ pass_manager_user }}"
shell: /bin/false
home: "{{ pass_manager_dir }}"
comment: Vaultwarden

- name: create the needed directories
ansible.builtin.file:
path: "{{ item }}"
state: directory
owner: "{{ pass_manager_user }}"
group: "{{ pass_manager_user }}"
mode: "0750"
with_items:
- "{{ pass_manager_dir }}"
- "{{ pass_manager_dir }}/data"

- name: create environment file
ansible.builtin.template:
src: templates/vaultwarden.env.j2
dest: "{{ pass_manager_dir }}/vaultwarden.env"
mode: "0640"

- name: create service file
ansible.builtin.template:
src: templates/vaultwarden.service.j2
dest: /etc/systemd/system/vaultwarden.service
mode: u=rw,g=r,o=r

- name: start service
ansible.builtin.systemd:
state: started
name: vaultwarden.service
enabled: true
daemon_reload: true
Loading

0 comments on commit ca3da1a

Please sign in to comment.