Просмотр исходного кода

Add more Redis configuration options (#50)

* Add support for Redis authentication

* Add support for Redis Sentinel configuration

* Document new Redis role variables
Daniel Miranda 9 лет назад
Родитель
Сommit
460536fbd1
3 измененных файлов с 15 добавлено и 1 удалено
  1. 3 0
      defaults/main.yml
  2. 3 0
      docs/role_variables.md
  3. 9 1
      templates/sensu-redis.json.j2

+ 3 - 0
defaults/main.yml

@@ -23,6 +23,9 @@ redis_pkg_repo: ~
 redis_pkg_name: redis
 redis_pkg_state: present
 redis_port: 6379
+redis_password:
+redis_sentinels: []
+redis_master_name:
 
 # Sensu/Uchiwa user/group/service properties
 sensu_api_host: "{{ groups['sensu_masters'][0] }}"

+ 3 - 0
docs/role_variables.md

@@ -32,6 +32,9 @@ _Note: The above options are intended to provide users with flexibility. This al
 | `redis_pkg_name` | redis |  The name of the redis package to install |
 | `redis_pkg_state` | present | The state of the redis package (should be set to `present` or `latest`) |
 | `redis_port` | 6379 | The transmission port for redis communications |
+| `redis_password` | `` | Password to use for redis authentication |
+| `redis_sentinels` | `[]` | List of Redis Sentinel servers to use, with each item having `host` and `port` keys. Disables Sentinel when empty/unset |
+| `redis_master_name` | `` | Name of the master (replica set) to use with Redis Sentinel |
 
 ### [Sensu Properties](https://sensuapp.org/docs/latest/installation/overview)
 | Name               | Default Value | Description                  |

+ 9 - 1
templates/sensu-redis.json.j2

@@ -1,6 +1,14 @@
 {
   "redis": {
+{% if redis_password %}
+    "password": "{{ redis_password }}",
+{% endif %}
+{% if redis_sentinels %}
+    "sentinels": {{ redis_sentinels | to_nice_json(indent=4) }},
+    "master": "{{ redis_master_name }}"
+{% else %}
     "host": "{{ redis_host }}",
     "port": {{ redis_port }}
+{% endif %}
   }
-}
+}