add simplytranslate; make the PF playbook mostly tagged; make caddy reload not restart

This commit is contained in:
Arya 2023-06-05 17:02:24 +08:00
parent fac9e01a1e
commit 99955a9b27
Signed by: arya
GPG Key ID: 842D12BDA50DF120
4 changed files with 56 additions and 2 deletions

View File

@ -0,0 +1,9 @@
version: "3"
services:
simplytranslate:
image: quay.io/pussthecatorg/simplytranslate:latest
ports:
- "127.0.0.1:5046:5000" # Replace with "5000:5000" if you don't use a reverse proxy
volumes:
- "./extras.conf:/etc/simplytranslate/web.conf"

View File

@ -0,0 +1,23 @@
[libre]
Enabled = False
Instance = https://libretranslate.com
[google]
Enabled = True
[deepl]
# Deepl Translate does not support async as of right now, it will block all other requests
# while it's processing a Deepl Requests, please enable this with caution!
Enabled = True
[iciba]
# ICIBA Translate (a.k.a. PowerWord) is disabled by default.
Enabled = True
[reverso]
Enabled = True
[network]
port = 5000
host = 0.0.0.0

View File

@ -3,37 +3,46 @@
file: file:
path: /opt/docker/{{item}} path: /opt/docker/{{item}}
state: directory state: directory
tags: docker
- name: Copy docker-compose templates for the service - name: Copy docker-compose templates for the service
template: template:
src: ./compose/{{item}}/compose.yml.j2 src: ./compose/{{item}}/compose.yml.j2
dest: /opt/docker/{{item}}/compose.yml dest: /opt/docker/{{item}}/compose.yml
backup: yes backup: yes
register: check_status register: check_status
tags: docker
- name: check if extras file exists for the service - name: check if extras file exists for the service
local_action: stat path=./compose/{{item}}/extras.conf.j2 local_action: stat path=./compose/{{item}}/extras.conf.j2
register: file register: file
tags: docker
- name: Copy extras file - name: Copy extras file
template: template:
src: ./compose/{{item}}/extras.conf.j2 src: ./compose/{{item}}/extras.conf.j2
dest: /opt/docker/{{item}}/extras.conf dest: /opt/docker/{{item}}/extras.conf
backup: yes backup: yes
when: file.stat.exists when: file.stat.exists
tags: docker
- name: "Update docker service image" - name: "Update docker service image"
command: command:
chdir: "/opt/docker/{{ item }}" chdir: "/opt/docker/{{ item }}"
cmd: docker compose pull cmd: docker compose pull
when: check_status.changed when: check_status.changed
tags: docker
- name: "Stop docker service" - name: "Stop docker service"
command: command:
chdir: "/opt/docker/{{ item }}" chdir: "/opt/docker/{{ item }}"
cmd: docker compose down cmd: docker compose down
when: check_status.changed when: check_status.changed
tags: docker
- name: "Start docker service" - name: "Start docker service"
command: command:
chdir: "/opt/docker/{{ item }}" chdir: "/opt/docker/{{ item }}"
cmd: docker compose up -d --build --remove-orphans cmd: docker compose up -d --build --remove-orphans
when: check_status.changed when: check_status.changed
tags: docker

View File

@ -11,16 +11,24 @@
# Static weekly builds of caddy with rfc2136 dns plugin # Static weekly builds of caddy with rfc2136 dns plugin
caddy_url_base: "https://cb.projectsegfau.lt/api/download" caddy_url_base: "https://cb.projectsegfau.lt/api/download"
tasks: 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
- name: Copy per-server caddy extras - name: Copy per-server caddy extras
copy: copy:
src: "./templates/{{ inventory_hostname }}/" src: "./templates/{{ inventory_hostname }}/"
dest: /etc/caddy/ dest: /etc/caddy/
directory_mode: true directory_mode: true
- name: Restart tags: caddy-non-update
- name: Reload Caddy
service: service:
name: caddy name: caddy
enabled: yes enabled: yes
state: restarted state: reloaded
tags: caddy-non-update
- name: Setup docker compose for privacy frontends - name: Setup docker compose for privacy frontends
hosts: privfrontends hosts: privfrontends
vars: vars:
@ -37,6 +45,7 @@
- rimgo - rimgo
- scribe - scribe
- teddit - teddit
- simplytranslate
- watchtower - watchtower
non_pizza_docker_services: non_pizza_docker_services:
#- piped #- piped
@ -49,9 +58,11 @@
- name: Update docker compose files and restart those with changes - name: Update docker compose files and restart those with changes
include_tasks: docker-tasks.yaml include_tasks: docker-tasks.yaml
with_items: "{{ docker_services }}" with_items: "{{ docker_services }}"
tags: docker
- name: Update docker compose files and restart those with changes (Privacy Frontends but without Pizza1) - name: Update docker compose files and restart those with changes (Privacy Frontends but without Pizza1)
include_tasks: docker-tasks.yaml include_tasks: docker-tasks.yaml
with_items: "{{ non_pizza_docker_services }}" with_items: "{{ non_pizza_docker_services }}"
tags: docker
- name: Setup cron jobs - name: Setup cron jobs
hosts: privfrontends hosts: privfrontends
@ -61,8 +72,10 @@
name: "hourly invidious restart" name: "hourly invidious restart"
special_time: hourly special_time: hourly
job: "docker restart invidious-invidious-1 && curl https://healthchecks.projectsegfau.lt/ping/{{invidious_hc_uuid}}" job: "docker restart invidious-invidious-1 && curl https://healthchecks.projectsegfau.lt/ping/{{invidious_hc_uuid}}"
tags: cron
- name: Restart teddit every hour - name: Restart teddit every hour
cron: cron:
name: "hourly teddit restart" name: "hourly teddit restart"
special_time: hourly special_time: hourly
job: "docker restart teddit && curl https://healthchecks.projectsegfau.lt/ping/{{teddit_hc_uuid}}" job: "docker restart teddit && curl https://healthchecks.projectsegfau.lt/ping/{{teddit_hc_uuid}}"
tags: cron