[CODE] caddy, cronmail: only run, if update needed
This commit is contained in:
parent
2d8903efeb
commit
c0d2381824
4 changed files with 61 additions and 41 deletions
|
|
@ -6,48 +6,63 @@
|
|||
shell: lsb_release -is
|
||||
register: lsb_id
|
||||
|
||||
- name: caddyserver - Stop caddy
|
||||
become: yes
|
||||
service:
|
||||
name: caddy
|
||||
state: stopped
|
||||
ignore_errors: yes
|
||||
|
||||
- name: caddyserver - Make temp download directory
|
||||
- name: caddyserver - Create cache directory
|
||||
file:
|
||||
path: /tmp/caddy
|
||||
path: "{{ caddy_cachedir }}"
|
||||
state: directory
|
||||
|
||||
- name: caddyserver - Download caddy webserver (amd64)
|
||||
- name: caddyserver - Get all caddy releases
|
||||
get_url:
|
||||
url: "https://caddyserver.com/download/linux/amd64?plugins=http.ratelimit&license=personal"
|
||||
dest: /tmp/caddy/caddy.tar.gz
|
||||
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"
|
||||
url: https://api.github.com/repos/caddyserver/caddy/git/refs/tags
|
||||
dest: "{{ caddy_cachedir }}/releases.txt"
|
||||
force: yes
|
||||
register: caddy_releases_cache
|
||||
|
||||
- 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
|
||||
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
|
||||
- name: caddyserver - Install or update
|
||||
block:
|
||||
- name: caddyserver - Make temp download directory
|
||||
file:
|
||||
path: "{{ caddy_cachedir }}/tmp"
|
||||
state: directory
|
||||
|
||||
- name: caddyserver - Download caddy webserver (amd64)
|
||||
get_url:
|
||||
url: "https://caddyserver.com/download/linux/amd64?plugins=http.ratelimit&license=personal"
|
||||
dest: "{{ caddy_cachedir }}/tmp/caddy.tar.gz"
|
||||
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: "{{ caddy_cachedir }}/tmp/caddy.tar.gz"
|
||||
when: lsb_id.stdout == "Raspbian"
|
||||
|
||||
- name: caddyserver - Stop caddy
|
||||
become: yes
|
||||
service:
|
||||
name: caddy
|
||||
state: stopped
|
||||
ignore_errors: yes
|
||||
|
||||
- name: caddyserver - Extract caddy
|
||||
shell: "cd {{ caddy_cachedir }}/tmp && tar -xvf caddy.tar.gz"
|
||||
- name: caddyserver - Copy caddy to a PATH location
|
||||
become: yes
|
||||
shell: "cp {{ caddy_cachedir }}/tmp/caddy /usr/local/bin"
|
||||
- name: caddyserver - Clean up download files
|
||||
become: yes
|
||||
file:
|
||||
path: "{{ caddy_cachedir }}/tmp"
|
||||
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
|
||||
when: caddy_releases_cache.changed
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue