From 2c6d4ac32199246a373f26ff4af0c06474f388e8 Mon Sep 17 00:00:00 2001 From: Anton Vakhrushev Date: Fri, 12 Aug 2022 10:40:43 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A4=D0=B8=D0=BA=D1=81=20=D0=B7=D0=B0=D0=BF?= =?UTF-8?q?=D1=83=D1=81=D0=BA=D0=B0=20caddy-=D1=81=D0=B5=D1=80=D0=B2=D0=B5?= =?UTF-8?q?=D1=80=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ansible/configuration.yml | 14 +++++++++- ansible/templates/Caddyfile.j2 | 49 ++++++++-------------------------- 2 files changed, 24 insertions(+), 39 deletions(-) diff --git a/ansible/configuration.yml b/ansible/configuration.yml index 052ece0..ebfe79d 100644 --- a/ansible/configuration.yml +++ b/ansible/configuration.yml @@ -32,15 +32,27 @@ - name: 'Install python docker lib.' pip: name: docker + tags: + - docker - import_role: name: geerlingguy.docker + tags: + - docker + + - name: 'Ensure networkd service is started (required by Caddy).' + systemd: + name: systemd-networkd + state: started + enabled: true + tags: + - webserver - import_role: name: caddy_ansible.caddy_ansible vars: caddy_github_token: '{{ caddy_vars.github_token }}' -# caddy_config: '{{ lookup("template", "templates/Caddyfile.j2") }}' + caddy_config: '{{ lookup("template", "templates/Caddyfile.j2") }}' caddy_update: False caddy_setcap: True caddy_systemd_capabilities_enabled: True diff --git a/ansible/templates/Caddyfile.j2 b/ansible/templates/Caddyfile.j2 index dcd475f..6ec52c0 100644 --- a/ansible/templates/Caddyfile.j2 +++ b/ansible/templates/Caddyfile.j2 @@ -2,48 +2,21 @@ # Proxy services # ------------------------------------------------------------------- +vakhrushev.me { + tls anwinged@ya.ru + respond "Hello!" +} + # NetData proxy status.vakhrushev.me, :29999 { - proxy / 127.0.0.1:19999 { - transparent + reverse_proxy { + to 127.0.0.1:19999 } tls anwinged@ya.ru - basicauth / {{ netdata.login }} {{ netdata.password }} + + # basicauth / { + # {{ netdata.login }} {{ netdata.password | password_hash('blowfish') | b64encode }} + # } } -# Yandex Image Proxy -preview.vakhrushev.me { - proxy /img https://webdav.yandex.ru { - transparent - header_upstream User-Agent "yandex-disk-previewer/1.0" - header_upstream Authorization "Basic {{ (yandex_disk.login ~ ':' ~ yandex_disk.password) | b64encode }}" - } - - tls anwinged@ya.ru -} - -# ------------------------------------------------------------------- -# Applications -# ------------------------------------------------------------------- - -# Homepage -homepage.vakhrushev.me, vakhrushev.me { - root /var/www/homepage/current - - tls anwinged@ya.ru - gzip - - errors { - 404 404/index.html - } -} - -# Dayoff app -dayoff.vakhrushev.me { - proxy / 127.0.0.1:{{ dayoff_port }} { - transparent - } - - tls anwinged@ya.ru -}