more things
This commit is contained in:
6
roles/caddy/handlers/main.yml
Normal file
6
roles/caddy/handlers/main.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
|
||||
- name: reload caddy
|
||||
systemd:
|
||||
name: caddy
|
||||
state: reloaded
|
||||
45
roles/caddy/tasks/main.yml
Normal file
45
roles/caddy/tasks/main.yml
Normal file
@@ -0,0 +1,45 @@
|
||||
---
|
||||
|
||||
- name: Install dependencies
|
||||
apt:
|
||||
name:
|
||||
- debian-keyring
|
||||
- debian-archive-keyring
|
||||
- apt-transport-https
|
||||
update_cache: yes
|
||||
|
||||
- name: Add caddy repo signing key
|
||||
apt_key:
|
||||
id: '65760C51EDEA2017CEA2CA15155B6D79CA56EA34'
|
||||
url: 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key'
|
||||
- name: Add caddy repo
|
||||
apt_repository:
|
||||
repo: "deb https://dl.cloudsmith.io/public/caddy/stable/deb/debian any-version main"
|
||||
filename: 'caddy-stable'
|
||||
mode: '644'
|
||||
|
||||
- name: Install caddy
|
||||
apt:
|
||||
name: caddy
|
||||
|
||||
- name: Remove default settings from caddyfile
|
||||
blockinfile:
|
||||
path: /etc/caddy/Caddyfile
|
||||
marker: "{mark}"
|
||||
marker_begin: ':80'
|
||||
marker_end: '# https://caddyserver.com/docs/caddyfile'
|
||||
state: absent
|
||||
validate: 'caddy validate --config %s --adapter caddyfile'
|
||||
backup: yes
|
||||
|
||||
- name: Put caddy general config in place
|
||||
blockinfile:
|
||||
path: /etc/caddy/Caddyfile
|
||||
marker: "# {mark} ANSIBLE MANAGED BLOCK general"
|
||||
block: |
|
||||
{
|
||||
email {{ email }}
|
||||
}
|
||||
validate: 'caddy validate --config %s --adapter caddyfile'
|
||||
backup: yes
|
||||
notify: reload caddy
|
||||
Reference in New Issue
Block a user