Browse Source

Adding REDIS as backend for salt cache

The patch adds ability to configure REDIS as cache
backed for salt-master to be used as distibuted cache
further.

Change-Id: I62a29713c23ad3f591f6e937bfc5b13eba92f402
Related-PROD: PROD-20581
pull/73/head
Oleh Hryhorov 6 years ago
parent
commit
ca6b917634
4 changed files with 59 additions and 0 deletions
  1. +16
    -0
      README.rst
  2. +18
    -0
      metadata/service/master/cache/redis.yml
  3. +11
    -0
      salt/files/cache/_redis.conf
  4. +14
    -0
      salt/master/service.sls

+ 16
- 0
README.rst View File

nic01: AC:DE:48:AA:AA:AA nic01: AC:DE:48:AA:AA:AA
nic02: AC:DE:48:AA:AA:BB nic02: AC:DE:48:AA:AA:BB


To enable Redis plugin for the Salt caching subsystem. The below pillar structure should be used

.. code-block:: yaml

salt:
master:
cache:
plugin: redis
host: localhost
port: 6379
db: '0'
password: pass_word
bank_prefix: 'MCP'
bank_keys_prefix: 'MCPKEY'
key_prefix: 'KEY'
separator: '@'




Jinja options Jinja options

+ 18
- 0
metadata/service/master/cache/redis.yml View File

parameters:
_param:
salt_cache_redis_host: 127.0.0.1
salt_cache_redis_port: 6379
salt_cache_redis_db: '0'
salt_cache_redis_password: ''
salt:
master:
cache:
plugin: redis
host: ${_param:salt_cache_redis_host}
port: ${_param:salt_cache_redis_port}
db: ${_param:salt_cache_redis_db}
password: ${_param:salt_cache_redis_password}
bank_prefix: 'MCP'
bank_keys_prefix: 'MCPKEY'
key_prefix: 'KEY'
separator: '@'

+ 11
- 0
salt/files/cache/_redis.conf View File

{% from "salt/map.jinja" import master with context %}

cache: redis
cache.redis.host: {{ master.cache.get('host', 'localhost') }}
cache.redis.port: {{ master.cache.get('port', '6379') }}
cache.redis.db: {{ master.cache.get('db', '0')|yaml_squote }}
cache.redis.password: {{ master.cache.get('password', '') }}
cache.redis.bank_prefix: {{ master.cache.get('bank_prefix', 'MCP') }}
cache.redis.bank_keys_prefix: {{ master.cache.get('bank_keys_prefix', 'MCPKEY') }}
cache.redis.key_prefix: {{ master.cache.get('key_prefix', 'KEY') }}
cache.redis.separator: {{ master.cache.get('separator', '@')|yaml_squote }}

+ 14
- 0
salt/master/service.sls View File

- watch_in: - watch_in:
- service: salt_master_service - service: salt_master_service


{%- if master.cache is defined %}

/etc/salt/master.d/_{{ master.cache.plugin }}.conf:
file.managed:
- source: salt://salt/files/cache/_{{ master.cache.plugin }}.conf
- user: root
- template: jinja
- require:
- {{ master.install_state }}
- watch_in:
- service: salt_master_service

{%- endif %}

{%- if master.user is defined %} {%- if master.user is defined %}


/etc/salt/master.d/_acl.conf: /etc/salt/master.d/_acl.conf:

Loading…
Cancel
Save