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
|
||||
gather_facts: false
|
||||
tasks:
|
||||
|
@ -8,30 +8,37 @@
|
|||
path: "{{ dir }}"
|
||||
state: directory
|
||||
mode: "0775"
|
||||
- name: Write app.py
|
||||
- name: Write files
|
||||
ansible.builtin.copy:
|
||||
src: files/test_headers/app.py
|
||||
dest: "{{ dir }}/app.py"
|
||||
mode: "0644"
|
||||
owner: gaugendre
|
||||
group: gaugendre
|
||||
src: "{{ item }}"
|
||||
dest: "{{ dir }}/"
|
||||
mode: preserve
|
||||
with_fileglob:
|
||||
- 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:
|
||||
- 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
|
||||
community.docker.docker_compose_v2:
|
||||
project_src: "{{ dir }}"
|
||||
state: present
|
||||
|
||||
handlers:
|
||||
- name: Restart service
|
||||
community.docker.docker_compose_v2:
|
||||
project_src: "{{ dir }}"
|
||||
state: restarted
|
||||
|
||||
vars:
|
||||
dir: /mnt/data/test_headers
|
||||
app_name: test_headers
|
||||
dir: /mnt/data/{{ app_name }}
|
||||
|
|
Loading…
Reference in a new issue