2019-10-06 20:55:56 +00:00
|
|
|
---
|
|
|
|
# Server/Caddyserver-Install: Install/Update Caddy Webserver (with some modules)
|
|
|
|
|
2019-10-27 15:26:22 +00:00
|
|
|
# Detect some more host facts
|
|
|
|
- name: caddyserver - Detect debian distributor ID
|
|
|
|
shell: lsb_release -is
|
|
|
|
register: lsb_id
|
|
|
|
|
2019-10-06 20:55:56 +00:00
|
|
|
- name: caddyserver - Stop caddy
|
|
|
|
become: yes
|
|
|
|
service:
|
|
|
|
name: caddy
|
|
|
|
state: stopped
|
2019-11-01 21:57:29 +00:00
|
|
|
ignore_errors: yes
|
2019-10-06 20:55:56 +00:00
|
|
|
|
|
|
|
- name: caddyserver - Make temp download directory
|
|
|
|
file:
|
|
|
|
path: /tmp/caddy
|
|
|
|
state: directory
|
2019-10-27 15:26:22 +00:00
|
|
|
|
|
|
|
- name: caddyserver - Download caddy webserver (amd64)
|
2019-10-06 20:55:56 +00:00
|
|
|
get_url:
|
2019-10-27 15:26:22 +00:00
|
|
|
url: "https://caddyserver.com/download/linux/amd64?plugins=http.ratelimit&license=personal"
|
2019-10-06 20:55:56 +00:00
|
|
|
dest: /tmp/caddy/caddy.tar.gz
|
2019-10-27 15:26:22 +00:00
|
|
|
when: lsb_id.stdout != "Raspbian"
|
|
|
|
- name: caddyserver - Download caddy webserver (raspberry pi)
|
|
|
|
get_url:
|
|
|
|
url: "https://caddyserver.com/download/linux/arm7?plugins=http.ratelimit&license=personal"
|
|
|
|
dest: /tmp/caddy/caddy.tar.gz
|
|
|
|
when: lsb_id.stdout == "Raspbian"
|
|
|
|
|
2019-10-06 20:55:56 +00:00
|
|
|
- name: caddyserver - Extract caddy
|
|
|
|
shell: "cd /tmp/caddy && tar -xvf caddy.tar.gz"
|
|
|
|
- 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
|
2019-10-27 10:40:03 +00:00
|
|
|
state: present
|
2019-10-06 20:55:56 +00:00
|
|
|
- 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
|