Caddy role: single files/Caddyfile.j2 template (overlord pattern)
- template moved to ansible/files/Caddyfile.j2, tasks folded into main.yaml
This commit is contained in:
@@ -1,3 +1,12 @@
|
|||||||
---
|
---
|
||||||
|
- name: Read snippet from template
|
||||||
|
ansible.builtin.set_fact:
|
||||||
|
caddy_snippet_block: "{{ lookup('ansible.builtin.template', 'files/Caddyfile.j2') }}"
|
||||||
|
|
||||||
- name: Install mozimo Caddy snippet (web + cms)
|
- name: Install mozimo Caddy snippet (web + cms)
|
||||||
ansible.builtin.include_tasks: snippet.yaml
|
ansible.builtin.blockinfile:
|
||||||
|
path: "{{ caddyfile_path }}"
|
||||||
|
marker: "# {mark} Ansible managed Caddy snippet (mozimo web + cms)"
|
||||||
|
block: "{{ caddy_snippet_block }}"
|
||||||
|
insertafter: EOF
|
||||||
|
notify: "Reload Caddy"
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Read snippet from template
|
|
||||||
ansible.builtin.set_fact:
|
|
||||||
caddy_snippet_block: "{{ lookup('ansible.builtin.template', 'snippet.j2') }}"
|
|
||||||
|
|
||||||
# migrate away from the older per-host marker blocks (pre dual-role snippet)
|
|
||||||
- name: Remove legacy per-host snippet blocks
|
|
||||||
ansible.builtin.blockinfile:
|
|
||||||
path: "{{ caddyfile_path }}"
|
|
||||||
marker: "# {mark} Ansible managed Caddy snippet for {{ item }}"
|
|
||||||
state: absent
|
|
||||||
loop:
|
|
||||||
- "{{ www_host }}"
|
|
||||||
- "{{ cms_host }}"
|
|
||||||
|
|
||||||
- name: Install mozimo Caddy snippet (web + cms)
|
|
||||||
ansible.builtin.blockinfile:
|
|
||||||
path: "{{ caddyfile_path }}"
|
|
||||||
marker: "# {mark} Ansible managed Caddy snippet (mozimo web + cms)"
|
|
||||||
block: "{{ caddy_snippet_block }}"
|
|
||||||
insertafter: EOF
|
|
||||||
notify: "Reload Caddy"
|
|
||||||
Reference in New Issue
Block a user