first commit

This commit is contained in:
2024-11-29 09:24:14 +01:00
commit 8c3b5f57b5
17 changed files with 407 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
---
- name: install caddy service file
template:
src: templates/caddy.service.j2
dest: "/etc/systemd/system/caddy.service"
owner: root
group: root
- name: ensure Caddyfile target dir exists
file:
path: "{{ caddy_linux_caddyfile_path }}"
state: directory
- name: template and install Caddyfile
template:
src: templates/Caddyfile.j2
dest: "{{ caddy_linux_caddyfile_path }}/Caddyfile"
owner: root
group: root
#validate: caddy fmt --overwrite
#notify: restart caddy
- name: Enable caddy service
ansible.builtin.systemd:
name: caddy
enabled: yes
state: reloaded
daemon_reload: yes

View File

@@ -0,0 +1,19 @@
---
- name: download latest release
get_url:
url: "{{ caddy_amd64_linux_cloudflare_binary_url }}"
dest: /usr/local/bin/caddy
owner: root
group: root
mode: a+x
ignore_errors: true
- name: Add the caddy group
ansible.builtin.group:
name: caddy
state: present
- name: Add the caddy user
ansible.builtin.user:
name: caddy
group: caddy

View File

@@ -0,0 +1,11 @@
---
- name: install caddy
include_tasks:
file: install.yml
- name: configure caddy rules
include_tasks:
file: configure.yml
apply:
tags:
- caddyconfig