From d5e7410068333ae292b7cc19b127fa82a88fe5ac Mon Sep 17 00:00:00 2001 From: noelmcloughlin Date: Sat, 5 Jun 2021 03:42:43 +0100 Subject: [PATCH] fix(config): remove requisite (in case of failure); add user/group --- rabbitmq/config/cluster/install.sls | 10 +++++----- rabbitmq/config/vhost/install.sls | 2 +- rabbitmq/parameters/defaults.yaml | 2 ++ rabbitmq/service/clean.sls | 3 +-- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/rabbitmq/config/cluster/install.sls b/rabbitmq/config/cluster/install.sls index 701c36d8..bb4dfce4 100644 --- a/rabbitmq/config/cluster/install.sls +++ b/rabbitmq/config/cluster/install.sls @@ -11,15 +11,15 @@ include: - {{ sls_config_user }} {%- for name, cluster in salt["pillar.get"]("rabbitmq:cluster", {}).items() %} - {%- if 'erlang_cookie' in cluster and cluster.erlang_cookie is mapping %} + {%- if cluster.host and 'erlang_cookie' in cluster and cluster.erlang_cookie is mapping %} -rabbitmq-config-cluster-join-{{ name }}: +rabbitmq-config-cluster-{{ name }}-join-{{ cluster.host }}: file.managed: - name: {{ cluster.erlang_cookie.name }} - contents: {{ cluster.erlang_cookie.value }} - mode: 400 - - user: {{ cluster.user }} - - group: root + - user: {{ rabbitmq.config.user }} + - group: {{ rabbitmq.config.user }} - makedirs: True - watch_in: - service: rabbitmq-service-running-service-running @@ -32,7 +32,7 @@ rabbitmq-config-cluster-join-{{ name }}: - ram_node: {{ cluster.ram_node }} - runas: {{ cluster.runas }} - require: - - file: rabbitmq-config-cluster-join-{{ name }} + - file: rabbitmq-config-cluster-{{ name }}-join-{{ cluster.host }} - sls: {{ sls_config_user }} - service: rabbitmq-service-running-service-running diff --git a/rabbitmq/config/vhost/install.sls b/rabbitmq/config/vhost/install.sls index 491e446d..66b2d507 100644 --- a/rabbitmq/config/vhost/install.sls +++ b/rabbitmq/config/vhost/install.sls @@ -14,6 +14,6 @@ rabbitmq-config-vhost-present-{{ name }}: rabbitmq_vhost.present: - name: {{ name }} - require: - - service: {{ rabbitmq.service.name }} + - service: rabbitmq-service-running-service-running {% endfor %} diff --git a/rabbitmq/parameters/defaults.yaml b/rabbitmq/parameters/defaults.yaml index 9c42ed65..51406f9f 100644 --- a/rabbitmq/parameters/defaults.yaml +++ b/rabbitmq/parameters/defaults.yaml @@ -23,6 +23,8 @@ values: RABBITMQ_BASE: /var/lib/rabbitmq config: name: /etc/rabbitmq/rabbitmq.conf + user: rabbitmq + group: rabbitmq # see rabbitmq.conf.example from rabbitmq-server github docs context: {} service: diff --git a/rabbitmq/service/clean.sls b/rabbitmq/service/clean.sls index c6c0e2ff..855f0818 100644 --- a/rabbitmq/service/clean.sls +++ b/rabbitmq/service/clean.sls @@ -12,5 +12,4 @@ rabbitmq-service-clean-service-dead: service.dead: - name: {{ rabbitmq.service.name }} - enable: False - - require_in: - - sls: {{ sls_package_clean }} + - sig: 'rabbit boot'