ansible-role-server/tasks/caddy-install.yml

44 lines
1.2 KiB
YAML

---
# Server/Caddyserver-Install: Install/Update Caddy Webserver (with some modules)
- name: caddyserver - Stop caddy
become: yes
service:
name: caddy
state: stopped
- name: caddyserver - Make temp download directory
file:
path: /tmp/caddy
state: directory
- name: caddyserver - Download caddy webserver
get_url:
url: https://caddyserver.com/download/linux/amd64?plugins=http.ratelimit&license=personal
dest: /tmp/caddy/caddy.tar.gz
- name: caddyserver - Extract caddy
shell: "cd /tmp/caddy && tar -xvf caddy.tar.gz"
# unarchive:
# src: /tmp/caddy/caddy.tar.gz
# dest: /tmp/caddy
# copy: no
- name: caddyserver - Copy caddy to a PATH location
become: yes
shell: "cp /tmp/caddy/caddy /usr/local/bin"
- name: caddyserver - Clean up download files
become: yes
file:
path: /tmp/caddy
state: absent
- name: caddyserver - Install caddy APT dependencies
become: yes
apt:
name: libcap2-bin
state: present
- name: caddyserver - Give caddy port binding capabilities
become: yes
shell: "setcap cap_net_bind_service=+ep /usr/local/bin/caddy"
# capabilities:
# path: "{{ caddy_bin }}"
# capability: cap_net_bind_service+ep
# state: present