47 lines
No EOL
1.2 KiB
YAML
47 lines
No EOL
1.2 KiB
YAML
- name: Ensure dependencies are installed.
|
|
apt:
|
|
name:
|
|
- debian-keyring
|
|
- debian-archive-keyring
|
|
- apt-transport-https
|
|
- gnupg2
|
|
- curl
|
|
state: present
|
|
|
|
- name: Check if Caddy's GPG is present
|
|
stat:
|
|
path: "/usr/share/keyrings/caddy-stable-archive-keyring.gpg"
|
|
register: caddy_gpg_key
|
|
|
|
- name: Download Caddy GPG key
|
|
ansible.builtin.get_url:
|
|
url: https://dl.cloudsmith.io/public/caddy/stable/gpg.key
|
|
dest: /tmp/caddy-stable-gpg.key
|
|
checksum: md5:2d4a43cd25514f24ddf35467d6abfe5f
|
|
when: not caddy_gpg_key.stat.exists
|
|
|
|
- name: Unpack (dearmor) GPG key
|
|
ansible.builtin.shell: gpg --dearmor < /tmp/caddy-stable-gpg.key > /usr/share/keyrings/caddy-stable-archive-keyring.gpg
|
|
when: not caddy_gpg_key.stat.exists
|
|
|
|
- name: Add Caddy repository.
|
|
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
|
|
update_cache: true
|
|
filename: caddy
|
|
mode: 0644
|
|
|
|
- name: Install Caddy
|
|
apt:
|
|
name:
|
|
- caddy
|
|
state: present
|
|
|
|
- name: upload Caddyfile
|
|
copy:
|
|
owner: root
|
|
mode: 644
|
|
src: Caddyfile
|
|
dest: /etc/caddy/Caddyfile
|
|
notify: reload caddy |