first commit
This commit is contained in:
28
roles/caddy/tasks/configure.yml
Normal file
28
roles/caddy/tasks/configure.yml
Normal 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
|
||||
19
roles/caddy/tasks/install.yml
Normal file
19
roles/caddy/tasks/install.yml
Normal 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
|
||||
11
roles/caddy/tasks/main.yml
Normal file
11
roles/caddy/tasks/main.yml
Normal 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
|
||||
Reference in New Issue
Block a user