Skip to content

Commit

Permalink
feat: config state now also managed rabbitmq env file
Browse files Browse the repository at this point in the history
  • Loading branch information
daks committed Dec 23, 2019
1 parent 3eaab51 commit 53f12d2
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pillar.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ rabbitmq:
# version: "3.5.3-1"
enabled: true
running: true
env:
rabbitmq_mnesia_base: /opt/rabbitmq
plugin:
rabbitmq_management:
- enabled
Expand Down
12 changes: 12 additions & 0 deletions rabbitmq/config.sls
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,15 @@ rabbitmq_user_guest:
rabbitmq_user.absent:
- name: guest
{% endif %}

{%- if salt['pillar.get']('rabbitmq:env', None) %}
rabbitmq_env-file:
file.managed:
- name: /etc/rabbitmq/rabbitmq-env.conf
- source: salt://{{ slspath }}/files/rabbitmq-env.conf
- template: jinja
- context:
env: {{ salt['pillar.get']('rabbitmq:env', {}) }}
- watch_in:
- service: rabbitmq-server
{%- endif %}
8 changes: 8 additions & 0 deletions rabbitmq/files/rabbitmq-env.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
########################################################################
# File managed by Salt at <{{ source }}>.
# Your changes will be overwritten.
########################################################################

{% for key, value in env.items() %}
{{ key | upper }}={{ value }}
{%- endfor %}

0 comments on commit 53f12d2

Please sign in to comment.