From 806607a58675a3f28694602b16762f9cdd5dac60 Mon Sep 17 00:00:00 2001 From: makefunstuff Date: Thu, 18 Jul 2024 22:32:36 +0300 Subject: ansible --- ansible/roles/caddy/files/Caddyfile | 7 +++++++ ansible/roles/caddy/handlers/main.yml | 6 ++++++ ansible/roles/caddy/tasks/main.yml | 15 +++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 ansible/roles/caddy/files/Caddyfile create mode 100644 ansible/roles/caddy/handlers/main.yml create mode 100644 ansible/roles/caddy/tasks/main.yml (limited to 'ansible/roles/caddy') diff --git a/ansible/roles/caddy/files/Caddyfile b/ansible/roles/caddy/files/Caddyfile new file mode 100644 index 0000000..837efa5 --- /dev/null +++ b/ansible/roles/caddy/files/Caddyfile @@ -0,0 +1,7 @@ +sourcehut.example.com { + reverse_proxy localhost:8000 +} +git.example.com { + reverse_proxy localhost:2222 +} + diff --git a/ansible/roles/caddy/handlers/main.yml b/ansible/roles/caddy/handlers/main.yml new file mode 100644 index 0000000..f265424 --- /dev/null +++ b/ansible/roles/caddy/handlers/main.yml @@ -0,0 +1,6 @@ +--- +- name: Reload Caddy + systemd: + name: caddy + state: reloaded + diff --git a/ansible/roles/caddy/tasks/main.yml b/ansible/roles/caddy/tasks/main.yml new file mode 100644 index 0000000..5caaa18 --- /dev/null +++ b/ansible/roles/caddy/tasks/main.yml @@ -0,0 +1,15 @@ +--- +- name: Install Caddy + shell: | + apt install -y debian-keyring debian-archive-keyring apt-transport-https + curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | apt-key add - + curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | tee /etc/apt/sources.list.d/caddy-stable.list + apt update + apt install caddy + +- name: Setup Caddy for SourceHut and Soft-Serve + copy: + src: Caddyfile + dest: /etc/caddy/Caddyfile + notify: Reload Caddy + -- cgit 1.4.1-2-gfad0