41 lines
768 B
YAML
41 lines
768 B
YAML
|
---
|
||
|
- name: Install caddy
|
||
|
apt:
|
||
|
name: caddy
|
||
|
|
||
|
- name: Create override directory
|
||
|
file:
|
||
|
path: /etc/systemd/system/caddy.service.d
|
||
|
state: directory
|
||
|
owner: root
|
||
|
group: root
|
||
|
mode: u=rwx,g=rx,o=rx
|
||
|
|
||
|
- name: Override caddy.service
|
||
|
template:
|
||
|
src: override.conf.j2
|
||
|
dest: /etc/systemd/system/caddy.service.d/override.conf
|
||
|
owner: root
|
||
|
group: root
|
||
|
mode: u=rw,g=r,o=r
|
||
|
notify:
|
||
|
- Reload caddy
|
||
|
|
||
|
- name: Configure caddy
|
||
|
copy:
|
||
|
content: "{{ caddy__servers | caddy__of_servers | to_json }}"
|
||
|
dest: /etc/caddy/caddy.json
|
||
|
owner: root
|
||
|
group: root
|
||
|
mode: u=rw,g=r,o=r
|
||
|
notify:
|
||
|
- Reload caddy
|
||
|
|
||
|
- name: Enable caddy
|
||
|
systemd:
|
||
|
daemon_reload: true
|
||
|
name: caddy.service
|
||
|
enabled: true
|
||
|
state: started
|
||
|
...
|