-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcaddy.yml
48 lines (40 loc) · 1.33 KB
/
caddy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
---
- name: Add Caddy GPG apt Key
vars:
keyrings: /usr/share/keyrings
apt_repo: https://dl.cloudsmith.io/public/caddy/testing/deb/debian
block:
- name: Download Caddy gpg key
ansible.builtin.get_url:
url: https://dl.cloudsmith.io/public/caddy/stable/gpg.key
dest: "{{ keyrings }}/caddy-stable-archive-keyring.asc"
- name: Add Caddy apt repository
ansible.builtin.apt_repository:
repo: "deb [signed-by={{ keyrings }}/caddy-stable-archive-keyring.asc] {{ apt_repo }} any-version main"
state: present
- name: Add Caddy source repository
ansible.builtin.apt_repository:
repo: "deb-src [signed-by={{ keyrings }}/caddy-stable-archive-keyring.asc] {{ apt_repo }} any-version main"
state: present
- name: Install Caddy package
ansible.builtin.package:
name: caddy
state: present
- name: Enable caddy service
ansible.builtin.service:
name: caddy.service
enabled: yes
- name: Copy Caddy configuration file
ansible.builtin.template:
src: Caddyfile.j2
dest: /etc/caddy/Caddyfile
notify: restart_caddy
- name: Create Caddy web root directory
ansible.builtin.file:
path: /var/www/html
state: directory
mode: '0755'
- name: Copy index.html file
ansible.builtin.copy:
src: index.html
dest: /var/www/html/index.html