2023-05-13 06:44:40 +05:30
|
|
|
---
|
2023-08-09 16:26:58 +05:30
|
|
|
- name: Create directory for {{item}}
|
2023-07-07 22:40:54 +05:30
|
|
|
ansible.builtin.file:
|
2023-07-14 21:32:36 +05:30
|
|
|
path: "{{ docker_dir }}/{{ item }}"
|
2023-05-29 21:19:16 +05:30
|
|
|
state: directory
|
2023-07-07 22:40:54 +05:30
|
|
|
mode: "0755"
|
2023-07-19 20:56:23 +05:30
|
|
|
tags: docker,soleil,pizza
|
2023-06-05 14:32:24 +05:30
|
|
|
|
2023-08-09 16:26:58 +05:30
|
|
|
- name: Copy docker-compose templates for the {{item}}
|
2023-07-07 22:40:54 +05:30
|
|
|
ansible.builtin.template:
|
2023-07-14 21:32:36 +05:30
|
|
|
src: "./compose/{{ item }}/compose.yml.j2"
|
|
|
|
dest: "{{ docker_dir }}/{{ item }}/compose.yml"
|
2023-07-07 22:40:54 +05:30
|
|
|
backup: true
|
|
|
|
mode: preserve
|
2023-05-13 06:44:40 +05:30
|
|
|
register: check_status
|
2023-07-19 20:56:23 +05:30
|
|
|
tags: docker,soleil,pizza
|
2023-05-13 06:44:40 +05:30
|
|
|
|
2023-08-09 16:26:58 +05:30
|
|
|
- name: Check if extras file exists for the {{item}}
|
2023-07-07 22:40:54 +05:30
|
|
|
delegate_to: localhost
|
|
|
|
ansible.builtin.stat:
|
|
|
|
path: ./compose/{{ item }}/extras.conf.j2
|
2023-05-13 06:44:40 +05:30
|
|
|
register: file
|
2023-07-19 20:56:23 +05:30
|
|
|
tags: docker,soleil,pizza
|
2023-06-05 14:32:24 +05:30
|
|
|
|
2023-05-13 06:44:40 +05:30
|
|
|
- name: Copy extras file
|
2023-07-07 22:40:54 +05:30
|
|
|
ansible.builtin.template:
|
2023-07-14 21:32:36 +05:30
|
|
|
src: "./compose/{{ item }}/extras.conf.j2"
|
|
|
|
dest: "{{ docker_dir }}/{{ item }}/extras.conf"
|
2023-07-07 22:40:54 +05:30
|
|
|
backup: true
|
|
|
|
mode: preserve
|
2023-05-13 06:44:40 +05:30
|
|
|
when: file.stat.exists
|
2023-07-19 20:56:23 +05:30
|
|
|
tags: docker,soleil,pizza
|
2023-05-13 06:44:40 +05:30
|
|
|
|
2023-08-09 16:26:58 +05:30
|
|
|
- name: "Update docker {{item}} image"
|
2023-07-07 22:40:54 +05:30
|
|
|
ansible.builtin.command:
|
2023-07-14 21:32:36 +05:30
|
|
|
chdir: "{{ docker_dir }}/{{ item }}"
|
2023-05-13 06:44:40 +05:30
|
|
|
cmd: docker compose pull
|
2023-05-29 21:19:16 +05:30
|
|
|
when: check_status.changed
|
2023-07-14 21:32:36 +05:30
|
|
|
register: updateout
|
|
|
|
changed_when: updateout.rc != 0
|
2023-07-19 20:56:23 +05:30
|
|
|
tags: docker,soleil,pizza
|
2023-05-13 06:44:40 +05:30
|
|
|
|
2023-08-09 16:26:58 +05:30
|
|
|
- name: "Stop docker {{item}}"
|
2023-07-07 22:40:54 +05:30
|
|
|
ansible.builtin.command:
|
2023-07-14 21:32:36 +05:30
|
|
|
chdir: "{{ docker_dir }}/{{ item }}"
|
2023-05-13 06:44:40 +05:30
|
|
|
cmd: docker compose down
|
2023-05-29 21:19:16 +05:30
|
|
|
when: check_status.changed
|
2023-07-14 21:32:36 +05:30
|
|
|
register: stopout
|
|
|
|
changed_when: stopout.rc != 0
|
2023-07-19 20:56:23 +05:30
|
|
|
tags: docker,soleil,pizza
|
2023-05-13 06:44:40 +05:30
|
|
|
|
2023-08-09 16:26:58 +05:30
|
|
|
- name: "Start docker {{item}}"
|
2023-07-07 22:40:54 +05:30
|
|
|
ansible.builtin.command:
|
2023-07-14 21:32:36 +05:30
|
|
|
chdir: "{{ docker_dir }}/{{ item }}"
|
2023-05-13 06:44:40 +05:30
|
|
|
cmd: docker compose up -d --build --remove-orphans
|
2023-05-29 21:19:16 +05:30
|
|
|
when: check_status.changed
|
2023-07-14 21:32:36 +05:30
|
|
|
register: startout
|
|
|
|
changed_when: startout.rc != 0
|
2023-07-19 20:56:23 +05:30
|
|
|
tags: docker,soleil,pizza
|