Skip to content

Commit

Permalink
feat: move maxmind db to files instead of tmpl in caddy role
Browse files Browse the repository at this point in the history
  • Loading branch information
ehh-why-its-so-hard committed Nov 15, 2024
1 parent 8a686a3 commit 963909c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
10 changes: 5 additions & 5 deletions roles/vega_caddy_server/defaults/main.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
---
vega_caddy_server_caddyfile_file_name: ""
vega_caddy_server_node_home: "/home/vega"

vega_caddy_server_enforce_rebuild: false
vega_caddy_server_xcaddy_version: 0.4.2
vega_caddy_server_caddy_version: v2.8.4

Expand Down Expand Up @@ -29,6 +27,8 @@ vega_caddy_server_with_block_explorer_lb: false
vega_caddy_server_block_explorer_lb_domains: []
vega_caddy_server_block_explorer_lb_upstreams: []

# Space separated list of countries e.g: "PA PL UK US"
# Space separated list of countries e.g: "PA PL GB US"
# for more information see ISO-3166 alpha2 at
# http://www.geonames.org/countries/
vega_caddy_server_geoblocking_enabled: false
vega_caddy_server_geoblocking_countries: "UK PA"
vega_caddy_server_geoblocking_countries: "GB PA"

Check failure on line 34 in roles/vega_caddy_server/defaults/main.yaml

View workflow job for this annotation

GitHub Actions / Ansible Lint

yaml[new-line-at-end-of-file]

No new line character at the end of file
3 changes: 2 additions & 1 deletion roles/vega_caddy_server/tasks/install-caddy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@
xcaddy build {{ vega_caddy_server_caddy_version }} \
--output /usr/bin/caddy \
--with github.com/caddyserver/replace-response \
--with github.com/porech/caddy-maxmind-geolocation \
--with github.com/shift72/caddy-geo-ip
when: (caddy_version.rc != 0) or (not vega_caddy_server_caddy_version in caddy_version.stdout)
when: (caddy_version.rc != 0) or (not vega_caddy_server_caddy_version in caddy_version.stdout or vega_caddy_server_enforce_rebuild)
changed_when: (caddy_version.rc != 0) or (not vega_caddy_server_caddy_version in caddy_version.stdout)
notify: "Restart caddy"

Expand Down
6 changes: 5 additions & 1 deletion roles/vega_caddy_server/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,14 @@
notify: "Restart caddy"

- name: Copy the Maxmind database
ansible.builtin.template:
ansible.builtin.copy:
src: "etc/caddy/GeoLite2-Country.mmdb"
dest: "/etc/caddy/GeoLite2-Country.mmdb"
owner: "caddy"
group: "caddy"
mode: "0644"
notify: "Restart caddy"
diff: false
args:
# database is managed by external process, do not overwrite it with default one
creates: "/etc/caddy/GeoLite2-Country.mmdb"

Check failure on line 116 in roles/vega_caddy_server/tasks/main.yaml

View workflow job for this annotation

GitHub Actions / Ansible Lint

yaml[new-line-at-end-of-file]

No new line character at the end of file

0 comments on commit 963909c

Please sign in to comment.