From 790f42bbb8f89b8df87f9b6aea26e406e69e0deb Mon Sep 17 00:00:00 2001 From: Wilfried OLLIVIER Date: Tue, 19 May 2020 21:28:43 +0200 Subject: [PATCH] Update to caddy2 --- README.md | 2 -- defaults/main.yml | 2 +- meta/main.yml | 2 +- templates/reverse.caddy.j2 | 27 +++++---------------------- 4 files changed, 7 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 62f9502..c8ef1cf 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,6 @@ Role Variables - caddy_www: /var/www/caddy - reverse_location: reverse destination point - reverse_port: port to redirect to -- rootws: yes/no activate websocket in the / path - websocket_path: path to websocket (optional) - websocket_location: reverse destination point for websocket config - websocket_port: websocket port to redirect to @@ -51,4 +50,3 @@ Needs galaxy-vagrant to run tests Ensure galaxy-vagrant is up ansible-playbook -i tests/inventory tests/test.yml - diff --git a/defaults/main.yml b/defaults/main.yml index 235816b..ce5d86c 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -16,6 +16,6 @@ websocket: no websocket_location: localhost proxy_rule: no -proxy_location: localhostœ +proxy_location: localhost rootws: no diff --git a/meta/main.yml b/meta/main.yml index 338d149..5cdab89 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -1,6 +1,6 @@ galaxy_info: author: Wilfried OLLIVIER - description: Push caddy reverse config file + description: Push caddy (2) reverse config file company: none license: WTFPL diff --git a/templates/reverse.caddy.j2 b/templates/reverse.caddy.j2 index 5c1338d..3df9157 100644 --- a/templates/reverse.caddy.j2 +++ b/templates/reverse.caddy.j2 @@ -12,35 +12,18 @@ X-Frame-Options "DENY" } - proxy / http://{{ reverse_location }}:{{ reverse_port }} { -{% if rootws %} - websocket -{% endif %} - transparent - } + reverse_proxy http://{{ reverse_location }}:{{ reverse_port }} {% if websocket %} - proxy {{ websocket_path }} http://{{ websocket_location }}:{{ websocket_port }} { - websocket - } + reverse_proxy {{ websocket_path }} http://{{ websocket_location }}:{{ websocket_port }} {% endif %} {% if proxy_rule %} - proxy {{ proxy_path }} http://{{ proxy_location }}:{{ proxy_port }} { - transparent - } + reverse_proxy {{ proxy_path }} http://{{ proxy_location }}:{{ proxy_port }} {% endif %} - log {{ caddy_logs }}/{{ vhost_name }}/access.log { - rotate_size 100 - rotate_age 30 - rotate_keep 10 - } - - errors {{ caddy_logs }}/{{ vhost_name }}/errors.log { - rotate_size 100 - rotate_age 30 - rotate_keep 10 + log { + output file {{ caddy_logs }}/{{ vhost_name }}/vhost.log } }