mirror of
https://github.com/Expand-sys/caddyconfigure
synced 2026-03-22 12:37:14 +11:00
53 lines
No EOL
1.3 KiB
YAML
53 lines
No EOL
1.3 KiB
YAML
---
|
|
- name: install caddy from binary
|
|
ansible.builtin.get_url:
|
|
url: https://caddyserver.com/api/download?os=linux&arch=amd64&p=github.com%2Fcaddy-dns%2Fcloudflare&idempotency=54951177807414
|
|
dest: /usr/bin/caddy
|
|
mode: '0751'
|
|
|
|
- name: create caddyfile
|
|
ansible.builtin.blockinfile:
|
|
block: |
|
|
localhost {
|
|
respond "200"
|
|
}
|
|
####
|
|
path: "{{ CADDYFILE_LOC }}"
|
|
create: true
|
|
|
|
- name: create Caddy systemd file
|
|
ansible.builtin.copy:
|
|
content: |
|
|
[Unit]
|
|
Description=Caddy
|
|
Documentation=https://caddyserver.com/docs/
|
|
After=network.target network-online.target
|
|
Requires=network-online.target
|
|
|
|
[Service]
|
|
Type=notify
|
|
User=root
|
|
Group=root
|
|
ExecStart=/usr/bin/caddy run --environ --config {{ CADDYFILE_LOC }}
|
|
ExecReload=/usr/bin/caddy reload --config {{ CADDYFILE_LOC }} --force
|
|
TimeoutStopSec=5s
|
|
LimitNOFILE=1048576
|
|
LimitNPROC=512
|
|
PrivateTmp=true
|
|
ProtectSystem=full
|
|
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
dest: /etc/systemd/system/caddy.service
|
|
|
|
- name: Start Caddy on startup
|
|
ansible.builtin.systemd_service:
|
|
name: 'caddy'
|
|
state: 'started'
|
|
enabled: yes
|
|
daemon_reload: true
|
|
|
|
- name: install caddy trust
|
|
ansible.builtin.shell: "caddy trust"
|
|
|