Refactor everything
This commit is contained in:
parent
2e100d290f
commit
3f2e60becf
69 changed files with 366 additions and 281 deletions
|
@ -4,8 +4,8 @@
|
|||
|
||||
- name: Import tasks to template docker compose file
|
||||
ansible.builtin.import_tasks: tasks/steps/template-docker-compose.yml
|
||||
when: not no_compose|default(False) # TODO remove when fixing "var-naming[no-role-prefix]"
|
||||
when: compose is defined
|
||||
|
||||
- name: Import tasks create a service.env file
|
||||
ansible.builtin.import_tasks: tasks/steps/template-service-env.yml
|
||||
when: compose.env|default(False)
|
||||
when: env is defined
|
||||
|
|
5
_ansible/tasks/set-default-facts.yml
Normal file
5
_ansible/tasks/set-default-facts.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
- name: Set common facts
|
||||
ansible.builtin.set_fact:
|
||||
service_path: "{{ (services_path, role_name | replace('_', '-')) | path_join }}"
|
||||
docker_force_recreate: ""
|
|
@ -1,9 +1,4 @@
|
|||
---
|
||||
- name: Set common facts
|
||||
ansible.builtin.set_fact:
|
||||
service_path: "{{ (services_path, svc.name) | path_join }}"
|
||||
docker_force_recreate: ""
|
||||
|
||||
- name: Create a service directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ service_path }}"
|
||||
|
|
|
@ -4,15 +4,9 @@
|
|||
src: caddy_site.conf.j2
|
||||
dest: "{{ (caddy_config_path, svc.domain + '.conf') | path_join }}"
|
||||
mode: "0644"
|
||||
register: template_result
|
||||
notify:
|
||||
- Reload caddy
|
||||
|
||||
- name: Register caddy site
|
||||
ansible.builtin.set_fact:
|
||||
managed_sites: "{{ managed_sites + [svc.domain + '.conf'] }}"
|
||||
|
||||
- name: Reload caddy
|
||||
ansible.builtin.command:
|
||||
cmd: docker compose exec app sh -c "caddy validate --config /etc/caddy/Caddyfile && caddy reload --config /etc/caddy/Caddyfile"
|
||||
chdir: "{{ caddy_path }}"
|
||||
when: "'local-dev' != inventory_hostname"
|
||||
changed_when: template_result.changed
|
||||
|
|
Reference in a new issue