From 689eb5c676e7e2860b8a279de962c7cb352e8268 Mon Sep 17 00:00:00 2001 From: Georg Pfuetzenreuter Date: Sun, 22 Jan 2023 13:47:42 +0100 Subject: Configure Redis for Salt master Add Redis configuration to salt.master profile for caching on Salt masters. To-Do: move configuration to a formula based approach. Signed-off-by: Georg Pfuetzenreuter --- salt/profile/salt/master.sls | 65 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/salt/profile/salt/master.sls b/salt/profile/salt/master.sls index 869afa7..7dc7a31 100644 --- a/salt/profile/salt/master.sls +++ b/salt/profile/salt/master.sls @@ -1,2 +1,67 @@ +{%- set master_pillar = pillar['salt']['master'] -%} +{%- set redis_config = '/etc/redis/salt.conf' -%} +{%- set redis_service = 'redis@salt' -%} + include: - salt.master + +salt_master_extra_packages: + pkg.installed: + - names: + - python3-pynetbox + - python3-redis + - redis + - watch_in: + - service: salt-master + +# to-do: move Redis configuration to a formula +{{ redis_config }}: + file.managed: + - contents: + - port 0 + - tcp-backlog 511 + - unixsocket /run/redis/salt.sock + - unixsocketperm 460 + - timeout 0 + - supervised systemd + - pidfile /run/redis/salt.pid + - logfile /var/log/redis/salt.log + - databases 1 + - dir /var/lib/redis/salt/ + - acllog-max-len 64 + - requirepass {{ master_pillar['cache.redis.password'] }} + - user: root + - group: redis + - mode: 0640 + - require: + - pkg: redis + +/var/lib/redis/salt: + file.directory: + - user: redis + - group: redis + - mode: 0750 + - require: + - pkg: redis + +salt_redis_membership: + group.present: + - name: redis + - addusers: + - {{ master_pillar['user'] }} + - require: + - pkg: redis + +salt_redis_service_enable: + service.enabled: + - name: {{ redis_service }} + - require: + - pkg: redis + +salt_redis_service_start: + service.running: + - name: {{ redis_service }} + - require: + - pkg: redis + - watch: + - file: {{ redis_config }} -- cgit v1.2.3