mirror of
https://github.com/Crocmagnon/ansible.git
synced 2024-11-24 00:08:02 +01:00
refactor test_headers
This commit is contained in:
parent
cc3d3687b7
commit
85623a90f8
1 changed files with 22 additions and 15 deletions
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
- name: Setup test_headers
|
- name: Test headers
|
||||||
hosts: servers
|
hosts: servers
|
||||||
gather_facts: false
|
gather_facts: false
|
||||||
tasks:
|
tasks:
|
||||||
|
@ -8,30 +8,37 @@
|
||||||
path: "{{ dir }}"
|
path: "{{ dir }}"
|
||||||
state: directory
|
state: directory
|
||||||
mode: "0775"
|
mode: "0775"
|
||||||
- name: Write app.py
|
- name: Write files
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
src: files/test_headers/app.py
|
src: "{{ item }}"
|
||||||
dest: "{{ dir }}/app.py"
|
dest: "{{ dir }}/"
|
||||||
mode: "0644"
|
mode: preserve
|
||||||
owner: gaugendre
|
with_fileglob:
|
||||||
group: gaugendre
|
- files/{{ app_name }}/*
|
||||||
|
- files/{{ app_name }}/.*
|
||||||
|
notify:
|
||||||
|
- Restart service
|
||||||
|
- name: Write templates
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: "{{ item }}"
|
||||||
|
dest: "{{ dir }}/{{ item | basename | regex_replace('\\.j2$', '') }}"
|
||||||
|
mode: preserve
|
||||||
|
with_fileglob:
|
||||||
|
- templates/{{ app_name }}/*.j2
|
||||||
|
- templates/{{ app_name }}/.*.j2
|
||||||
notify:
|
notify:
|
||||||
- Restart service
|
- Restart service
|
||||||
- name: Write docker-compose.yaml
|
|
||||||
ansible.builtin.copy:
|
|
||||||
src: files/test_headers/docker-compose.yaml
|
|
||||||
dest: "{{ dir }}/docker-compose.yaml"
|
|
||||||
mode: "0644"
|
|
||||||
owner: gaugendre
|
|
||||||
group: gaugendre
|
|
||||||
- name: Ensure service is started
|
- name: Ensure service is started
|
||||||
community.docker.docker_compose_v2:
|
community.docker.docker_compose_v2:
|
||||||
project_src: "{{ dir }}"
|
project_src: "{{ dir }}"
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
handlers:
|
handlers:
|
||||||
- name: Restart service
|
- name: Restart service
|
||||||
community.docker.docker_compose_v2:
|
community.docker.docker_compose_v2:
|
||||||
project_src: "{{ dir }}"
|
project_src: "{{ dir }}"
|
||||||
state: restarted
|
state: restarted
|
||||||
|
|
||||||
vars:
|
vars:
|
||||||
dir: /mnt/data/test_headers
|
app_name: test_headers
|
||||||
|
dir: /mnt/data/{{ app_name }}
|
||||||
|
|
Loading…
Reference in a new issue