mirror of
https://github.com/Crocmagnon/ansible.git
synced 2024-11-23 07:48:04 +01:00
create dir && restart service on change
This commit is contained in:
parent
d3f116052c
commit
031c804d97
2 changed files with 14 additions and 0 deletions
|
@ -6,3 +6,5 @@ services:
|
||||||
- ./:/app
|
- ./:/app
|
||||||
ports:
|
ports:
|
||||||
- "9008:8080"
|
- "9008:8080"
|
||||||
|
init: true
|
||||||
|
tty: true
|
||||||
|
|
|
@ -3,6 +3,11 @@
|
||||||
hosts: servers
|
hosts: servers
|
||||||
gather_facts: false
|
gather_facts: false
|
||||||
tasks:
|
tasks:
|
||||||
|
- name: Create dir
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ dir }}"
|
||||||
|
state: directory
|
||||||
|
mode: "0775"
|
||||||
- name: Write app.py
|
- name: Write app.py
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
src: files/test_headers/app.py
|
src: files/test_headers/app.py
|
||||||
|
@ -10,6 +15,8 @@
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
owner: gaugendre
|
owner: gaugendre
|
||||||
group: gaugendre
|
group: gaugendre
|
||||||
|
notify:
|
||||||
|
- Restart service
|
||||||
- name: Write docker-compose.yaml
|
- name: Write docker-compose.yaml
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
src: files/test_headers/docker-compose.yaml
|
src: files/test_headers/docker-compose.yaml
|
||||||
|
@ -21,5 +28,10 @@
|
||||||
community.docker.docker_compose_v2:
|
community.docker.docker_compose_v2:
|
||||||
project_src: "{{ dir }}"
|
project_src: "{{ dir }}"
|
||||||
state: present
|
state: present
|
||||||
|
handlers:
|
||||||
|
- name: Restart service
|
||||||
|
community.docker.docker_compose_v2:
|
||||||
|
project_src: "{{ dir }}"
|
||||||
|
state: restarted
|
||||||
vars:
|
vars:
|
||||||
dir: /mnt/data/test_headers
|
dir: /mnt/data/test_headers
|
||||||
|
|
Loading…
Reference in a new issue