Преглед изворни кода

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 година
родитељ
комит
ca6b917634
4 измењених фајлова са 59 додато и 0 уклоњено
  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 Прегледај датотеку

@@ -438,6 +438,22 @@ Control VM provisioning
nic01: AC:DE:48:AA:AA:AA
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

+ 18
- 0
metadata/service/master/cache/redis.yml Прегледај датотеку

@@ -0,0 +1,18 @@
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 Прегледај датотеку

@@ -0,0 +1,11 @@
{% 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 Прегледај датотеку

@@ -28,6 +28,20 @@ salt_master_packages:
- watch_in:
- 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 %}

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

Loading…
Откажи
Сачувај