Add build state, rename present->running
This commit is contained in:
parent
6ff153b716
commit
f216347cae
@ -2,5 +2,5 @@
|
|||||||
# defaults file for roles/compose_project
|
# defaults file for roles/compose_project
|
||||||
service: dummy
|
service: dummy
|
||||||
compose_dir: /home/core/compose
|
compose_dir: /home/core/compose
|
||||||
state: present # or absent
|
state: present # or running, build, absent
|
||||||
restart: smart # or always or never
|
execute: smart # or always or never
|
||||||
|
13
tasks/build.yml
Normal file
13
tasks/build.yml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- include_tasks: present.yml
|
||||||
|
|
||||||
|
- name: Build Service
|
||||||
|
community.docker.docker_compose:
|
||||||
|
project_src: "{{ service_dir | mandatory }}"
|
||||||
|
state: present
|
||||||
|
restarted: true
|
||||||
|
recreate: smart
|
||||||
|
build: true
|
||||||
|
remove_orphans: true
|
||||||
|
when: (compose_files.changed and execute == "smart") or execute == "always"
|
@ -9,7 +9,13 @@
|
|||||||
msg: "Working on {{ service }}{% if service_name is defined %}-{{ service_name }}{% endif %}"
|
msg: "Working on {{ service }}{% if service_name is defined %}-{{ service_name }}{% endif %}"
|
||||||
verbosity: 0
|
verbosity: 0
|
||||||
|
|
||||||
- include_tasks: create.yml
|
- include_tasks: running.yml
|
||||||
|
when: state == "running"
|
||||||
|
|
||||||
|
- include_tasks: build.yml
|
||||||
|
when: state == "build"
|
||||||
|
|
||||||
|
- include_tasks: present.yml
|
||||||
when: state == "present"
|
when: state == "present"
|
||||||
|
|
||||||
- include_tasks: remove.yml
|
- include_tasks: remove.yml
|
||||||
|
@ -56,13 +56,3 @@
|
|||||||
path: "{{ temp_file.path }}"
|
path: "{{ temp_file.path }}"
|
||||||
state: absent
|
state: absent
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
- name: Restart Service
|
|
||||||
community.docker.docker_compose:
|
|
||||||
project_src: "{{ service_dir | mandatory }}"
|
|
||||||
state: present
|
|
||||||
restarted: true
|
|
||||||
recreate: smart
|
|
||||||
build: true
|
|
||||||
remove_orphans: true
|
|
||||||
when: (compose_files.changed and restart == "smart") or restart == "always"
|
|
14
tasks/running.yml
Normal file
14
tasks/running.yml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- include_tasks: present.yml
|
||||||
|
|
||||||
|
- name: Restart Service
|
||||||
|
community.docker.docker_compose:
|
||||||
|
project_src: "{{ service_dir | mandatory }}"
|
||||||
|
pull: true
|
||||||
|
state: present
|
||||||
|
restarted: true
|
||||||
|
recreate: smart
|
||||||
|
build: false
|
||||||
|
remove_orphans: true
|
||||||
|
when: (compose_files.changed and execute == "smart") or execute == "always"
|
Loading…
Reference in New Issue
Block a user