paulbsd-salt/states/haproxy/install.sls
Paul Lecuq 668a7df8ae
All checks were successful
continuous-integration/drone/push Build is passing
updated haproxy state
2024-03-22 10:10:29 +01:00

62 lines
1.6 KiB
Plaintext

---
{%- from "haproxy/map.jinja" import haproxy with context %}
haproxy-pkg:
pkg.installed:
- pkgs: {{ haproxy.pkgs }}
- watch_in:
- service: haproxy-service
haproxy-config-dir:
file.directory:
- name: {{ haproxy.config.dir }}
- user: {{ haproxy.config.user }}
- group: {{ haproxy.config.group }}
- mode: "0700"
- recurse:
- user
- group
{% for dir in haproxy.config.dirs %}
haproxy-config-{{ dir }}-dir:
file.directory:
- name: {{ haproxy.config.dir }}/{{ dir }}
- user: {{ haproxy.config.user }}
- group: {{ haproxy.config.group }}
- mode: "0700"
{% endfor %}
{% for script, params in haproxy.config.scripts.items() %}
haproxy-script-{{ script }}:
file.managed:
- name: {{ haproxy.config.dir }}/{{ params.path }}
- source: salt://haproxy/{{ params.path }}
- user: {{ haproxy.config.user }}
- group: {{ haproxy.config.group }}
- mode: "0600"
- watch_in:
- service: haproxy-service
{% endfor %}
{% for dbname, params in haproxy.config.geoip.dbs.items() %}
haproxy-geoip-{{ dbname }}:
file.managed:
- name: /var/lib/haproxy/geoip/{{ dbname }}
- source: {{ params.url }}
- skip_verify: True
- makedirs: True
- user: {{ haproxy.config.user }}
- group: {{ haproxy.config.group }}
- mode: "0600"
- watch_in:
- service: haproxy-service
{% endfor %}
haproxy-hatop-download:
file.managed:
- name: /usr/bin/hatop
- source: {{ haproxy.hatop.fetchurl }}/v{{ haproxy.hatop.version }}/hatop
- source_hash: {{ haproxy.hatop.hash }}
- user: root
- group: root
- mode: "0755"