46 lines
1.1 KiB
YAML
46 lines
1.1 KiB
YAML
|
---
|
||
|
- name: Install required packages
|
||
|
ansible.builtin.apt:
|
||
|
update_cache: true
|
||
|
cache_valid_time: 3600
|
||
|
name:
|
||
|
- debian-keyring
|
||
|
- debian-archive-keyring
|
||
|
- apt-transport-https
|
||
|
become: true
|
||
|
|
||
|
- name: Fetch gpg key
|
||
|
ansible.builtin.apt_key:
|
||
|
url: https://dl.cloudsmith.io/public/caddy/stable/gpg.key
|
||
|
id: 155B6D79CA56EA34
|
||
|
keyring: /usr/share/keyrings/caddy-stable-archive-keyring.gpg
|
||
|
become: true
|
||
|
|
||
|
- name: Add specified repository into sources list using specified filename
|
||
|
ansible.builtin.apt_repository:
|
||
|
repo: "deb [signed-by=/usr/share/keyrings/caddy-stable-archive-keyring.gpg] https://dl.cloudsmith.io/public/caddy/stable/deb/debian any-version main"
|
||
|
state: present
|
||
|
filename: caddy-stable
|
||
|
|
||
|
- name: Install caddy
|
||
|
ansible.builtin.apt:
|
||
|
update_cache: true
|
||
|
cache_valid_time: 3600
|
||
|
name:
|
||
|
- caddy
|
||
|
become: true
|
||
|
|
||
|
- name: Write Caddyfile
|
||
|
ansible.builtin.template:
|
||
|
src: "Caddyfile.j2"
|
||
|
dest: "/etc/caddy/Caddyfile"
|
||
|
mode: "0644"
|
||
|
become: true
|
||
|
|
||
|
- name: Start service
|
||
|
ansible.builtin.service:
|
||
|
name: caddy
|
||
|
state: restarted
|
||
|
enabled: true
|
||
|
become: true
|