summaryrefslogtreecommitdiffstats
path: root/salt
diff options
context:
space:
mode:
authorGeorg Pfuetzenreuter2023-01-22 13:47:42 +0100
committerGeorg Pfuetzenreuter2023-01-22 13:56:21 +0100
commit689eb5c676e7e2860b8a279de962c7cb352e8268 (patch)
treed87215f67f882dc4a641536601392ad3e26deea1 /salt
parentbcac69683b2568bde92d88953b06be344b27406d (diff)
downloadsalt-689eb5c676e7e2860b8a279de962c7cb352e8268.tar.gz
salt-689eb5c676e7e2860b8a279de962c7cb352e8268.tar.bz2
salt-689eb5c676e7e2860b8a279de962c7cb352e8268.zip
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 <mail@georg-pfuetzenreuter.net>
Diffstat (limited to 'salt')
-rw-r--r--salt/profile/salt/master.sls65
1 files changed, 65 insertions, 0 deletions
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 }}