46 lines
No EOL
1.1 KiB
YAML
46 lines
No EOL
1.1 KiB
YAML
---
|
|
|
|
- name: Check vaultwarden directory exist
|
|
ansible.builtin.file:
|
|
path: vaultwarden
|
|
state: directory
|
|
|
|
- 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
|
|
owner: root
|
|
group: root
|
|
mode: 0700
|
|
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 |