40 lines
No EOL
909 B
YAML
40 lines
No EOL
909 B
YAML
---
|
|
|
|
- name: Check vaultwarden directory exist
|
|
ansible.builtin.file:
|
|
path: vaultwarden
|
|
state: directory
|
|
register: first_install
|
|
|
|
- name: Copy template conf
|
|
ansible.builtin.template:
|
|
src: "{{ item.src }}"
|
|
dest: "vaultwarden/{{ item.dest }}"
|
|
loop:
|
|
- { src: 'docker-compose.yml', dest: 'docker-compose.yml' }
|
|
|
|
- name: Copy dotenv as root
|
|
ansible.builtin.template:
|
|
owner: root
|
|
group: root
|
|
src: ".env"
|
|
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_v2:
|
|
project_src: vaultwarden
|
|
state: present
|
|
pull: always
|
|
become: true |