added geoip state
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Paul 2024-04-16 23:29:23 +02:00
parent f8528e1ef6
commit 078b97b138
4 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,8 @@
---
geoip:
basepath: /usr/share/GeoIP
version: 2023.03.26
url: https://git.paulbsd.com/paulbsd/GeoLite.mmdb/releases/download
dbs:
- GeoLite2-City.mmdb
- GeoLite2-ASN.mmdb

4
states/geoip/init.sls Normal file
View File

@ -0,0 +1,4 @@
---
{%- from "geoip/map.jinja" import geoip with context %}
include:
- .install

13
states/geoip/install.sls Normal file
View File

@ -0,0 +1,13 @@
---
{%- from "geoip/map.jinja" import geoip with context %}
{% for dbname in geoip.dbs %}
geoip-geoip-{{ dbname }}:
file.managed:
- name: {{ geoip.basepath }}/geoip/{{ dbname }}
- source: {{ geoip.url }}/{{ geoip.version }}/{{ dbname }}
- skip_verify: True
- makedirs: True
- user: root
- group: root
- mode: "0644"
{% endfor %}

3
states/geoip/map.jinja Normal file
View File

@ -0,0 +1,3 @@
{%- import_yaml "geoip/defaults.yaml" as defaults -%}
{%- set geoip = salt['pillar.get']('geoip', default=defaults.geoip, merge=True) -%}