diff --git a/pillar.example b/pillar.example index 82c897e..6a618d8 100644 --- a/pillar.example +++ b/pillar.example @@ -9,16 +9,25 @@ sensu: - timeout - name: aws-sdk version: 2.2.6 + configure_rabbitmq: true client: embedded_ruby: true nagios_plugins: true redact: - password gem_proxy: http://192.168.1.1:3128/ + configure_rabbitmq: true rabbitmq: host: 10.0.0.1 user: sensu password: secret + redis: + host: 10.0.0.1 + port: 6379 + reconnect_on_error: True + sentinels: + - host: localhost + port: 26379 api: password: secret ssl: diff --git a/sensu/api.sls b/sensu/api.sls index 2eecf20..5f3e8d0 100644 --- a/sensu/api.sls +++ b/sensu/api.sls @@ -1,7 +1,9 @@ include: - sensu - sensu.api_conf +{% if salt['pillar.get']('sensu:server:configure_rabbitmq', True) %} - sensu.rabbitmq_conf +{% endif %} - sensu.redis_conf sensu-api: @@ -9,9 +11,13 @@ sensu-api: - enable: True - require: - file: /etc/sensu/conf.d/api.json +{% if salt['pillar.get']('sensu:server:configure_rabbitmq', True) %} - file: /etc/sensu/conf.d/rabbitmq.json +{% endif %} - file: /etc/sensu/conf.d/redis.json - watch: - file: /etc/sensu/conf.d/api.json +{% if salt['pillar.get']('sensu:server:configure_rabbitmq', True) %} - file: /etc/sensu/conf.d/rabbitmq.json +{% endif %} - file: /etc/sensu/conf.d/redis.json diff --git a/sensu/client.sls b/sensu/client.sls index 2cfbe7e..efe1212 100644 --- a/sensu/client.sls +++ b/sensu/client.sls @@ -4,7 +4,15 @@ include: - sensu +{% if salt['pillar.get']('sensu:server:configure_rabbitmq', True) %} - sensu.rabbitmq_conf +{% endif %} +{% if salt['pillar.get']('sensu:transport:name') %} + - sensu.transport_conf +{% endif %} +{% if salt['pillar.get']('sensu:transport:name') == 'redis' %} + - sensu.redis_conf +{% endif %} {% if grains['os_family'] == 'Windows' %} /opt/sensu/bin/sensu-client.xml: @@ -52,7 +60,7 @@ sensu_standalone_checks_file: client: name: {{ sensu.client.name }} address: {{ sensu.client.address }} - subscriptions: {{ sensu.client.subscriptions }} + subscriptions: {{ sensu.client.subscriptions + pillar.get('role', []) }} safe_mode: {{ sensu.client.safe_mode }} {% if sensu.client.get('keepalive') %} keepalive: {{ sensu.client.keepalive }} @@ -133,6 +141,11 @@ sensu-client: - enable: True - require: - file: /etc/sensu/conf.d/client.json +{% if salt['pillar.get']('sensu:server:configure_rabbitmq', True) %} - file: /etc/sensu/conf.d/rabbitmq.json +{% endif %} +{% if salt['pillar.get']('sensu:transport:name') %} + - file: /etc/sensu/conf.d/transport.json +{% endif %} - watch: - file: /etc/sensu/conf.d/* diff --git a/sensu/init.sls b/sensu/init.sls index 02b0db0..19c9fd9 100644 --- a/sensu/init.sls +++ b/sensu/init.sls @@ -52,3 +52,9 @@ old sensu repository: - require_in: - pkg: sensu {% endif %} + + +{% if not salt['pillar.get']('sensu:server:configure_rabbitmq', True) %} +/etc/sensu/conf.d/rabbitmq.json: + file.absent +{% endif %} diff --git a/sensu/redis_conf.sls b/sensu/redis_conf.sls index 5d0b252..e6fb078 100644 --- a/sensu/redis_conf.sls +++ b/sensu/redis_conf.sls @@ -13,4 +13,4 @@ host: {{ sensu.redis.host }} {% if sensu.redis.password is defined and sensu.redis.password is not none %}password: {{ sensu.redis.password }}{% endif %} port: {{ sensu.redis.port }} - + {% if sensu.redis.sentinels is defined and sensu.redis.sentinels is not none %}sentinels: {{ sensu.redis.sentinels }}{% endif %} diff --git a/sensu/server.sls b/sensu/server.sls index 606c6c6..7eaee03 100644 --- a/sensu/server.sls +++ b/sensu/server.sls @@ -3,7 +3,9 @@ include: - sensu - sensu.api_conf # Some handlers need to access the API server +{% if salt['pillar.get']('sensu:server:configure_rabbitmq', True) %} - sensu.rabbitmq_conf +{% endif %} - sensu.redis_conf /etc/sensu/conf.d: @@ -102,4 +104,6 @@ sensu-server: - enable: True - require: - file: /etc/sensu/conf.d/redis.json +{% if salt['pillar.get']('sensu:server:configure_rabbitmq', True) %} - file: /etc/sensu/conf.d/rabbitmq.json +{% endif %}