summaryrefslogtreecommitdiff
path: root/roles/common/tasks/caddy.yml
blob: 3d2541ed860a28851ba0dc45a860bc04e718d847 (plain)
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
- name: Install caddy
  package:
    name: caddy
    state: present

- name: Ensure caddy group exists
  group:
    name: caddy
    system: yes
    state: present

- name: Ensure caddy user exists
  user:
    name: caddy
    group: caddy
    system: yes
    create_home: no
    shell: /usr/sbin/nologin
    state: present

- name: Create caddy configuration directory
  file:
    path: /etc/caddy
    state: directory
    owner: caddy
    group: caddy
    mode: '0755'

- name: Configure caddy
  copy:
    src: Caddyfile
    dest: /etc/caddy/Caddyfile
    owner: caddy
    group: caddy
    mode: '0664'

- name: Ensure Caddy log file exists
  file:
    path: /var/log/caddy.log
    state: touch
    owner: caddy
    group: caddy
    mode: '0664'

- name: Enable caddy service
  service:
    name: caddy
    enabled: true
    state: started