-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall-caddy.yaml
64 lines (56 loc) · 1.57 KB
/
install-caddy.yaml
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
---
- name: Install Caddy web server
hosts: maven-servers
become: true
handlers:
- name: restart_caddy
service:
name: caddy
state: restarted
tasks:
# From https://peterbabic.dev/blog/how-to-install-caddy-using-ansible/
- name: Install required packages
apt:
update_cache: yes
name:
- debian-keyring
- debian-archive-keyring
- apt-transport-https
state: present
- name: Add Cloudsmith repository
apt_key:
url: "https://dl.cloudsmith.io/public/caddy/stable/gpg.key"
state: present
- name: Add Caddy repository to sources list
apt_repository:
repo:
"deb https://dl.cloudsmith.io/public/caddy/stable/deb/debian
any-version main"
state: present
filename: caddy-stable
- name: Add Caddy src repository to sources list
apt_repository:
repo:
"deb-src https://dl.cloudsmith.io/public/caddy/stable/deb/debian
any-version main"
state: present
filename: caddy-stable
- name: Install Caddy
apt:
update_cache: yes
name: caddy
state: present
# Handler -should- trigger a service reload here
- name: Copy caddyfile over
copy:
src: files/caddy/Caddyfile
dest: /etc/caddy/Caddyfile
owner: root
mode: 0755
notify:
- restart_caddy
- name: Ensure /var/www/html is owned by ghactions
ansible.builtin.file:
path: /var/www/html
owner: ghactions
recurse: yes