2023-05-20 16:36:15 +02:00
|
|
|
---
|
|
|
|
|
|
|
|
- name: Check protonmail directory exist
|
|
|
|
ansible.builtin.file:
|
|
|
|
path: protonmail
|
|
|
|
state: directory
|
|
|
|
|
|
|
|
- name: Copy protonmail conf
|
|
|
|
ansible.builtin.copy:
|
|
|
|
src: .
|
|
|
|
dest: protonmail/
|
|
|
|
register: protonmail_copy_files_results
|
|
|
|
|
2023-05-20 19:48:18 +02:00
|
|
|
- name: Copy template conf
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: "{{ item.src }}"
|
|
|
|
dest: "protonmail/{{ item.dest }}"
|
|
|
|
loop:
|
|
|
|
- { src: 'docker-compose.yml.j2', dest: 'docker-compose.yml' }
|
|
|
|
register: protonmail_copy_templates_results
|
|
|
|
|
2023-05-20 16:36:15 +02:00
|
|
|
- name: Create protonmail network
|
|
|
|
community.docker.docker_network:
|
|
|
|
name: protonmail
|
|
|
|
state: present
|
|
|
|
become: true
|
|
|
|
|
|
|
|
- name: Show message if not initialized
|
|
|
|
ansible.builtin.debug:
|
|
|
|
msg: Please run init.sh in protonmail folder and set variable protonmail.initialized to true and restart tasks
|
|
|
|
when: not protonmail.initialized
|
|
|
|
|
2023-05-21 10:57:56 +02:00
|
|
|
- name: Update and restart container
|
2023-05-20 16:36:15 +02:00
|
|
|
community.docker.docker_compose:
|
|
|
|
project_src: protonmail
|
|
|
|
state: present
|
|
|
|
pull: true
|
2023-05-21 10:57:56 +02:00
|
|
|
restarted: "{{ protonmail.initialized and (protonmail_copy_templates_results.changed or protonmail_copy_files_results.changed) }}"
|
2023-05-20 16:36:15 +02:00
|
|
|
become: true
|