ansible/privfrontends/playbook.yaml

82 lines
2.5 KiB
YAML
Raw Normal View History

2023-05-13 06:44:40 +05:30
---
- name: Setup Caddy
hosts: privfrontends
roles:
2023-05-29 21:19:16 +05:30
- role: caddy-ansible
2023-05-13 06:44:40 +05:30
caddy_systemd_capabilities_enabled: true
2023-05-29 14:08:34 +05:30
caddy_config: "{{ lookup('template', './templates/Caddyfile.j2') }}"
2023-05-13 06:44:40 +05:30
caddy_user: "caddy"
caddy_home: "/var/lib/caddy"
2023-05-29 21:19:16 +05:30
caddy_packages: ["github.com/caddy-dns/rfc2136@master"]
2023-05-13 06:44:40 +05:30
# Static weekly builds of caddy with rfc2136 dns plugin
caddy_url_base: "https://cb.projectsegfau.lt/api/download"
tasks:
# This is run again so config still updates even if i dont run the role which isnt needed most of the time
- name: Copy Caddyfile
template:
src: ./templates/Caddyfile.j2
dest: /etc/caddy/Caddyfile
tags: caddy-non-update
2023-05-13 06:44:40 +05:30
- name: Copy per-server caddy extras
2023-05-14 15:56:43 +05:30
copy:
2023-05-29 14:08:34 +05:30
src: "./templates/{{ inventory_hostname }}/"
dest: /etc/caddy/
directory_mode: true
tags: caddy-non-update
- name: Reload Caddy
2023-05-29 21:19:16 +05:30
service:
name: caddy
enabled: yes
state: reloaded
tags: caddy-non-update
2023-05-13 06:44:40 +05:30
- name: Setup docker compose for privacy frontends
2023-05-14 15:56:43 +05:30
hosts: privfrontends
2023-05-13 06:44:40 +05:30
vars:
docker_services:
- anonymousoverflow
2023-05-29 21:19:16 +05:30
#- beatbump
2023-05-13 06:44:40 +05:30
- breezewiki
- gothub
- gothub-dev
2023-05-29 21:19:16 +05:30
#- invidious
2023-05-13 06:44:40 +05:30
- librarian
- libreddit
- nitter
- rimgo
- scribe
- teddit
- simplytranslate
2023-05-13 06:44:40 +05:30
- watchtower
non_pizza_docker_services:
2023-05-29 21:19:16 +05:30
#- piped
- searxng
2023-05-13 06:44:40 +05:30
tasks:
#
# community.docker does not support compose 2.0 right now.
# https://github.com/ansible-collections/community.docker/issues/216
#
- name: Update docker compose files and restart those with changes
include_tasks: docker-tasks.yaml
with_items: "{{ docker_services }}"
tags: docker
2023-05-13 06:44:40 +05:30
- name: Update docker compose files and restart those with changes (Privacy Frontends but without Pizza1)
include_tasks: docker-tasks.yaml
with_items: "{{ non_pizza_docker_services }}"
tags: docker
- name: Setup cron jobs
hosts: privfrontends
tasks:
- name: Restart invidious every hour
cron:
name: "hourly invidious restart"
special_time: hourly
job: "docker restart invidious-invidious-1 && curl https://healthchecks.projectsegfau.lt/ping/{{invidious_hc_uuid}}"
tags: cron
- name: Restart teddit every hour
cron:
name: "hourly teddit restart"
special_time: hourly
job: "docker restart teddit && curl https://healthchecks.projectsegfau.lt/ping/{{teddit_hc_uuid}}"
tags: cron