56 lines
1.1 KiB
YAML
56 lines
1.1 KiB
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_nice_json }}"
|
|
dest: /etc/caddy/caddy.json
|
|
owner: root
|
|
group: root
|
|
mode: u=rw,g=r,o=r
|
|
notify:
|
|
- Reload caddy
|
|
|
|
- name: Create error directory
|
|
file:
|
|
path: "{{ caddy__error_dir }}"
|
|
state: directory
|
|
owner: root
|
|
group: root
|
|
mode: u=rwx=,g=rx,o=rx
|
|
|
|
- name: Configure error page
|
|
template:
|
|
src: error.html.j2
|
|
dest: "{{ caddy__error_dir }}/error.html"
|
|
owner: root
|
|
group: root
|
|
mode: u=rw,g=r,o=r
|
|
|
|
- name: Enable caddy
|
|
systemd:
|
|
daemon_reload: true
|
|
name: caddy.service
|
|
enabled: true
|
|
state: started
|
|
...
|