Private
Public Access
2
0

caddy: improve readability
Some checks failed
Publish collection to Galaxy / publish (push) Has been cancelled

This commit is contained in:
2026-04-08 08:12:29 +03:00
parent 8f76a7fa4f
commit b7c75f18f2
2 changed files with 11 additions and 5 deletions

View File

@@ -5,6 +5,7 @@
- name: Configure Caddy Coraza CRS - name: Configure Caddy Coraza CRS
when: "caddy_coraza" when: "caddy_coraza"
block: block:
- name: Create sites config directories - name: Create sites config directories
loop: "{{ caddy_sites }}" loop: "{{ caddy_sites }}"
ansible.builtin.file: ansible.builtin.file:
@@ -12,6 +13,7 @@
state: "directory" state: "directory"
group: "{{ caddy_system_group }}" group: "{{ caddy_system_group }}"
mode: "0750" mode: "0750"
- name: Generate sites coraza.conf config file - name: Generate sites coraza.conf config file
loop: "{{ caddy_sites }}" loop: "{{ caddy_sites }}"
loop_control: loop_control:
@@ -23,6 +25,7 @@
mode: "0640" mode: "0640"
notify: notify:
- "Restart Caddy" - "Restart Caddy"
- name: Generate sites crs-setup config file - name: Generate sites crs-setup config file
loop: "{{ caddy_sites }}" loop: "{{ caddy_sites }}"
loop_control: loop_control:
@@ -34,6 +37,7 @@
mode: "0640" mode: "0640"
notify: notify:
- "Restart Caddy" - "Restart Caddy"
- name: Generate sites exclusions before request file - name: Generate sites exclusions before request file
loop: "{{ caddy_sites }}" loop: "{{ caddy_sites }}"
loop_control: loop_control:
@@ -45,6 +49,7 @@
mode: "0640" mode: "0640"
notify: notify:
- "Restart Caddy" - "Restart Caddy"
- name: Generate sites exclusions after response file - name: Generate sites exclusions after response file
loop: "{{ caddy_sites }}" loop: "{{ caddy_sites }}"
loop_control: loop_control:
@@ -57,6 +62,7 @@
notify: notify:
- "Restart Caddy" - "Restart Caddy"
# FIXME: Should per site
- name: Copy bot barrier template - name: Copy bot barrier template
when: "caddy_bot_barrier" when: "caddy_bot_barrier"
ansible.builtin.copy: ansible.builtin.copy:

View File

@@ -16,8 +16,8 @@
order coraza_waf first order coraza_waf first
{% endif %} {% endif %}
# See: https://github.com/pteich/caddy-tlsconsul
{% if caddy_consul %} {% if caddy_consul %}
# See: https://github.com/pteich/caddy-tlsconsul
storage consul { storage consul {
address "{{ caddy_consul_server }}" address "{{ caddy_consul_server }}"
token "{{ caddy_out_consul_token.token.SecretID | mandatory }}" token "{{ caddy_out_consul_token.token.SecretID | mandatory }}"
@@ -30,8 +30,8 @@
} }
{% endif %} {% endif %}
# See: https://github.com/zhangjiayin/caddy-geoip2
{% if caddy_geoip %} {% if caddy_geoip %}
# See: https://github.com/zhangjiayin/caddy-geoip2
geoip2 { geoip2 {
accountId "{{ caddy_geoip_account_id | mandatory }}" accountId "{{ caddy_geoip_account_id | mandatory }}"
licenseKey "{{ caddy_geoip_license_key | mandatory }}" licenseKey "{{ caddy_geoip_license_key | mandatory }}"
@@ -47,8 +47,8 @@
email "{{ caddy_email }}" email "{{ caddy_email }}"
{% endif %} {% endif %}
# See: https://github.com/hslatman/caddy-crowdsec-bouncer
{% if caddy_crowdsec %} {% if caddy_crowdsec %}
# See: https://github.com/hslatman/caddy-crowdsec-bouncer
crowdsec { crowdsec {
api_key {{ caddy_crowdsec_api_key | mandatory }} api_key {{ caddy_crowdsec_api_key | mandatory }}
api_url {{ caddy_crowdsec_api_url }} api_url {{ caddy_crowdsec_api_url }}
@@ -233,8 +233,8 @@
{% endfor %} {% endfor %}
} }
# See: https://github.com/mholt/caddy-ratelimit
{% if caddy_ratelimit and site.rate_limit | default(caddy_sites_defaults.rate_limit) %} {% if caddy_ratelimit and site.rate_limit | default(caddy_sites_defaults.rate_limit) %}
# See: https://github.com/mholt/caddy-ratelimit
rate_limit @not_whitelisted { rate_limit @not_whitelisted {
{% if caddy_consul %} {% if caddy_consul %}
distributed distributed
@@ -292,8 +292,8 @@
import cors-deny import cors-deny
{% endif %} {% endif %}
# See: https://github.com/steffenbusch/caddy-bot-barrier
{% if caddy_bot_barrier and site.bot_barrier | default(caddy_sites_defaults.bot_barrier) %} {% if caddy_bot_barrier and site.bot_barrier | default(caddy_sites_defaults.bot_barrier) %}
# See: https://github.com/steffenbusch/caddy-bot-barrier
bot_barrier @not_whitelisted { bot_barrier @not_whitelisted {
secret {{ site.bot_barrier_secret | default(caddy_sites_defaults.bot_barrier_secret) | mandatory }} secret {{ site.bot_barrier_secret | default(caddy_sites_defaults.bot_barrier_secret) | mandatory }}
complexity {{ site.bot_barrier_complexity | default(caddy_sites_defaults.bot_barrier_complexity) }} complexity {{ site.bot_barrier_complexity | default(caddy_sites_defaults.bot_barrier_complexity) }}