43 lines
1.4 KiB
YAML
43 lines
1.4 KiB
YAML
---
|
|
#--------------------------------------------------------------#
|
|
# 1. Caddy Directory [caddy_dir]
|
|
#--------------------------------------------------------------#
|
|
- name: create caddy directory
|
|
tags: caddy_dir
|
|
file:
|
|
path: "{{ item.path }}"
|
|
state: "{{ item.state | default('directory') }}"
|
|
owner: "{{ item.owner | default('root') }}"
|
|
group: "{{ item.group | default('root') }}"
|
|
mode: "{{ item.mode | default('0755') }}"
|
|
with_items:
|
|
- { path: "/etc/caddy" }
|
|
- { path: "/etc/caddy/conf.d" }
|
|
|
|
#--------------------------------------------------------------#
|
|
# 2. Caddy Config [caddy_config]
|
|
#--------------------------------------------------------------#
|
|
- name: create caddy config
|
|
tags: caddy_config
|
|
template:
|
|
src: caddy/Caddyfile
|
|
dest: /etc/caddy/Caddyfile
|
|
owner: root
|
|
group: root
|
|
mode: '0644'
|
|
notify: reload caddy
|
|
|
|
#--------------------------------------------------------------#
|
|
# 3. Caddy Service [caddy_launch]
|
|
#--------------------------------------------------------------#
|
|
# If installed via script/binary, we might need a systemd service.
|
|
# If installed via yum/apt, it usually comes with one.
|
|
# Assuming we need to ensure it's enabled and started.
|
|
- name: launch caddy service
|
|
tags: caddy_launch
|
|
systemd:
|
|
name: caddy
|
|
state: started
|
|
enabled: yes
|
|
daemon_reload: yes
|