2020-12-06 19:37:02 +01:00
|
|
|
- name: Prepare
|
|
|
|
hosts: all
|
|
|
|
become: yes
|
|
|
|
|
|
|
|
tasks:
|
|
|
|
- name: Update apt cache
|
|
|
|
apt:
|
|
|
|
update_cache: yes
|
2021-03-28 10:48:06 +02:00
|
|
|
cache_valid_time: 3600
|
|
|
|
|
|
|
|
- name: Install GPG package
|
|
|
|
package:
|
|
|
|
name: gpg
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: Add Caddy2 APT key
|
|
|
|
apt_key:
|
|
|
|
url: https://dl.cloudsmith.io/public/caddy/stable/gpg.155B6D79CA56EA34.key
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: Add Caddy2 APT repository
|
|
|
|
apt_repository:
|
|
|
|
repo: deb https://dl.cloudsmith.io/public/caddy/stable/deb/{{ ansible_distribution | lower }} any-version main
|
|
|
|
filename: caddy-stable
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: Install caddy package
|
|
|
|
package:
|
|
|
|
name: caddy
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: Create Caddy2 config directory
|
|
|
|
file:
|
|
|
|
path: "/etc/caddy/conf.d"
|
|
|
|
state: directory
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: "0755"
|
|
|
|
|
|
|
|
- name: Create Caddy2 log directory
|
|
|
|
file:
|
|
|
|
path: "/var/log/caddy"
|
|
|
|
state: directory
|
|
|
|
owner: caddy
|
|
|
|
group: caddy
|
|
|
|
mode: "0755"
|
|
|
|
|
|
|
|
- name: Copy Caddy2 config file
|
|
|
|
copy:
|
|
|
|
content:
|
|
|
|
import conf.d/*.conf
|
|
|
|
dest: /etc/caddy/Caddyfile
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: "0644"
|