1
0
Fork 0
myserver-configuration/roles/vaultwarden/tasks/base.yml

44 lines
No EOL
1 KiB
YAML

---
- name: Check vaultwarden directory exist
ansible.builtin.file:
path: vaultwarden
state: directory
register: first_install
- name: Copy template conf
ansible.builtin.template:
backup: true
src: "{{ item.src }}"
dest: "vaultwarden/{{ item.dest }}"
loop:
- { src: 'docker-compose.yml.j2', dest: 'docker-compose.yml' }
register: vaultwarden_copy_templates_results
- name: Copy dotenv as root
ansible.builtin.template:
backup: true
owner: root
group: root
src: ".env.j2"
dest: "vaultwarden/.env"
mode: 0600
become: true
- name: Prepare volume folder
ansible.builtin.file:
path: "{{ item }}"
state: directory
loop:
- "{{ server.work_dir }}/vaultwarden"
- "{{ server.work_dir }}/vaultwarden/base"
- "{{ server.work_dir }}/vaultwarden/db"
become: true
- name: Update and restart container
community.docker.docker_compose:
project_src: vaultwarden
state: present
pull: true
restarted: "{{ vaultwarden_copy_templates_results.changed }}"
become: true