From 1af43e6e263615567db595203fc9eb6b059573eb Mon Sep 17 00:00:00 2001 From: noelmcloughlin Date: Fri, 16 Jul 2021 03:11:14 +0100 Subject: [PATCH] feat(clusters): distributed rabbitmq support BREAKING CHANGE: the structure of pillar data is changed to allow multiple rabbitmq nodes per host. The default nodename is 'rabbit@localhost' but this commit allows multiple nodes, i.e. 'rabbit2@localhost', 'rabbit3@locahost', to be defined --- .salt-lint | 3 +- docs/README.rst | 17 +- pillar.example | 322 ++++++++++++------ rabbitmq/clean.sls | 1 - rabbitmq/config/bindings/clean.sls | 19 ++ .../config/{cluster => bindings}/init.sls | 0 rabbitmq/config/bindings/install.sls | 25 ++ rabbitmq/config/clean.sls | 27 +- rabbitmq/config/cluster/install.sls | 41 --- rabbitmq/config/clusters/clean.sls | 22 ++ rabbitmq/config/{file => clusters}/init.sls | 0 rabbitmq/config/clusters/install.sls | 36 ++ rabbitmq/config/exchanges/clean.sls | 19 ++ .../config/{plugin => exchanges}/init.sls | 0 rabbitmq/config/exchanges/install.sls | 25 ++ rabbitmq/config/file/install.sls | 89 ----- rabbitmq/config/{file => files}/clean.sls | 7 +- rabbitmq/config/{policy => files}/init.sls | 0 rabbitmq/config/files/install.sls | 64 ++++ rabbitmq/config/init.sls | 19 +- rabbitmq/config/params/clean.sls | 0 rabbitmq/config/{queue => params}/init.sls | 0 rabbitmq/config/params/install.sls | 24 ++ rabbitmq/config/plugin/clean.sls | 16 - rabbitmq/config/plugin/install.sls | 26 -- rabbitmq/config/plugins/clean.sls | 21 ++ .../config/{upstream => plugins}/init.sls | 0 rabbitmq/config/plugins/install.sls | 42 +++ rabbitmq/config/policies/clean.sls | 19 ++ rabbitmq/config/{user => policies}/init.sls | 0 rabbitmq/config/policies/install.sls | 24 ++ rabbitmq/config/policy/clean.sls | 14 - rabbitmq/config/policy/install.sls | 21 -- rabbitmq/config/queue/clean.sls | 13 - rabbitmq/config/queue/install.sls | 19 -- rabbitmq/config/queues/clean.sls | 19 ++ rabbitmq/config/{vhost => queues}/init.sls | 0 rabbitmq/config/queues/install.sls | 25 ++ rabbitmq/config/upstream/clean.sls | 13 - rabbitmq/config/upstream/install.sls | 21 -- rabbitmq/config/upstreams/clean.sls | 19 ++ .../binding => config/upstreams}/init.sls | 0 rabbitmq/config/upstreams/install.sls | 25 ++ rabbitmq/config/user/clean.sls | 14 - rabbitmq/config/user/install.sls | 32 -- rabbitmq/config/users/clean.sls | 28 ++ .../config/exchange => config/users}/init.sls | 0 rabbitmq/config/users/install.sls | 49 +++ rabbitmq/config/vhost/clean.sls | 14 - rabbitmq/config/vhost/install.sls | 19 -- rabbitmq/config/vhosts/clean.sls | 19 ++ .../config/queue => config/vhosts}/init.sls | 0 rabbitmq/config/vhosts/install.sls | 25 ++ rabbitmq/files/default/systemd.ini.jinja | 50 +++ rabbitmq/init.sls | 1 - rabbitmq/package/clean.sls | 3 + rabbitmq/parameters/defaults.yaml | 67 ++-- rabbitmq/parameters/os_family/Debian.yaml | 1 + rabbitmq/parameters/os_family/RedHat.yaml | 3 + rabbitmq/parameters/osfinger/CentOS-7.yaml | 16 + rabbitmq/rabbitmqadmin/clean.sls | 9 - .../rabbitmqadmin/config/binding/clean.sls | 13 - .../rabbitmqadmin/config/binding/install.sls | 30 -- rabbitmq/rabbitmqadmin/config/clean.sls | 12 - .../rabbitmqadmin/config/exchange/clean.sls | 13 - .../rabbitmqadmin/config/exchange/install.sls | 30 -- rabbitmq/rabbitmqadmin/config/init.sls | 12 - rabbitmq/rabbitmqadmin/config/queue/clean.sls | 13 - .../rabbitmqadmin/config/queue/install.sls | 30 -- rabbitmq/rabbitmqadmin/init.sls | 6 - rabbitmq/rabbitmqadmin/install.sls | 24 -- rabbitmq/service/clean.sls | 32 +- rabbitmq/service/running.sls | 78 ++++- test/integration/default/controls/config.rb | 1 - .../default/controls/rabbitmq_users_spec.rb | 3 +- .../default/files/_mapdata/amazonlinux-2.yaml | 152 +-------- .../files/_mapdata/arch-base-latest.yaml | 152 +-------- .../default/files/_mapdata/centos-7.yaml | 320 +++++++++++------ .../default/files/_mapdata/centos-8.yaml | 320 +++++++++++------ .../default/files/_mapdata/debian-10.yaml | 319 ++++++++++------- .../default/files/_mapdata/debian-11.yaml | 245 +++++++++++++ .../default/files/_mapdata/debian-9.yaml | 319 ++++++++++------- .../default/files/_mapdata/fedora-32.yaml | 320 +++++++++++------ .../default/files/_mapdata/fedora-33.yaml | 320 +++++++++++------ .../default/files/_mapdata/fedora-34.yaml | 320 +++++++++++------ .../default/files/_mapdata/gentoo-2-sysd.yaml | 154 +-------- .../default/files/_mapdata/gentoo-2-sysv.yaml | 154 +-------- .../default/files/_mapdata/opensuse-15.yaml | 154 +-------- .../files/_mapdata/opensuse-tumbleweed.yaml | 154 +-------- .../default/files/_mapdata/oraclelinux-7.yaml | 154 +-------- .../default/files/_mapdata/oraclelinux-8.yaml | 154 +-------- .../default/files/_mapdata/ubuntu-16.yaml | 319 ++++++++++------- .../default/files/_mapdata/ubuntu-18.yaml | 319 ++++++++++------- .../default/files/_mapdata/ubuntu-20.yaml | 319 ++++++++++------- 94 files changed, 3310 insertions(+), 3102 deletions(-) create mode 100644 rabbitmq/config/bindings/clean.sls rename rabbitmq/config/{cluster => bindings}/init.sls (100%) create mode 100644 rabbitmq/config/bindings/install.sls delete mode 100644 rabbitmq/config/cluster/install.sls create mode 100644 rabbitmq/config/clusters/clean.sls rename rabbitmq/config/{file => clusters}/init.sls (100%) create mode 100644 rabbitmq/config/clusters/install.sls create mode 100644 rabbitmq/config/exchanges/clean.sls rename rabbitmq/config/{plugin => exchanges}/init.sls (100%) create mode 100644 rabbitmq/config/exchanges/install.sls delete mode 100644 rabbitmq/config/file/install.sls rename rabbitmq/config/{file => files}/clean.sls (70%) rename rabbitmq/config/{policy => files}/init.sls (100%) create mode 100644 rabbitmq/config/files/install.sls create mode 100644 rabbitmq/config/params/clean.sls rename rabbitmq/config/{queue => params}/init.sls (100%) create mode 100644 rabbitmq/config/params/install.sls delete mode 100644 rabbitmq/config/plugin/clean.sls delete mode 100644 rabbitmq/config/plugin/install.sls create mode 100644 rabbitmq/config/plugins/clean.sls rename rabbitmq/config/{upstream => plugins}/init.sls (100%) create mode 100644 rabbitmq/config/plugins/install.sls create mode 100644 rabbitmq/config/policies/clean.sls rename rabbitmq/config/{user => policies}/init.sls (100%) create mode 100644 rabbitmq/config/policies/install.sls delete mode 100644 rabbitmq/config/policy/clean.sls delete mode 100644 rabbitmq/config/policy/install.sls delete mode 100644 rabbitmq/config/queue/clean.sls delete mode 100644 rabbitmq/config/queue/install.sls create mode 100644 rabbitmq/config/queues/clean.sls rename rabbitmq/config/{vhost => queues}/init.sls (100%) create mode 100644 rabbitmq/config/queues/install.sls delete mode 100644 rabbitmq/config/upstream/clean.sls delete mode 100644 rabbitmq/config/upstream/install.sls create mode 100644 rabbitmq/config/upstreams/clean.sls rename rabbitmq/{rabbitmqadmin/config/binding => config/upstreams}/init.sls (100%) create mode 100644 rabbitmq/config/upstreams/install.sls delete mode 100644 rabbitmq/config/user/clean.sls delete mode 100644 rabbitmq/config/user/install.sls create mode 100644 rabbitmq/config/users/clean.sls rename rabbitmq/{rabbitmqadmin/config/exchange => config/users}/init.sls (100%) create mode 100644 rabbitmq/config/users/install.sls delete mode 100644 rabbitmq/config/vhost/clean.sls delete mode 100644 rabbitmq/config/vhost/install.sls create mode 100644 rabbitmq/config/vhosts/clean.sls rename rabbitmq/{rabbitmqadmin/config/queue => config/vhosts}/init.sls (100%) create mode 100644 rabbitmq/config/vhosts/install.sls create mode 100644 rabbitmq/files/default/systemd.ini.jinja create mode 100644 rabbitmq/parameters/osfinger/CentOS-7.yaml delete mode 100644 rabbitmq/rabbitmqadmin/clean.sls delete mode 100644 rabbitmq/rabbitmqadmin/config/binding/clean.sls delete mode 100644 rabbitmq/rabbitmqadmin/config/binding/install.sls delete mode 100644 rabbitmq/rabbitmqadmin/config/clean.sls delete mode 100644 rabbitmq/rabbitmqadmin/config/exchange/clean.sls delete mode 100644 rabbitmq/rabbitmqadmin/config/exchange/install.sls delete mode 100644 rabbitmq/rabbitmqadmin/config/init.sls delete mode 100644 rabbitmq/rabbitmqadmin/config/queue/clean.sls delete mode 100644 rabbitmq/rabbitmqadmin/config/queue/install.sls delete mode 100644 rabbitmq/rabbitmqadmin/init.sls delete mode 100644 rabbitmq/rabbitmqadmin/install.sls create mode 100644 test/integration/default/files/_mapdata/debian-11.yaml diff --git a/.salt-lint b/.salt-lint index 3715677b..3dfff9d3 100644 --- a/.salt-lint +++ b/.salt-lint @@ -1,7 +1,8 @@ # -*- coding: utf-8 -*- # vim: ft=yaml --- -exclude_paths: [] +exclude_paths: + - rabbitmq/files/default/systemd.ini.jinja rules: {} skip_list: # Using `salt-lint` for linting other files as well, such as Jinja macros/templates diff --git a/docs/README.rst b/docs/README.rst index 56fc7787..f7203228 100644 --- a/docs/README.rst +++ b/docs/README.rst @@ -67,7 +67,7 @@ now ``pre-commit`` will run automatically on each ``git commit``. :: Special notes ------------- -The ``rabbitmq`` state does not include ``rabbitmq.config.cluster`` state (initial cluster setup). This formula does not provide any 'forget' state (for inconsistent cluster fixing) during cluster join (could be future feature). +The default node in any rabbitmq installation is 'rabbit@localhost'. Multiple nodes per host are allowed if defined in pillar data under `rabbitmq:nodes`. Available states ---------------- @@ -90,22 +90,12 @@ starts the associated rabbitmq service. This state will install the rabbitmq package and has a dependency on ``rabbitmq.install`` via include list. -``rabbitmq.rabbitmqadmin`` -^^^^^^^^^^^^^^^^^^^^^^^^^^ - -This state will install the rabbitmqadmin package only. - ``rabbitmq.config`` ^^^^^^^^^^^^^^^^^^^ This state will configure the rabbitmq service and has a dependency on ``rabbitmq.install`` via include list. It excludes ``rabbitmq.config.cluster`` state -``rabbitmq.config.cluster`` -^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -For initial setup this state writes the erlang cookie, joins cluster, and restarts service. The erlang cookie comes from pillar data and must the identical for all cluster members. Join fails if cluster is inconsistent (see rabbitmqctl forget_cluster_node rabbit@somehost). - ``rabbitmq.service`` ^^^^^^^^^^^^^^^^^^^^ @@ -127,11 +117,6 @@ then uninstalls the package. This state will stop the rabbitmq service and disable it at boot time. -``rabbitmq.rabbitmqadmin.clean`` -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -This state will remote the rabbitmqadmin package only. - ``rabbitmq.config.clean`` ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/pillar.example b/pillar.example index 7ed9d7b4..822208e2 100644 --- a/pillar.example +++ b/pillar.example @@ -2,129 +2,229 @@ # vim: ft=yaml --- rabbitmq: - cluster: - rabbit@locahost: + nodes: + rabbit: # default node name + clustered: false user: rabbit # 'node' would make more sense here host: localhost # short hostname of node to join to, not fqdn - ram_node: None - runas: rabbitmq - erlang_cookie: - name: /var/lib/rabbitmq/.erlang.cookie - value: shared-value-for-all-cluster-members - pkg: - # https://github.com/rabbitmq/rabbitmq-server/releases/tag/v3.8.14 - use_upstream: repo # if available (i.e. packagecloud) - service: - enabled: true - running: true - config: - # see rabbitmq.conf.example from rabbitmq-server github docs - # see https://www.rabbitmq.com/configure.html - context: - listeners.tcp.1: 0.0.0.0:5672 - env: - locale_all: en_US.UTF-8 - context: - # https://www.rabbitmq.com/configure.html#supported-environment-variables - rabbitmq_mnesia_base: /var/lib/rabbitmq - RABBITMQ_BASE: /var/lib/rabbitmq - # RABBITMQ_USE_LONGNAME: true # not working in ci - # https://www.rabbitmq.com/configure.html#supported-environment-variables - RABBITMQ_LOG_BASE: /var/log/rabbitmq - dir: - base: /var/lib/rabbitmq - - vhost: - - test_vhost - - binding: - my-new-binding: - - destination_type: queue - - destination: my-new-queue - - routing_key: a_routing_key_string - - user: saltstack - - passwd: 'password' - - vhost: test_vhost - - arguments: - - 'x-message-ttl': 8640000 - - queue: - my-new-queue: - ## note : dict format - user: saltstack - passwd: password - durable: true - auto_delete: false - vhost: test_vhost - arguments: - - x-message-ttl: 8640000 - - x-expires: 8640000 - - x-dead-letter-exchange: my-new-exchange - - exchange: - my-new-exchange: - - user: saltstack - - passwd: 'password' - - type: fanout - - durable: true - - internal: false - - auto_delete: false - - vhost: test_vhost - - arguments: - - 'alternate-**exchange': 'amq.fanout' - - 'test-header': 'testing' - - plugin: - rabbitmq_management: - runas: root - rabbitmq_federation: - runas: root - - policy: - rabbitmq_policy: - - name: HA - - pattern: '.*' - - definition: '{"ha-mode": "all"}' - - upstream: - upstream_1: - - uri: amqp://saltstack:password@localhost - - trust_user_id: true - - ack_mode: on-confirm - - max_hops: 1 + nodeport: 5672 + distport: 25672 + erlang_cookie: shared-secret + config: + listeners.tcp.1: 0.0.0.0:5672 + # https://www.rabbitmq.com/ldap.html + # auth_backends.1: ldap + # auth_backends.2: internal + # auth_ldap.servers.1: ldap.eng.megacorp.local + # auth_ldap.servers.2: 192.168.0.100 + # auth_ldap.user_dn_pattern: cn=${username},ou=People,dc=example,dc=com + # auth_ldap.use_ssl: false + # auth_ldap.port: 389 + # auth_ldap.log: false + service: true + plugins: + - rabbitmq_management + - rabbitmq_federation + - rabbitmq_federation_management + # rabbitmq_auth_backend_ldap + vhosts: + - default_vhost + queue: + my-new-queue: + ## note : dict format + user: saltstack_mq + passwd: password + durable: true + auto_delete: false + vhost: default_vhost + arguments: + - x-message-ttl: 8640000 + - x-expires: 8640000 + - x-dead-letter-exchange: my-new-exchange + binding: + my-new-binding: + - destination_type: queue + - destination: my-new-queue + - routing_key: a_routing_key_string + - user: saltstack_mq + - passwd: 'password' + - vhost: default_vhost + - arguments: + - 'x-message-ttl': 8640000 + exchange: + my-new-exchange: + - user: saltstack_mq + - passwd: 'password' + - type: fanout + - durable: true + - internal: false + - auto_delete: false + - vhost: default_vhost + - arguments: + - 'alternate-**exchange': 'amq.fanout' + - 'test-header': 'testing' + remove_guest_user: true + users: + user1: + password: password + force: true + tags: + - monitoring + - user + perms: + default_vhost: + - '.*' + - '.*' + - '.*' + saltstack_mq: + password: password + force: false + tags: + - administrator + - management + perms: + default_vhost: + - '.*' + - '.*' + - '.*' + airflow: + password: 'airflow' + force: true + tags: + - management + - administrator + perms: + 'default_vhost': + - '.*' + - '.*' + - '.*' + policy: + my-new-rabbitmq-policy: + - name: HA + - pattern: '.*' + - definition: '{"ha-mode": "all"}' + upstream: + my-new-upstream1: + - uri: amqp://saltstack_mq:password@localhost + - trust_user_id: true + - ack_mode: on-confirm - user: - user1: - - password: password - - force: true - - tags: monitoring, user - - perms: - - '/': + rabbit2: + clustered: false + user: rabbit2 # 'node' would make more sense here + host: localhost # short hostname of node to join to, not fqdn + nodeport: 5673 + distport: 25673 + erlang_cookie: shared-secret + config: + listeners.tcp.1: 0.0.0.0:5673 + # https://www.rabbitmq.com/ldap.html + # auth_backends.1: ldap + # auth_backends.2: internal + # auth_ldap.servers.1: ldap.eng.megacorp.local + # auth_ldap.servers.2: 192.168.0.100 + # auth_ldap.user_dn_pattern: cn=${username},ou=People,dc=example,dc=com + # auth_ldap.use_ssl: false + # auth_ldap.port: 389 + # auth_ldap.log: false + service: true + plugins: [] + vhosts: + - rabbit2_vhost + queue: + my-new-queue: + ## note : dict format + user: saltstack_mq + passwd: password + durable: true + auto_delete: false + vhost: rabbit2_vhost + arguments: + - x-message-ttl: 8640000 + - x-expires: 8640000 + - x-dead-letter-exchange: my-new-exchange + binding: + my-new-binding: + - destination_type: queue + - destination: my-new-queue + - routing_key: a_routing_key_string + - user: saltstack_mq + - passwd: 'password' + - vhost: rabbit2_vhost + - arguments: + - 'x-message-ttl': 8640000 + exchange: + my-new-exchange: + - user: saltstack_mq + - passwd: 'password' + - type: fanout + - durable: true + - internal: false + - auto_delete: false + - vhost: rabbit2_vhost + - arguments: + - 'alternate-**exchange': 'amq.fanout' + - 'test-header': 'testing' + remove_guest_user: true + users: + user1: + password: password + force: true + tags: + - monitoring + - user + perms: + rabbit2_vhost: - '.*' - '.*' - '.*' - - runas: root - user2: - - password: password - - force: true - - tags: monitoring, user - - perms: - - '/': + saltstack_mq: + password: password + force: false + tags: + - administrator + perms: + rabbit2_vhost: - '.*' - '.*' - '.*' - - runas: root - saltstack: - - password: password - - force: false - - tags: - - administrator - - perms: - - test_vhost: + airflow: + password: 'airflow' + force: true + tags: + - management + - administrator + perms: + 'rabbit2_vhost': - '.*' - '.*' - '.*' - - runas: root + policy: + my-new-rabbitmq-policy: + - name: HA + - pattern: '.*' + - definition: '{"ha-mode": "all"}' + upstream: + my-new-upstream1: + - uri: amqp://saltstack_mq:password@localhost + - trust_user_id: true + - ack_mode: on-confirm + - max_hops: 1 + + pkg: + # https://github.com/rabbitmq/rabbitmq-server/releases/tag/v3.8.14 + use_upstream: repo # if available (i.e. packagecloud) + environ: + locale_all: en_US.UTF-8 + values: {} + # https://www.rabbitmq.com/configure.html#supported-environment-variables + # rabbitmq_mnesia_base: /var/lib/rabbitmq + # RABBITMQ_BASE: /var/lib/rabbitmq + # RABBITMQ_USE_LONGNAME: true # not working in ci + # https://www.rabbitmq.com/configure.html#supported-environment-variables + # RABBITMQ_LOG_BASE: /var/log/rabbitmq + dir: + base: /var/lib/rabbitmq tofs: # The files_switch key serves as a selector for alternative diff --git a/rabbitmq/clean.sls b/rabbitmq/clean.sls index af794fe7..601f04ee 100644 --- a/rabbitmq/clean.sls +++ b/rabbitmq/clean.sls @@ -3,6 +3,5 @@ include: - .config.clean - - .rabbitmqadmin.clean - .service.clean - .package.clean diff --git a/rabbitmq/config/bindings/clean.sls b/rabbitmq/config/bindings/clean.sls new file mode 100644 index 00000000..3a2f750c --- /dev/null +++ b/rabbitmq/config/bindings/clean.sls @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls +--- +{%- set tplroot = tpldir.split('/')[0] %} +{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} + + {%- for name, node in salt["pillar.get"]("rabbitmq:nodes", {}).items() %} + {%- if 'bindings' in node and node.bindings is mapping %} + {%- for binding, q in node.bindings.items() %} + +rabbitmq-config-bindings-delete-{{ name }}-{{ binding }}: + cmd.run: + - name: /usr/local/sbin/rabbitmqadmin --node {{ name }} delete binding --vhost={{ q.vhost }} --username={{ q.user }} --password={{ q.passwd }} name={{ binding }} # noqa 204 + - onlyif: test -x /usr/local/sbin/rabbitmqadmin + - runas: rabbitmq + + {%- endfor %} + {%- endif %} + {%- endfor %} diff --git a/rabbitmq/config/cluster/init.sls b/rabbitmq/config/bindings/init.sls similarity index 100% rename from rabbitmq/config/cluster/init.sls rename to rabbitmq/config/bindings/init.sls diff --git a/rabbitmq/config/bindings/install.sls b/rabbitmq/config/bindings/install.sls new file mode 100644 index 00000000..9db05964 --- /dev/null +++ b/rabbitmq/config/bindings/install.sls @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls +--- +{%- set tplroot = tpldir.split('/')[0] %} +{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} +{%- set sls_service_running = tplroot ~ '.service.running' %} + +include: + - {{ sls_service_running }} + + {%- for name, node in salt["pillar.get"]("rabbitmq:nodes", {}).items() %} + {%- if 'bindings' in node and node.bindings is mapping %} + {%- for binding, ex in node.bindings.items() %} + +rabbitmq-config-bindings-enabled-{{ name }}-{{ binding }}: + cmd.run: + - name: /usr/local/sbin/rabbitmqadmin --node {{ name }} declare binding --vhost={{ ex.vhost }} --username={{ ex.user }} --password={{ ex.passwd }} name={{ binding }} # noqa 204 + - onlyif: test -x /usr/sbin/rabbitmqctl + - runas: rabbitmq + - require: + - sls: {{ sls_service_running }} + + {%- endfor %} + {%- endif %} + {%- endfor %} diff --git a/rabbitmq/config/clean.sls b/rabbitmq/config/clean.sls index 326b47b3..42846b07 100644 --- a/rabbitmq/config/clean.sls +++ b/rabbitmq/config/clean.sls @@ -1,20 +1,15 @@ # -*- coding: utf-8 -*- # vim: ft=sls ---- -{%- set tplroot = tpldir.split('/')[0] %} -{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} include: - - .file.clean - - {%- if salt['cmd.run']('test -f {0}/bin/rabbitmqctl'.format(rabbitmq.dir.base)) %} - - - .policy.clean - - .plugin.clean - - .upstream.clean - - .queue.clean - - .vhost.clean - - .user.clean - - .file.clean - - {%- endif %} + - .users.clean + - .vhosts.clean + - .exchanges.clean + - .bindings.clean + - .queues.clean + - .policies.clean + - .plugins.clean + - .params.clean + - .upstreams.clean + - .clusters.clean + - .files.clean diff --git a/rabbitmq/config/cluster/install.sls b/rabbitmq/config/cluster/install.sls deleted file mode 100644 index d2a5c24f..00000000 --- a/rabbitmq/config/cluster/install.sls +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=sls - -{%- set tplroot = tpldir.split('/')[0] %} -{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} -{%- set sls_service_running = tplroot ~ '.service.running' %} -{%- set sls_config_user = tplroot ~ '.config.user.install' %} - -include: - - {{ sls_service_running }} - - {{ sls_config_user }} - - {%- for name, cluster in salt["pillar.get"]("rabbitmq:cluster", {}).items() %} - {%- if cluster.host and 'erlang_cookie' in cluster and cluster.erlang_cookie is mapping %} - -rabbitmq-config-cluster-{{ name }}-join-{{ cluster.host }}: - file.managed: - - name: {{ cluster.erlang_cookie.name }} - - contents: {{ cluster.erlang_cookie.value }} - - mode: 400 - - user: rabbitmq - - group: {{ rabbitmq.rootgroup }} - - makedirs: True - - watch_in: - - service: rabbitmq-service-running-service-running - - {%- if 'host' in grains and grains.host not in cluster.host %} - - rabbitmq_cluster.joined: - - user: {{ cluster.user }} - - host: {{ cluster.host }} - - ram_node: {{ cluster.ram_node }} - - runas: {{ cluster.runas }} - - require: - - file: rabbitmq-config-cluster-{{ name }}-join-{{ cluster.host }} - - sls: {{ sls_config_user }} - - service: rabbitmq-service-running-service-running - - {%- endif %} - {%- endif %} - {%- endfor %} diff --git a/rabbitmq/config/clusters/clean.sls b/rabbitmq/config/clusters/clean.sls new file mode 100644 index 00000000..3369c517 --- /dev/null +++ b/rabbitmq/config/clusters/clean.sls @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls + +{%- set tplroot = tpldir.split('/')[0] %} +{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} + + {%- for name, node in salt["pillar.get"]("rabbitmq:nodes", {}).items() %} + {%- if node and 'clustered' in node and node.clustered %} + +rabbitmq-config-clusters-{{ name }}-leave-{{ node.join_node }}: + file.absent: + - name: {{ rabbitmq.dir.data }}/{{ name }}/.erlang.cookie + cmd.run: + - names: + - /usr/sbin/rabbitmqctl --node {{ name }} stop_app + - /usr/sbin/rabbitmqctl --node {{ name }} reset + - /usr/sbin/rabbitmqctl --node {{ name }} start_app + - runas: rabbitmq + - onlyif: test -x /usr/sbin/rabbitmqctl + + {%- endif %} + {%- endfor %} diff --git a/rabbitmq/config/file/init.sls b/rabbitmq/config/clusters/init.sls similarity index 100% rename from rabbitmq/config/file/init.sls rename to rabbitmq/config/clusters/init.sls diff --git a/rabbitmq/config/clusters/install.sls b/rabbitmq/config/clusters/install.sls new file mode 100644 index 00000000..adabc0ff --- /dev/null +++ b/rabbitmq/config/clusters/install.sls @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls + +{%- set tplroot = tpldir.split('/')[0] %} +{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} +{%- set sls_service_running = tplroot ~ '.service.running' %} +{%- set sls_config_users = tplroot ~ '.config.users.install' %} + +include: + - {{ sls_service_running }} + - {{ sls_config_users }} + + {%- for name, node in salt["pillar.get"]("rabbitmq:nodes", {}).items() %} + {%- if node and 'clustered' in node and node.clustered %} + +rabbitmq-config-clusters-{{ name }}-join-{{ node.join_node }}: + file.managed: + - name: {{ rabbitmq.dir.data }}/{{ name }}/.erlang.cookie + - contents: {{ node.erlang_cookie }} + - mode: 400 + - user: rabbitmq + - group: {{ rabbitmq.rootgroup }} + - makedirs: True + - require: + - sls: {{ sls_service_running }} + cmd.run: + - name: /usr/sbin/rabbitmqctl --node {{ name }} join_cluster {{ items.join_node }} + - runas: rabbitmq + - onlyif: test -x /usr/sbin/rabbitmqctl + - require: + - file: rabbitmq-config-clusters-{{ name }}-join-{{ node.host }} + - sls: {{ sls_config_users }} + - sls: {{ sls_service_running }} + + {%- endif %} + {%- endfor %} diff --git a/rabbitmq/config/exchanges/clean.sls b/rabbitmq/config/exchanges/clean.sls new file mode 100644 index 00000000..31cce6f3 --- /dev/null +++ b/rabbitmq/config/exchanges/clean.sls @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls +--- +{%- set tplroot = tpldir.split('/')[0] %} +{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} + + {%- for name, node in salt["pillar.get"]("rabbitmq:nodes", {}).items() %} + {%- if 'exchanges' in node and node.exchanges is mapping %} + {%- for exchange, q in node.exchanges.items() %} + +rabbitmq-config-exchanges-delete-{{ name }}-{{ exchange }}: + cmd.run: + - name: /usr/local/sbin/rabbitmqadmin --node {{ name }} delete exchange --vhost={{ q.vhost }} --username={{ q.user }} --password={{ q.passwd }} name={{ exchange }} # noqa 204 + - onlyif: test -x /usr/local/sbin/rabbitmqadmin + - runas: rabbitmq + + {%- endfor %} + {%- endif %} + {%- endfor %} diff --git a/rabbitmq/config/plugin/init.sls b/rabbitmq/config/exchanges/init.sls similarity index 100% rename from rabbitmq/config/plugin/init.sls rename to rabbitmq/config/exchanges/init.sls diff --git a/rabbitmq/config/exchanges/install.sls b/rabbitmq/config/exchanges/install.sls new file mode 100644 index 00000000..48e47a74 --- /dev/null +++ b/rabbitmq/config/exchanges/install.sls @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls +--- +{%- set tplroot = tpldir.split('/')[0] %} +{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} +{%- set sls_service_running = tplroot ~ '.service.running' %} + +include: + - {{ sls_service_running }} + + {%- for name, node in salt["pillar.get"]("rabbitmq:nodes", {}).items() %} + {%- if 'exchanges' in node and node.exchanges is mapping %} + {%- for exchange, ex in node.exchanges.items() %} + +rabbitmq-config-exchanges-enabled-{{ name }}-{{ exchange }}: + cmd.run: + - name: /usr/local/sbin/rabbitmqadmin --node {{ name }} declare exchange --vhost={{ ex.vhost }} --username={{ ex.user }} --password={{ ex.passwd }} name={{ exchange }} # noqa 204 + - onlyif: test -x /usr/sbin/rabbitmqctl + - runas: rabbitmq + - require: + - sls: {{ sls_service_running }} + + {%- endfor %} + {%- endif %} + {%- endfor %} diff --git a/rabbitmq/config/file/install.sls b/rabbitmq/config/file/install.sls deleted file mode 100644 index f0307b09..00000000 --- a/rabbitmq/config/file/install.sls +++ /dev/null @@ -1,89 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=sls - -{%- set tplroot = tpldir.split('/')[0] %} -{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} -{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %} - -rabbitmq-config-file-file-managed: - - {%- if salt['pillar.get']('rabbitmq:config:context', None) %} - file.managed: - - name: {{ rabbitmq.config.name }} - - source: {{ files_switch(['config.tmpl'], - lookup='rabbitmq-config-file-file-managed' - ) - }} - - mode: 644 - - user: root - - group: {{ rabbitmq.rootgroup }} - - makedirs: True - - template: jinja - - context: - config: {{ rabbitmq.config.context | json }} - - {%- else %} - test.show_notification: - - name: Skipping config file management - - text: | - No configuration data provided in the pillar data - - {%- endif %} - {%- if salt['pillar.get']('rabbitmq:env:context', None) %} - -rabbitmq-config-env-file-managed: - file.managed: - - name: {{ rabbitmq.env.name }} - - source: {{ files_switch(['config.tmpl'], - lookup='rabbitmq-config-env-file-managed' - ) - }} - - mode: 644 - - user: root - - group: {{ rabbitmq.rootgroup }} - - makedirs: True - - template: jinja - - context: - env: {{ rabbitmq.env.context | json }} - - {%- endif %} - {%- for filename, info in salt["pillar.get"]("rabbitmq:config_files", {}).items() %} - {%- set source = info['source'] %} - -rabbitmq-config-{{ filename }}-file-managed: - # depreciated - file.managed: - name: /etc/rabbitmq/{{ filename }} - {%- if source.startswith('salt://') %} - - source: {{ source }} - {%- else %} - - source: salt://{{ tplroot }}/{{ source }} - {% endif %} - - template: jinja - - context: {{ info.get('context', {})|json }} - - {% endfor %} - {%- if grains.os_family == 'RedHat' %} - -rabbitmq-config-file-file-managed-limits: - file.managed: - - name: /etc/systemd/system/{{ rabbitmq.service.name }}.service.d/limits.conf - - user: root - - group: root - - makedirs: true - - contents: - - [Service] - - LimitNOFILE=infinity - - TimeoutSec=150 - - require_in: - - service: rabbitmq-service-running-service-running - - {%- if rabbitmq.env.locale_all %} - environ.setenv: - - name: LC_ALL - - value: {{ rabbitmq.env.locale_all }} - - update_minion: True - - require_in: - - service: rabbitmq-service-running-service-running - {%- endif %} - {%- endif %} diff --git a/rabbitmq/config/file/clean.sls b/rabbitmq/config/files/clean.sls similarity index 70% rename from rabbitmq/config/file/clean.sls rename to rabbitmq/config/files/clean.sls index 5db4d38b..147db960 100644 --- a/rabbitmq/config/file/clean.sls +++ b/rabbitmq/config/files/clean.sls @@ -8,11 +8,8 @@ include: - {{ sls_package_clean }} -rabbitmq-config-files-file-absent: +rabbitmq-config-files-absent: file.absent: - - names: - - {{ rabbitmq.config.name }} - - {{ rabbitmq.env.name }} - - /etc/rabbitmq + - name: {{ rabbitmq.dir.config }} - require_in: - sls: {{ sls_package_clean }} diff --git a/rabbitmq/config/policy/init.sls b/rabbitmq/config/files/init.sls similarity index 100% rename from rabbitmq/config/policy/init.sls rename to rabbitmq/config/files/init.sls diff --git a/rabbitmq/config/files/install.sls b/rabbitmq/config/files/install.sls new file mode 100644 index 00000000..d556e293 --- /dev/null +++ b/rabbitmq/config/files/install.sls @@ -0,0 +1,64 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls +--- +{%- set tplroot = tpldir.split('/')[0] %} +{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} +{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %} +{%- set sls_service_running = tplroot ~ '.service.running' %} + +include: + - {{ sls_service_running }} + + {%- for name, node in salt["pillar.get"]("rabbitmq:nodes", {}).items() %} + {%- if 'config' in node and node.config is mapping %} + +rabbitmq-config-files-managed-{{ name }}: + file.managed: + - name: '{{ rabbitmq.dir.config }}/{{ name }}/rabbitmq-server-{{ name }}.conf' + - source: {{ files_switch(['config.tmpl'], + lookup='rabbitmq-config-files-managed-' ~ name + ) + }} + - mode: 644 + - user: root + - group: {{ rabbitmq.rootgroup }} + - makedirs: True + - template: jinja + - context: + config: {{ node.config | json }} + - require_in: + - sls: {{ sls_service_running }} + - watch_in: + - sls: {{ sls_service_running }} + + {%- endif %} + {%- endfor %} + + {%- if 'environ' in rabbitmq and rabbitmq.environ %} + +rabbitmq-config-files-environ-managed: + file.managed: + - name: {{ rabbitmq.dir.config }}/rabbitmq-env.conf + - source: {{ files_switch(['config.tmpl'], + lookup='rabbitmq-config-files-environ-managed' + ) + }} + - mode: 644 + - user: root + - group: {{ rabbitmq.rootgroup }} + - makedirs: True + - template: jinja + - context: + env: {{ rabbitmq.environ | json }} + + {%- endif %} + {%- if grains.os_family == 'RedHat' and rabbitmq.environ.locale_all %} + +rabbitmq-config-files-environ-setenv: + environ.setenv: + - name: LC_ALL + - value: {{ rabbitmq.environ.locale_all }} + - update_minion: True + + {%- endif %} + diff --git a/rabbitmq/config/init.sls b/rabbitmq/config/init.sls index 93320b7e..20f9c3bd 100644 --- a/rabbitmq/config/init.sls +++ b/rabbitmq/config/init.sls @@ -2,11 +2,14 @@ # vim: ft=sls include: - - .file - - .user - - .vhost - - .queue - - .policy - - .plugin - - .upstream - # .cluster should be run once, not always + - .files + - .clusters + - .users + - .vhosts + - .queues + - .policies + - .plugins + - .params + - .exchanges + - .bindings + - .upstreams diff --git a/rabbitmq/config/params/clean.sls b/rabbitmq/config/params/clean.sls new file mode 100644 index 00000000..e69de29b diff --git a/rabbitmq/config/queue/init.sls b/rabbitmq/config/params/init.sls similarity index 100% rename from rabbitmq/config/queue/init.sls rename to rabbitmq/config/params/init.sls diff --git a/rabbitmq/config/params/install.sls b/rabbitmq/config/params/install.sls new file mode 100644 index 00000000..85e1386e --- /dev/null +++ b/rabbitmq/config/params/install.sls @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls +--- +{%- set tplroot = tpldir.split('/')[0] %} +{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} +{%- set sls_service_running = tplroot ~ '.service.running' %} + +include: + - {{ sls_service_running }} + + {%- for name, node in salt["pillar.get"]("rabbitmq:nodes", {}).items() %} + {%- if 'params' in node and node.params is mapping %} + {%- for param, items in node.params.items() %} + +rabbitmq-config-params-present-{{ name }}-{{ param }}: + cmd.run: + - name: /usr/sbin/rabbitmqctl --node {{ name }} {{ items.action }} {{ items.args|join(' ') }} + - onlyif: test -x /usr/sbin/rabbitmqctl + - require: + - sls: {{ sls_service_running }} + + {%- endfor %} + {%- endif %} + {%- endfor %} diff --git a/rabbitmq/config/plugin/clean.sls b/rabbitmq/config/plugin/clean.sls deleted file mode 100644 index 986891f9..00000000 --- a/rabbitmq/config/plugin/clean.sls +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=sls - -{%- set tplroot = tpldir.split('/')[0] %} -{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} - - {%- if 'plugin' in rabbitmq and rabbitmq.plugin is mapping %} - {%- for name in rabbitmq.plugin %} - -rabbitmq-config-plugin-disabled-{{ name }}: - rabbitmq_plugin.disabled: - - name: {{ name }} - - runas: {{ rabbitmq.plugin[name]['runas'] }} - - {%- endfor %} - {%- endif %} diff --git a/rabbitmq/config/plugin/install.sls b/rabbitmq/config/plugin/install.sls deleted file mode 100644 index 5dcf27cf..00000000 --- a/rabbitmq/config/plugin/install.sls +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=sls ---- -{%- set tplroot = tpldir.split('/')[0] %} -{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} -{%- set sls_service_running = tplroot ~ '.service.running' %} - -include: - - {{ sls_service_running }} - - {%- if 'plugin' in rabbitmq and rabbitmq.plugin is mapping %} - {%- for name in rabbitmq.plugin %} - -rabbitmq-config-plugin-enabled-{{ name }}: - rabbitmq_plugin.enabled: - - name: {{ name }} - - runas: {{ rabbitmq.plugin[name]['runas'] }} - - watch_in: - - sls: {{ sls_service_running }} - cmd.run: - - name: locale - - onfail: - - rabbitmq_plugin: rabbitmq-config-plugin-enabled-{{ name }} - - {%- endfor %} - {%- endif %} diff --git a/rabbitmq/config/plugins/clean.sls b/rabbitmq/config/plugins/clean.sls new file mode 100644 index 00000000..ea2f8e1c --- /dev/null +++ b/rabbitmq/config/plugins/clean.sls @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls +--- +{%- set tplroot = tpldir.split('/')[0] %} +{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} + + {%- for name, node in salt["pillar.get"]("rabbitmq:nodes", {}).items() %} + {%- if 'plugins' in node and node.plugins is iterable and node.plugins is not string %} + {%- for plugin in node.plugins %} + +rabbitmq-config-plugins-disabled-{{ name }}-{{ plugin }}: + cmd.run: + - name: /usr/sbin/rabbitmq-plugins --node {{ name }} disable {{ plugin }} + - onlyif: test -x /usr/sbin/rabbitmqctl + - runas: root + file.absent: + - name: /usr/local/sbin/rabbitmqadmin + + {%- endfor %} + {%- endif %} + {%- endfor %} diff --git a/rabbitmq/config/upstream/init.sls b/rabbitmq/config/plugins/init.sls similarity index 100% rename from rabbitmq/config/upstream/init.sls rename to rabbitmq/config/plugins/init.sls diff --git a/rabbitmq/config/plugins/install.sls b/rabbitmq/config/plugins/install.sls new file mode 100644 index 00000000..38402d39 --- /dev/null +++ b/rabbitmq/config/plugins/install.sls @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls +--- +{%- set tplroot = tpldir.split('/')[0] %} +{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} +{%- set sls_service_running = tplroot ~ '.service.running' %} + +include: + - {{ sls_service_running }} + + {%- for name, node in salt["pillar.get"]("rabbitmq:nodes", {}).items() %} + {%- if 'plugins' in node and node.plugins is iterable and node.plugins is not string %} + {%- for plugin in node.plugins %} + +rabbitmq-config-plugins-enabled-{{ name }}-{{ plugin }}: + cmd.run: + - name: /usr/sbin/rabbitmq-plugins --node {{ name }} enable {{ plugin }} + - runas: root + - onlyif: test -x /usr/sbin/rabbitmqctl + - watch_in: + - sls: {{ sls_service_running }} + + {%- if plugin == 'rabbitmq_management' %} + +rabbitmq-config-plugins-{{ name }}-rabbitmqadmin-install: + cmd.run: + - name : curl -k -L http://localhost:15672/cli/rabbitmqadmin -o /usr/local/sbin/rabbitmqadmin + file.managed: + - name: /usr/local/sbin/rabbitmqadmin + - user: root + - force: false + - replace: false + - group: {{ rabbitmq.rootgroup }} + - mode: 755 + - require: + - cmd : rabbitmq-config-plugins-{{ name }}-rabbitmqadmin-install + + {%- endif %} + + {%- endfor %} + {%- endif %} + {%- endfor %} diff --git a/rabbitmq/config/policies/clean.sls b/rabbitmq/config/policies/clean.sls new file mode 100644 index 00000000..5c69d6c1 --- /dev/null +++ b/rabbitmq/config/policies/clean.sls @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls +--- +{%- set tplroot = tpldir.split('/')[0] %} +{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} + + {%- for name, node in salt["pillar.get"]("rabbitmq:nodes", {}).items() %} + {%- if 'policies' in node and node.policies is mapping %} + {%- for policy, items in node.policies.items() %} + +rabbitmq-config-policies-absent-{{ name }}-{{ policy }}: + cmd.run: + - name: /usr/sbin/rabbitmqctl --node {{ name }} clear_policy {{ policy }} {{ '' if 'args' not in items else items.args }} # noqa 204 + - runas: rabbitmq + - onlyif: test -x /usr/sbin/rabbitmqctl + + {%- endfor %} + {%- endif %} + {%- endfor %} diff --git a/rabbitmq/config/user/init.sls b/rabbitmq/config/policies/init.sls similarity index 100% rename from rabbitmq/config/user/init.sls rename to rabbitmq/config/policies/init.sls diff --git a/rabbitmq/config/policies/install.sls b/rabbitmq/config/policies/install.sls new file mode 100644 index 00000000..d2c3911d --- /dev/null +++ b/rabbitmq/config/policies/install.sls @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls +--- +{%- set tplroot = tpldir.split('/')[0] %} +{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} +{%- set sls_service_running = tplroot ~ '.service.running' %} + +include: + - {{ sls_service_running }} + + {%- for name, node in salt["pillar.get"]("rabbitmq:nodes", {}).items() %} + {%- if 'policies' in node and node.policies is mapping %} + {%- for policy, items in node.policies.items() %} + +rabbitmq-config-policies-present-{{ name }}-{{ policy }}: + cmd.run: + - name: /usr/sbin/rabbitmqctl --node {{ name }} set_policy {{ policy }} "{{ items.pattern }}" '{{ items.definition }}' {{ '' if 'args' not in items else items.args }} # noqa 204 + - onlyif: test -x /usr/sbin/rabbitmqctl + - require: + - sls: {{ sls_service_running }} + + {%- endfor %} + {%- endif %} + {%- endfor %} diff --git a/rabbitmq/config/policy/clean.sls b/rabbitmq/config/policy/clean.sls deleted file mode 100644 index c052f0ed..00000000 --- a/rabbitmq/config/policy/clean.sls +++ /dev/null @@ -1,14 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=sls - -{%- set tplroot = tpldir.split('/')[0] %} -{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} - - {% for name in rabbitmq.policy %} - -rabbitmq-config-policy-absent-{{ name }}: - rabbitmq_policy.absent: - - name: {{ name }} - - onlyif: test -x {{ rabbitmq.dir.base }}/bin/rabbitmq-env - - {% endfor %} diff --git a/rabbitmq/config/policy/install.sls b/rabbitmq/config/policy/install.sls deleted file mode 100644 index 4eaa67c8..00000000 --- a/rabbitmq/config/policy/install.sls +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=sls - -{%- set tplroot = tpldir.split('/')[0] %} -{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} -{%- set sls_service_running = tplroot ~ '.service.running' %} - -include: - - {{ sls_service_running }} - - {% for name, policy in salt["pillar.get"]("rabbitmq:policy", {}).items() %} - -rabbitmq-config-policy-present-{{ name }}: - rabbitmq_policy.present: - {% for value in policy %} - - {{ value | json }} - {% endfor %} - - require: - - service: rabbitmq-service-running-service-running - - {% endfor %} diff --git a/rabbitmq/config/queue/clean.sls b/rabbitmq/config/queue/clean.sls deleted file mode 100644 index 99f65ce0..00000000 --- a/rabbitmq/config/queue/clean.sls +++ /dev/null @@ -1,13 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=sls - -{%- set tplroot = tpldir.split('/')[0] %} -{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} - - {% for name, q in salt["pillar.get"]("rabbitmq:queue", {}).items() %} - -rabbitmq-config-queue-absent-{{ name }}: - cmd.run: - - name: /usr/local/sbin/rabbitmqadmin delete queue --vhost={{ q.vhost }} --username={{ q.user }} --password={{ q.passwd }} name={{ name }} # noqa 204 - - {% endfor %} diff --git a/rabbitmq/config/queue/install.sls b/rabbitmq/config/queue/install.sls deleted file mode 100644 index 8e64bc5a..00000000 --- a/rabbitmq/config/queue/install.sls +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=sls - -{%- set tplroot = tpldir.split('/')[0] %} -{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} -{%- set sls_service_running = tplroot ~ '.service.running' %} - -include: - - {{ sls_service_running }} - - {% for name, q in salt["pillar.get"]("rabbitmq:queue", {}).items() %} - -rabbitmq-config-queue-present-{{ name }}: - cmd.run: - - name: /usr/local/sbin/rabbitmqadmin declare queue --vhost={{ q.vhost }} --username={{ q.user }} --password={{ q.passwd }} name={{ name }} durable={{ q.durable|to_bool|lower }} auto_delete={{ q.auto_delete|to_bool|lower }} # noqa 204 - - require: - - service: rabbitmq-service-running-service-running - - {% endfor %} diff --git a/rabbitmq/config/queues/clean.sls b/rabbitmq/config/queues/clean.sls new file mode 100644 index 00000000..e3a59dcd --- /dev/null +++ b/rabbitmq/config/queues/clean.sls @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls +--- +{%- set tplroot = tpldir.split('/')[0] %} +{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} + + {%- for name, node in salt["pillar.get"]("rabbitmq:nodes", {}).items() %} + {%- if 'queues' in node and node.queues is mapping %} + {%- for queue, q in node.queues.items() %} + +rabbitmq-config-queues-disabled-{{ name }}-{{ queue }}: + cmd.run: + - name: /usr/local/sbin/rabbitmqadmin --node {{ name }} delete queue --vhost={{ q.vhost }} --username={{ q.user }} --password={{ q.passwd }} name={{ queue }} # noqa 204 + - onlyif: test -x /usr/sbin/rabbitmqctl + - runas: rabbitmq + + {%- endfor %} + {%- endif %} + {%- endfor %} diff --git a/rabbitmq/config/vhost/init.sls b/rabbitmq/config/queues/init.sls similarity index 100% rename from rabbitmq/config/vhost/init.sls rename to rabbitmq/config/queues/init.sls diff --git a/rabbitmq/config/queues/install.sls b/rabbitmq/config/queues/install.sls new file mode 100644 index 00000000..07909495 --- /dev/null +++ b/rabbitmq/config/queues/install.sls @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls +--- +{%- set tplroot = tpldir.split('/')[0] %} +{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} +{%- set sls_service_running = tplroot ~ '.service.running' %} + +include: + - {{ sls_service_running }} + + {%- for name, node in salt["pillar.get"]("rabbitmq:nodes", {}).items() %} + {%- if 'queues' in node and node.queues is mapping %} + {%- for queue, q in node.queues.items() %} + +rabbitmq-config-queues-enabled-{{ name }}-{{ queue }}: + cmd.run: + - name: /usr/local/sbin/rabbitmqadmin --node {{ name }} declare queue --vhost={{ q.vhost }} --username={{ q.user }} --password={{ q.passwd }} name={{ queue }} durable={{ q.durable|to_bool|lower }} auto_delete={{ q.auto_delete|to_bool|lower }} # noqa 204 + - onlyif: test -x /usr/sbin/rabbitmqctl + - runas: rabbitmq + - require: + - sls: {{ sls_service_running }} + + {%- endfor %} + {%- endif %} + {%- endfor %} diff --git a/rabbitmq/config/upstream/clean.sls b/rabbitmq/config/upstream/clean.sls deleted file mode 100644 index 29cd68c6..00000000 --- a/rabbitmq/config/upstream/clean.sls +++ /dev/null @@ -1,13 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=sls - -{%- set tplroot = tpldir.split('/')[0] %} -{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} - - {% for name in rabbitmq.upstream %} - -rabbitmq-config-upstream-absent-{{ name }}: - rabbitmq_upstream.absent: - - name: {{ name }} - - {% endfor %} diff --git a/rabbitmq/config/upstream/install.sls b/rabbitmq/config/upstream/install.sls deleted file mode 100644 index ac560b5b..00000000 --- a/rabbitmq/config/upstream/install.sls +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=sls - -{%- set tplroot = tpldir.split('/')[0] %} -{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} -{%- set sls_service_running = tplroot ~ '.service.running' %} - -include: - - {{ sls_service_running }} - - {% for name, upstream in salt["pillar.get"]("rabbitmq:upstream", {}).items() %} - -rabbitmq-config-upstream-present-{{ name }}: - rabbitmq_upstream.present: - {% for value in upstream %} - - {{ value | json }} - {% endfor %} - - require: - - service: rabbitmq-service-running-service-running - - {% endfor %} diff --git a/rabbitmq/config/upstreams/clean.sls b/rabbitmq/config/upstreams/clean.sls new file mode 100644 index 00000000..1d2a98bc --- /dev/null +++ b/rabbitmq/config/upstreams/clean.sls @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls +--- +{%- set tplroot = tpldir.split('/')[0] %} +{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} + + {%- for name, node in salt["pillar.get"]("rabbitmq:nodes", {}).items() %} + {%- if 'upstreams' in node and node.upstreams is mapping %} + {%- for upstream, items in node.upstreams.items() %} + +rabbitmq-config-upstreams-absent-{{ name }}-{{ upstream }}: + rabbitmq_upstream.absent: + {% for v in items %} + - {{ v | json }} + {% endfor %} + + {%- endfor %} + {%- endif %} + {%- endfor %} diff --git a/rabbitmq/rabbitmqadmin/config/binding/init.sls b/rabbitmq/config/upstreams/init.sls similarity index 100% rename from rabbitmq/rabbitmqadmin/config/binding/init.sls rename to rabbitmq/config/upstreams/init.sls diff --git a/rabbitmq/config/upstreams/install.sls b/rabbitmq/config/upstreams/install.sls new file mode 100644 index 00000000..4e00d4fe --- /dev/null +++ b/rabbitmq/config/upstreams/install.sls @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls +--- +{%- set tplroot = tpldir.split('/')[0] %} +{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} +{%- set sls_service_running = tplroot ~ '.service.running' %} + +include: + - {{ sls_service_running }} + + {%- for name, node in salt["pillar.get"]("rabbitmq:nodes", {}).items() %} + {%- if 'upstreams' in node and node.upstreams is mapping %} + {%- for upstream, items in node.upstreams.items() %} + +rabbitmq-config-upstreams-present-{{ name }}-{{ upstream }}: + rabbitmq_upstream.present: + {% for v in items %} + - {{ v | json }} + {% endfor %} + - require: + - sls: {{ sls_service_running }} + + {%- endfor %} + {%- endif %} + {%- endfor %} diff --git a/rabbitmq/config/user/clean.sls b/rabbitmq/config/user/clean.sls deleted file mode 100644 index 7612d77a..00000000 --- a/rabbitmq/config/user/clean.sls +++ /dev/null @@ -1,14 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=sls - -{%- set tplroot = tpldir.split('/')[0] %} -{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} - - {% for name, user in salt["pillar.get"]("rabbitmq:user", {}).items() %} - -rabbitmq-config-user-absent-{{ name }}: - rabbitmq_user.absent: - - name: {{ name }} - - onlyif: test -x {{ rabbitmq.dir.base }}/bin/rabbitmq-env - - {% endfor %} diff --git a/rabbitmq/config/user/install.sls b/rabbitmq/config/user/install.sls deleted file mode 100644 index c37ac658..00000000 --- a/rabbitmq/config/user/install.sls +++ /dev/null @@ -1,32 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=sls - -{%- set tplroot = tpldir.split('/')[0] %} -{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} -{%- set sls_service_running = tplroot ~ '.service.running' %} -{%- set sls_config_vhost = tplroot ~ '.config.vhost.install' %} - -include: - - {{ sls_service_running }} - - {{ sls_config_vhost }} - - {% for name, user in salt["pillar.get"]("rabbitmq:user", {}).items() %} - -rabbitmq-config-user-present-{{ name }}: - rabbitmq_user.present: - - name: {{ name }} - {%- for item in user %} - - {{ item|json }} - {%- endfor %} - - require: - - sls: {{ sls_service_running }} - - sls: {{ sls_config_vhost }} - - {% endfor %} - {% if salt['pillar.get']('rabbitmq:remove_guest_user', True) %} - -rabbitmq-config-user-guest-absent: - rabbitmq_user.absent: - - name: guest - - {% endif %} diff --git a/rabbitmq/config/users/clean.sls b/rabbitmq/config/users/clean.sls new file mode 100644 index 00000000..68c68f51 --- /dev/null +++ b/rabbitmq/config/users/clean.sls @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls +--- +{%- set tplroot = tpldir.split('/')[0] %} +{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} + + {%- if grains.os_family == 'RedHat' and rabbitmq.environ.locale_all %} + +rabbitmq-config-users-environ-locale: + environ.setenv: + - name: LC_ALL + - value: {{ rabbitmq.environ.locale_all }} + - update_minion: True + + {%- endif %} + {%- for name, node in salt["pillar.get"]("rabbitmq:nodes", {}).items() %} + {%- if 'users' in node and node.users is mapping %} + {%- for user, items in node.users.items() %} + +rabbitmq-config-users-deleted-{{ name }}-{{ user }}: + cmd.run: + - name: /usr/sbin/rabbitmqctl --node {{ name }} delete_user {{ user }} |true + - onlyif: test -x /usr/sbin/rabbitmqctl + - runas: rabbitmq + + {%- endfor %} + {%- endif %} + {%- endfor %} diff --git a/rabbitmq/rabbitmqadmin/config/exchange/init.sls b/rabbitmq/config/users/init.sls similarity index 100% rename from rabbitmq/rabbitmqadmin/config/exchange/init.sls rename to rabbitmq/config/users/init.sls diff --git a/rabbitmq/config/users/install.sls b/rabbitmq/config/users/install.sls new file mode 100644 index 00000000..a4f239fc --- /dev/null +++ b/rabbitmq/config/users/install.sls @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls +--- +{%- set tplroot = tpldir.split('/')[0] %} +{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} +{%- set sls_service_running = tplroot ~ '.service.running' %} +{%- set sls_vhosts_install = tplroot ~ '.config.vhosts.install' %} +{%- set cmd = '/usr/sbin/rabbitmqctl' %} + +include: + - {{ sls_service_running }} + - {{ sls_vhosts_install }} + + {%- for name, node in salt["pillar.get"]("rabbitmq:nodes", {}).items() %} + {%- if 'users' in node and node.users is mapping %} + {%- for user, u in node.users.items() %} + +rabbitmq-config-users-added-{{ name }}-{{ user }}: + cmd.run: + - names: + - {{ cmd }} --node {{ name }} add_user {{ user }} {{ u.password }} |true + {%- if 'force' in u and u.force %} + - {{ cmd }} --node {{ name }} change_password {{ user }} {{ u.password }} + {%- endif %} + {%- if 'tags' in u and u.tags %} + - {{ cmd }} --node {{ name }} set_user_tags {{ user }} {{ u.tags|join(' ') }} # noqa 204 + {%- endif %} + {%- if 'perms' in u and u.perms %} + {%- for vhost, perms in u.perms.items() %} + - {{ cmd }} --node {{ name }} set_permissions -p {{ vhost }} {{ user }} {{ perms|map("json")|join(" ") }} # noqa 204 + {%- endfor %} + {%- endif %} + - onlyif: test -x {{ cmd }} + - runas: rabbitmq + - require: + - sls: {{ sls_service_running }} + - sls: {{ sls_vhosts_install }} + + {%- endfor %} + {%- endif %} + {%- endfor %} + + {% if salt['pillar.get']('rabbitmq:remove_guest_user', True) %} + +rabbitmq-config-users-guest-absent: + rabbitmq_user.absent: + - name: guest + + {% endif %} diff --git a/rabbitmq/config/vhost/clean.sls b/rabbitmq/config/vhost/clean.sls deleted file mode 100644 index f4eb47b9..00000000 --- a/rabbitmq/config/vhost/clean.sls +++ /dev/null @@ -1,14 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=sls - -{%- set tplroot = tpldir.split('/')[0] %} -{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} - - {% for name in rabbitmq.vhost %} - -rabbitmq-config-vhost-absent-{{ name }}: - rabbitmq_vhost.absent: - - name: {{ name }} - - onlyif: test -x {{ rabbitmq.dir.base }}/bin/rabbitmq-env - - {% endfor %} diff --git a/rabbitmq/config/vhost/install.sls b/rabbitmq/config/vhost/install.sls deleted file mode 100644 index 66b2d507..00000000 --- a/rabbitmq/config/vhost/install.sls +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=sls - -{%- set tplroot = tpldir.split('/')[0] %} -{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} -{%- set sls_service_running = tplroot ~ '.service.running' %} - -include: - - {{ sls_service_running }} - - {% for name in rabbitmq.vhost %} - -rabbitmq-config-vhost-present-{{ name }}: - rabbitmq_vhost.present: - - name: {{ name }} - - require: - - service: rabbitmq-service-running-service-running - - {% endfor %} diff --git a/rabbitmq/config/vhosts/clean.sls b/rabbitmq/config/vhosts/clean.sls new file mode 100644 index 00000000..93775d91 --- /dev/null +++ b/rabbitmq/config/vhosts/clean.sls @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls +--- +{%- set tplroot = tpldir.split('/')[0] %} +{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} + + {%- for name, node in salt["pillar.get"]("rabbitmq:nodes", {}).items() %} + {%- if 'vhosts' in node and node.vhosts is iterable and node.vhosts is not string %} + {%- for vhost in node.vhosts %} + +rabbitmq-config-vhosts-delete-{{ name }}-{{ vhost }}: + cmd.run: + - name: /usr/sbin/rabbitmqctl --node {{ name }} delete_vhost {{ vhost }} || true + - onlyif: test -x /usr/sbin/rabbitmqctl + - runas: rabbitmq + + {%- endfor %} + {%- endif %} + {%- endfor %} diff --git a/rabbitmq/rabbitmqadmin/config/queue/init.sls b/rabbitmq/config/vhosts/init.sls similarity index 100% rename from rabbitmq/rabbitmqadmin/config/queue/init.sls rename to rabbitmq/config/vhosts/init.sls diff --git a/rabbitmq/config/vhosts/install.sls b/rabbitmq/config/vhosts/install.sls new file mode 100644 index 00000000..032b7f76 --- /dev/null +++ b/rabbitmq/config/vhosts/install.sls @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls +--- +{%- set tplroot = tpldir.split('/')[0] %} +{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} +{%- set sls_service_running = tplroot ~ '.service.running' %} + +include: + - {{ sls_service_running }} + + {%- for name, node in salt["pillar.get"]("rabbitmq:nodes", {}).items() %} + {%- if 'vhosts' in node and node.vhosts is iterable and node.vhosts is not string %} + {%- for vhost in node.vhosts %} + +rabbitmq-config-vhosts-add-{{ name }}-{{ vhost }}: + cmd.run: + - name: /usr/sbin/rabbitmqctl --node {{ name }} add_vhost {{ vhost }} + - onlyif: test -x /usr/sbin/rabbitmqctl + - runas: rabbitmq + - require: + - sls: {{ sls_service_running }} + + {%- endfor %} + {%- endif %} + {%- endfor %} diff --git a/rabbitmq/files/default/systemd.ini.jinja b/rabbitmq/files/default/systemd.ini.jinja new file mode 100644 index 00000000..3c8c5441 --- /dev/null +++ b/rabbitmq/files/default/systemd.ini.jinja @@ -0,0 +1,50 @@ +######################################################### +# File managed by Salt. Changes risk being overwritten. +######################################################### +[Unit] +Description=RabbitMQ Broker {{ '' if name is not defined or name else name }} +Wants=network-online.target +After=syslog.target network.target + +[Service] +Type=notify +User=rabbitmq +Group=rabbitmq +UMask=0027 +NotifyAccess=all +TimeoutStartSec=600 +Environment="RABBITMQ_NODENAME={{ 'rabbit' if nodename is not defined else nodename }}" +Environment="RABBITMQ_NODE_PORT={{ '5672' if nodeport is not defined else nodeport }}" +Environment="RABBITMQ_SERVER_START_ARGS=-rabbitmq_management listener [{port,{{ nodeport + 10000 }}}]" +Environment="RABBITMQ_DIST_PORT={{ '25672' if distport is not defined else distport }}" +Environment="RABBITMQ_MNESIA_DIR={{ '/var/lib/rabbitmq' if mnesia_dir is not defined else mnesia_dir }}" + +# To override LimitNOFILE, create the following file: +# +# /etc/systemd/system/rabbitmq-server.service.d/limits.conf +# +# with the following content: +# +# [Service] +# LimitNOFILE=65536 + +LimitNOFILE=32768 + +# Note: systemd on CentOS 7 complains about in-line comments, +# so only append them here +# +# Restart: +# The following setting will automatically restart RabbitMQ +# in the event of a failure. systemd service restarts are not a +# replacement for service monitoring. Please see +# https://www.rabbitmq.com/monitoring.html +Restart=on-failure +RestartSec=10 +WorkingDirectory={{ '/var/lib/rabbitmq' if workdir is not defined else workdir }} +ExecStart=/usr/sbin/rabbitmq-server +ExecStop=/usr/sbin/rabbitmqctl shutdown +# See rabbitmq/rabbitmq-server-release#51 +SuccessExitStatus=69 + +[Install] +WantedBy=multi-user.target diff --git a/rabbitmq/init.sls b/rabbitmq/init.sls index cc4da5c2..858a8e6e 100644 --- a/rabbitmq/init.sls +++ b/rabbitmq/init.sls @@ -3,6 +3,5 @@ include: - .package - - .rabbitmqadmin - .config - .service diff --git a/rabbitmq/package/clean.sls b/rabbitmq/package/clean.sls index 909e136c..562971c0 100644 --- a/rabbitmq/package/clean.sls +++ b/rabbitmq/package/clean.sls @@ -3,15 +3,18 @@ {%- set tplroot = tpldir.split('/')[0] %} {%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} +{%- set sls_service_clean = tplroot ~ '.service.clean' %} {%- set sls_repo_clean = tplroot ~ '.package.repo.clean' %} include: - {{ sls_repo_clean }} + - {{ sls_service_clean }} rabbitmq-package-clean-pkg-removed: pkg.removed: - name: {{ rabbitmq.pkg.name }} - require: - sls: {{ sls_repo_clean }} + - sls: {{ sls_service_clean }} file.absent: - names: {{ rabbitmq.dir.cleanlist or ['/tmp/silly_321.out',] }} diff --git a/rabbitmq/parameters/defaults.yaml b/rabbitmq/parameters/defaults.yaml index 3b0bc70f..df7c2203 100644 --- a/rabbitmq/parameters/defaults.yaml +++ b/rabbitmq/parameters/defaults.yaml @@ -4,61 +4,50 @@ # Set default values. --- values: - cluster: - rabbit@locahost: + nodes: + rabbit: # the default rabbitmq nodename + clustered: false user: rabbit # 'node' would make more sense here host: localhost # short hostname of node to join to, not fqdn - ram_node: None runas: rabbitmq - erlang_cookie: - name: /var/lib/rabbitmq/.erlang.cookie - value: shared-value-for-all-cluster-members + erlang_cookie: null + config: {} + service: true + plugins: + - rabbitmq_management + - rabbitmq_federation + - rabbitmq_federation_management + # rabbitmq_auth_backend_ldap + vhosts: + - '/virtual/host' + users: {} + remove_guest_user: true + policy: + rabbitmq_policy: + - name: HA + - pattern: '.*' + - definition: '{"ha-mode": "all"}' + queues: {} + + environ: {} + pkg: name: rabbitmq-server # https://github.com/rabbitmq/rabbitmq-server/releases/tag/v3.8.14 use_upstream: repo # use upstream repo (if applicable) - deps: [] + deps: {} + dir: base: /usr/lib/rabbitmq data: /var/lib/rabbitmq + config: /etc/rabbitmq cleanlist: - /usr/local/bin/rabbitmq-env - /usr/local/bin/rabbitmq-plugins - /var/run/rabbitmq - env: - name: /etc/rabbitmq/rabbitmq-env.conf - locale_all: null - context: - rabbitmq_mnesia_base: /var/lib/rabbitmq - RABBITMQ_BASE: /var/lib/rabbitmq - config: - context: {} - name: /etc/rabbitmq/rabbitmq.conf - # see rabbitmq.conf.example from rabbitmq-server github docs - service: - name: rabbitmq-server - enabled: true - running: true - plugin: - # http-based API for management, monitoring, browser ui, rabbitmqadm cli - # required by binding, exchange, and queue states - rabbitmq_management: - runas: root - rabbitmq_federation: - runas: root - policy: - rabbitmq_policy: - - name: HA - - pattern: '.*' - - definition: '{"ha-mode": "all"}' - vhost: - - '/virtual/host' + service: /usr/lib/systemd/system rootgroup: root - # default guest user will be removed unless this is set to false - remove_guest_user: true - user: {} - retry_option: # https://docs.saltstack.com/en/latest/ref/states/requisites.html#retrying-states attempts: 0 diff --git a/rabbitmq/parameters/os_family/Debian.yaml b/rabbitmq/parameters/os_family/Debian.yaml index c05bc2da..a9dd753d 100644 --- a/rabbitmq/parameters/os_family/Debian.yaml +++ b/rabbitmq/parameters/os_family/Debian.yaml @@ -15,4 +15,5 @@ values: pkg: deps: - libtinfo5 + # erlang-eldap ... diff --git a/rabbitmq/parameters/os_family/RedHat.yaml b/rabbitmq/parameters/os_family/RedHat.yaml index e001ad71..16aac5bd 100644 --- a/rabbitmq/parameters/os_family/RedHat.yaml +++ b/rabbitmq/parameters/os_family/RedHat.yaml @@ -14,4 +14,7 @@ values: config: name: /etc/rabbitmq/rabbitmq.conf + pkg: + deps: + - socat ... diff --git a/rabbitmq/parameters/osfinger/CentOS-7.yaml b/rabbitmq/parameters/osfinger/CentOS-7.yaml new file mode 100644 index 00000000..8ebe5d2f --- /dev/null +++ b/rabbitmq/parameters/osfinger/CentOS-7.yaml @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +# +# Set values specific to: +# salt['config.get']('osfinger') == CentOS-6. +# +# You just need to add the key:values for this `osfinger` that differ +# from `defaults.yaml`. +# +# If you do not need to provide defaults via the `osfinger` config, +# you can remove this file or provide at least an empty dict, e.g. +# values: {} +--- +values: + locale_all: en_US.UTF-8 +... diff --git a/rabbitmq/rabbitmqadmin/clean.sls b/rabbitmq/rabbitmqadmin/clean.sls deleted file mode 100644 index bce50857..00000000 --- a/rabbitmq/rabbitmqadmin/clean.sls +++ /dev/null @@ -1,9 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=sls - -{%- set tplroot = tpldir.split('/')[0] %} -{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} - -rabbitmq-rabbitmqadmin-clean: - file.absent: - - name: /usr/local/sbin/rabbitmqadmin diff --git a/rabbitmq/rabbitmqadmin/config/binding/clean.sls b/rabbitmq/rabbitmqadmin/config/binding/clean.sls deleted file mode 100644 index e8bbcda9..00000000 --- a/rabbitmq/rabbitmqadmin/config/binding/clean.sls +++ /dev/null @@ -1,13 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=sls - -{%- set tplroot = tpldir.split('/')[0] %} -{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} - - {% for name, binding in salt["pillar.get"]("rabbitmq:binding", {}).items() %} - -rabbitmq-rabbitmqadmin-binding-absent-{{ name }}: - rabbitmq_binding.absent: - - name: {{ binding.name }} - - {% endfor %} diff --git a/rabbitmq/rabbitmqadmin/config/binding/install.sls b/rabbitmq/rabbitmqadmin/config/binding/install.sls deleted file mode 100644 index 3bf9f5ea..00000000 --- a/rabbitmq/rabbitmqadmin/config/binding/install.sls +++ /dev/null @@ -1,30 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=sls - -{%- set tplroot = tpldir.split('/')[0] %} -{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} -{%- set sls_rabbitmqadmin_install = tplroot ~ '.rabbitmqadmin.install' %} -{%- set sls_config_vhost = tplroot ~ '.config.vhost.install' %} -{%- set sls_service_running = tplroot ~ '.service.running' %} -{%- set sls_config_user = tplroot ~ '.config.user.install' %} - -include: - - {{ sls_service_running }} - - {{ sls_rabbitmqadmin_install }} - - {{ sls_config_vhost }} - - {{ sls_config_user }} - - {% for name, binding in salt["pillar.get"]("rabbitmq:binding", {}).items() %} - -rabbitmq-rabbitmqadmin-binding-present-{{ name }}: - rabbitmq_binding.present: - {% for value in binding %} - - {{ value | json }} - {% endfor %} - - require: - - sls: {{ sls_service_running }} - - sls: {{ sls_rabbitmqadmin_install }} - - sls: {{ sls_config_vhost }} - - sls: {{ sls_config_user }} - - {% endfor %} diff --git a/rabbitmq/rabbitmqadmin/config/clean.sls b/rabbitmq/rabbitmqadmin/config/clean.sls deleted file mode 100644 index 989ff89e..00000000 --- a/rabbitmq/rabbitmqadmin/config/clean.sls +++ /dev/null @@ -1,12 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=sls - -{%- set module_list = salt['sys.list_modules']() %} -{% if 'rabbitmqadmin' in module_list % - -include: - - .binding.clean - - .exchange.clean - - .queue.clean - -{%- endif %} diff --git a/rabbitmq/rabbitmqadmin/config/exchange/clean.sls b/rabbitmq/rabbitmqadmin/config/exchange/clean.sls deleted file mode 100644 index 76917cca..00000000 --- a/rabbitmq/rabbitmqadmin/config/exchange/clean.sls +++ /dev/null @@ -1,13 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=sls - -{%- set tplroot = tpldir.split('/')[0] %} -{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} - - {% for name, exchange in salt["pillar.get"]("rabbitmq:exchange", {}).items() %} - -rabbitmq-rabbitmqadmin-exchange-absent-{{ name }}: - rabbitmq_exchange.absent: - - name: {{ exchange.name }} - - {% endfor %} diff --git a/rabbitmq/rabbitmqadmin/config/exchange/install.sls b/rabbitmq/rabbitmqadmin/config/exchange/install.sls deleted file mode 100644 index c7c30116..00000000 --- a/rabbitmq/rabbitmqadmin/config/exchange/install.sls +++ /dev/null @@ -1,30 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=sls - -{%- set tplroot = tpldir.split('/')[0] %} -{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} -{%- set sls_rabbitmqadmin_install = tplroot ~ '.rabbitmqadmin.install' %} -{%- set sls_config_vhost = tplroot ~ '.config.vhost' %} -{%- set sls_service_running = tplroot ~ '.service.running' %} -{%- set sls_config_user = tplroot ~ '.config.user.install' %} - -include: - - {{ sls_service_running }} - - {{ sls_rabbitmqadmin_install }} - - {{ sls_config_vhost }} - - {{ sls_config_user }} - - {% for name, exchange in salt["pillar.get"]("rabbitmq:exchange", {}).items() %} - -rabbitmq-rabbitmqadmin-exchange-present-{{ name }}: - rabbitmq_exchange.present: - {% for value in exchange %} - - {{ value | json }} - {% endfor %} - - require: - - sls: {{ sls_config_vhost }} - - sls: {{ sls_rabbitmqadmin_install }} - - sls: {{ sls_config_vhost }} - - sls: {{ sls_config_user }} - - {% endfor %} diff --git a/rabbitmq/rabbitmqadmin/config/init.sls b/rabbitmq/rabbitmqadmin/config/init.sls deleted file mode 100644 index 66077e72..00000000 --- a/rabbitmq/rabbitmqadmin/config/init.sls +++ /dev/null @@ -1,12 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=sls - -{%- set module_list = salt['sys.list_modules']() %} -{% if 'rabbitmqadmin' in module_list %} - -include: - - .binding - - .exchange - - .queue - -{%- endif %} diff --git a/rabbitmq/rabbitmqadmin/config/queue/clean.sls b/rabbitmq/rabbitmqadmin/config/queue/clean.sls deleted file mode 100644 index 87a6b052..00000000 --- a/rabbitmq/rabbitmqadmin/config/queue/clean.sls +++ /dev/null @@ -1,13 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=sls - -{%- set tplroot = tpldir.split('/')[0] %} -{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} - - {% for name, queue in salt["pillar.get"]("rabbitmq:queue", {}).items() %} - -rabbitmq-rabbitmqadmin-queue-absent-{{ name }}: - rabbitmq_queue.absent: - - name: {{ queue.name }} - - {% endfor %} diff --git a/rabbitmq/rabbitmqadmin/config/queue/install.sls b/rabbitmq/rabbitmqadmin/config/queue/install.sls deleted file mode 100644 index 8cd1cb0a..00000000 --- a/rabbitmq/rabbitmqadmin/config/queue/install.sls +++ /dev/null @@ -1,30 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=sls - -{%- set tplroot = tpldir.split('/')[0] %} -{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} -{%- set sls_rabbitmqadmin_install = tplroot ~ '.rabbitmqadmin.install' %} -{%- set sls_config_vhost = tplroot ~ '.config.vhost' %} -{%- set sls_service_running = tplroot ~ '.service.running' %} -{%- set sls_config_user = tplroot ~ '.config.user.install' %} - -include: - - {{ sls_service_running }} - - {{ sls_rabbitmqadmin_install }} - - {{ sls_config_vhost }} - - {{ sls_config_user }} - - {% for name, queue in salt["pillar.get"]("rabbitmq:queue", {}).items() %} - -rabbitmq-rabbitmqadmin-queue-present-{{ name }}: - rabbitmq_queue.present: - {% for value in queue %} - - {{ value | json }} - {% endfor %} - - require: - - sls: {{ sls_service_running }} - - sls: {{ sls_rabbitmqadmin_install }} - - sls: {{ sls_config_vhost }} - - sls: {{ sls_config_user }} - - {% endfor %} diff --git a/rabbitmq/rabbitmqadmin/init.sls b/rabbitmq/rabbitmqadmin/init.sls deleted file mode 100644 index 956a107d..00000000 --- a/rabbitmq/rabbitmqadmin/init.sls +++ /dev/null @@ -1,6 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=sls - -include: - - .install - - .config diff --git a/rabbitmq/rabbitmqadmin/install.sls b/rabbitmq/rabbitmqadmin/install.sls deleted file mode 100644 index 811a9452..00000000 --- a/rabbitmq/rabbitmqadmin/install.sls +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=sls - -{%- set tplroot = tpldir.split('/')[0] %} -{%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} -{%- set sls_config_plugin = tplroot ~ '.config.plugin.install' %} - -include: - - {{ sls_config_plugin }} - -rabbitmq-rabbitmqadmin-install: - cmd.run: - - name : curl -k -L http://localhost:15672/cli/rabbitmqadmin -o /usr/local/sbin/rabbitmqadmin - - require: - - sls: {{ sls_config_plugin }} - file.managed: - - name: /usr/local/sbin/rabbitmqadmin - - user: root - - force: false - - replace: false - - group: {{ rabbitmq.rootgroup }} - - mode: 755 - - require: - - cmd : rabbitmq-rabbitmqadmin-install diff --git a/rabbitmq/service/clean.sls b/rabbitmq/service/clean.sls index 96188465..eab97214 100644 --- a/rabbitmq/service/clean.sls +++ b/rabbitmq/service/clean.sls @@ -1,17 +1,31 @@ # -*- coding: utf-8 -*- # vim: ft=sls - +--- {%- set tplroot = tpldir.split('/')[0] %} {%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} -{%- set sls_package_clean = tplroot ~ '.package.clean' %} -include: - - {{ sls_package_clean }} + {%- for name, node in salt["pillar.get"]("rabbitmq:nodes", {}).items() %} + {%- if 'service' in node and node.service %} + + {%- set name = '-' ~ name %} + {%- if name == '-rabbit' %} + {%- set name='' %} + {%- endif %} -rabbitmq-service-clean-service-dead: +rabbitmq-service-dead-service{{ name }}: service.dead: - - name: {{ rabbitmq.service.name }} + - name: rabbitmq-server{{ name }} - enable: False - - sig: 'rabbit boot' - - require_in: - - sls: {{ sls_package_clean }} + file.absent: + - names: + - '{{ rabbitmq.dir.service }}/rabbitmq-server{{ name|replace('-', '') }}.service' + - '/etc/systemd/system/rabbitmq-server{{ name|replace('-', '') }}.service.d/limits.conf' + - watch_in: + - cmd: rabbitmq-service-dead-daemon-reload + + {%- endif %} + {%- endfor %} + +rabbitmq-service-dead-daemon-reload: + cmd.run: + - name: systemctl daemon-reload diff --git a/rabbitmq/service/running.sls b/rabbitmq/service/running.sls index 4d5e597f..8fe0a97e 100644 --- a/rabbitmq/service/running.sls +++ b/rabbitmq/service/running.sls @@ -2,26 +2,88 @@ # vim: ft=sls --- {%- set tplroot = tpldir.split('/')[0] %} -{%- set sls_config_file = tplroot ~ '.config.file.install' %} +{%- set sls_config_files = tplroot ~ '.config.files.install' %} +{%- set sls_config_users = tplroot ~ '.config.users.install' %} {%- from tplroot ~ "/map.jinja" import mapdata as rabbitmq with context %} +{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %} include: - - {{ sls_config_file }} + - {{ sls_config_files }} + - {{ sls_config_users }} -rabbitmq-service-running-service-running: + {%- for name, node in salt["pillar.get"]("rabbitmq:nodes", {}).items() %} + {%- if 'service' in node and node.service %} + + {%- set name = '-' ~ name %} + {%- if name == '-rabbit' %} + {%- set name='' %} + {%- endif %} + +rabbitmq-service-running-directory{{ name }}: file.directory: - - name: {{ rabbitmq.dir.data }} + - name: {{ rabbitmq.dir.data }}/{{ name|replace('-', '') }} - user: rabbitmq - group: rabbitmq + - makedirs: true - dir_mode: '0755' + +rabbitmq-service-running-managed{{ name }}: + file.managed: + - name: '{{ rabbitmq.dir.service }}/rabbitmq-server{{ name }}.service' + - source: {{ files_switch(['systemd.ini.jinja'], + lookup='rabbitmq-service-running-managed' ~ name + ) + }} + - mode: '0644' + - user: rabbitmq + - group: {{ rabbitmq.rootgroup }} + - makedirs: True + - template: jinja + - context: + name: {{ name }} + workdir: {{ rabbitmq.dir.data }}/{{ name|replace('-', '') }} + nodeport: {{ '' if 'nodeport' not in node else node.nodeport }} + distport: {{ '' if 'distport' not in node else node.distport }} + nodename: {{ node.user }} + mnesia_dir: {{ rabbitmq.dir.data }}/{{ name|replace('-', '') }} + - require_in: + - service: rabbitmq-service-running-service-running{{ name }} + + {%- if grains.os_family == 'RedHat' %} +rabbitmq-service-running-managed{{ name }}-limits: + file.managed: + - name: '/etc/systemd/system/rabbitmq-server{{ name }}.service.d/limits.conf' + - user: root + - group: root + - makedirs: true + - contents: + - [Service] + - LimitNOFILE=infinity + - TimeoutSec=150 + - require_in: + - service: rabbitmq-service-running-service-running{{ name }} + {%- endif %} + +rabbitmq-service-running-service-running{{ name }}: service.running: - - name: {{ rabbitmq.service.name }} + - name: rabbitmq-server{{ name }} - retry: {{ rabbitmq.retry_option|json }} - enable: True - watch: - - sls: {{ sls_config_file }} + - sls: {{ sls_config_files }} - onfail_in: - - cmd: rabbitmq-service-running-service-running + - cmd: rabbitmq-service-running-service-running{{ name }} + - require: + - cmd: rabbitmq-service-running-daemon-reload + - file: rabbitmq-service-running-directory{{ name }} + - file: rabbitmq-service-running-managed{{ name }} cmd.run: - names: - - journalctl -xe -u {{ rabbitmq.service.name }} || true + - journalctl -xe -u {{ 'rabbitmq-server' ~ name }} || true + + {%- endif %} + {%- endfor %} + +rabbitmq-service-running-daemon-reload: + cmd.run: + - name: systemctl daemon-reload diff --git a/test/integration/default/controls/config.rb b/test/integration/default/controls/config.rb index d055f753..b1350b58 100644 --- a/test/integration/default/controls/config.rb +++ b/test/integration/default/controls/config.rb @@ -10,6 +10,5 @@ describe file('/etc/rabbitmq/rabbitmq-env.conf') do it { should exist } it { should be_file } - its('content') { should include 'RABBITMQ_MNESIA_BASE=/var/lib/rabbitmq' } end end diff --git a/test/integration/default/controls/rabbitmq_users_spec.rb b/test/integration/default/controls/rabbitmq_users_spec.rb index f89becde..90d5601e 100644 --- a/test/integration/default/controls/rabbitmq_users_spec.rb +++ b/test/integration/default/controls/rabbitmq_users_spec.rb @@ -5,7 +5,8 @@ describe command('rabbitmqctl list_users') do its('stdout') { should include 'user1' } - its('stdout') { should include 'user2' } + its('stdout') { should include 'airflow' } + its('stdout') { should include 'saltstack_mq' } its('stdout') { should_not include 'guest' } end end diff --git a/test/integration/default/files/_mapdata/amazonlinux-2.yaml b/test/integration/default/files/_mapdata/amazonlinux-2.yaml index 5d6d1a9a..3a995cc4 100644 --- a/test/integration/default/files/_mapdata/amazonlinux-2.yaml +++ b/test/integration/default/files/_mapdata/amazonlinux-2.yaml @@ -1,153 +1,5 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml # yamllint disable rule:indentation rule:line-length # Amazon Linux-2 --- -values: - added_in_defaults: defaults_value - added_in_pillar: pillar_value - arch: amd64 - binding: - my-new-binding: - - destination_type: queue - - destination: my-new-queue - - routing_key: a_routing_key_string - - user: saltstack - - passwd: password - - vhost: test_vhost - - arguments: - - x-message-ttl: 8640000 - cluster: - rabbit@locahost: - erlang_cookie: - name: /var/lib/rabbitmq/.erlang.cookie - value: shared-value-for-all-cluster-members - host: localhost # short hostname of node to join to, not fqdn - ram_node: None - runas: rabbitmq - user: rabbit # 'node' would make more sense here - config: - context: - listeners.tcp.1: 0.0.0.0:5672 - name: /etc/rabbitmq/rabbitmq.conf - dir: - base: /var/lib/rabbitmq - cleanlist: - - /usr/local/bin/rabbitmq-env - - /usr/local/bin/rabbitmq-plugins - - /var/run/rabbitmq - data: /var/lib/rabbitmq - env: - context: - RABBITMQ_BASE: /var/lib/rabbitmq - RABBITMQ_LOG_BASE: /var/log/rabbitmq - rabbitmq_mnesia_base: /var/lib/rabbitmq - locale_all: en_US.UTF-8 - name: /etc/rabbitmq/rabbitmq-env.conf - exchange: - my-new-exchange: - - user: saltstack - - passwd: password - - type: fanout - - durable: true - - internal: false - - auto_delete: false - - vhost: test_vhost - - arguments: - - alternate-**exchange: amq.fanout - - test-header: testing - map_jinja: - sources: - - Y:G@osarch - - Y:G@os_family - - Y:G@os - - Y:G@osfinger - - C@rabbitmq:lookup - - C@rabbitmq - - Y:G@id - pkg: - deps: [] - name: rabbitmq-server - use_upstream: repo - plugin: - rabbitmq_federation: - runas: root - rabbitmq_management: - runas: root - policy: - rabbitmq_policy: - - name: HA - - pattern: .* - - definition: '{"ha-mode": "all"}' - queue: - my-new-queue: - arguments: - - x-message-ttl: 8640000 - - x-expires: 8640000 - - x-dead-letter-exchange: my-new-exchange - auto_delete: false - durable: true - passwd: password - user: saltstack - vhost: test_vhost - remove_guest_user: true - retry_option: - attempts: 0 - interval: 60 - splay: 10 - until: true - rootgroup: root - service: - enabled: true - name: rabbitmq-server - running: true - tofs: - files_switch: - - any/path/can/be/used/here - - id - - roles - - osfinger - - os - - os_family - source_files: - rabbitmq-config-file-file-managed: - - example.tmpl.jinja - upstream: - upstream_1: - - uri: amqp://saltstack:password@localhost - - trust_user_id: true - - ack_mode: on-confirm - - max_hops: 1 - user: - saltstack: - - password: password - - force: false - - tags: - - administrator - - perms: - - test_vhost: - - .* - - .* - - .* - - runas: root - user1: - - password: password - - force: true - - tags: monitoring, user - - perms: - - /: - - .* - - .* - - .* - - runas: root - user2: - - password: password - - force: true - - tags: monitoring, user - - perms: - - /: - - .* - - .* - - .* - - runas: root - vhost: - - test_vhost - winner: pillar diff --git a/test/integration/default/files/_mapdata/arch-base-latest.yaml b/test/integration/default/files/_mapdata/arch-base-latest.yaml index 4adbf27e..9e195938 100644 --- a/test/integration/default/files/_mapdata/arch-base-latest.yaml +++ b/test/integration/default/files/_mapdata/arch-base-latest.yaml @@ -1,153 +1,5 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml # yamllint disable rule:indentation rule:line-length # Arch --- -values: - added_in_defaults: defaults_value - added_in_pillar: pillar_value - arch: amd64 - binding: - my-new-binding: - - destination_type: queue - - destination: my-new-queue - - routing_key: a_routing_key_string - - user: saltstack - - passwd: password - - vhost: test_vhost - - arguments: - - x-message-ttl: 8640000 - cluster: - rabbit@locahost: - erlang_cookie: - name: /var/lib/rabbitmq/.erlang.cookie - value: shared-value-for-all-cluster-members - host: localhost # short hostname of node to join to, not fqdn - ram_node: None - runas: rabbitmq - user: rabbit # 'node' would make more sense here - config: - context: - listeners.tcp.1: 0.0.0.0:5672 - name: /etc/rabbitmq/rabbitmq.conf - dir: - base: /var/lib/rabbitmq - cleanlist: - - /usr/local/bin/rabbitmq-env - - /usr/local/bin/rabbitmq-plugins - - /var/run/rabbitmq - data: /var/lib/rabbitmq - env: - context: - RABBITMQ_BASE: /var/lib/rabbitmq - RABBITMQ_LOG_BASE: /var/log/rabbitmq - rabbitmq_mnesia_base: /var/lib/rabbitmq - locale_all: en_US.UTF-8 - name: /etc/rabbitmq/rabbitmq-env.conf - exchange: - my-new-exchange: - - user: saltstack - - passwd: password - - type: fanout - - durable: true - - internal: false - - auto_delete: false - - vhost: test_vhost - - arguments: - - alternate-**exchange: amq.fanout - - test-header: testing - map_jinja: - sources: - - Y:G@osarch - - Y:G@os_family - - Y:G@os - - Y:G@osfinger - - C@rabbitmq:lookup - - C@rabbitmq - - Y:G@id - pkg: - deps: [] - name: rabbitmq - use_upstream: repo - plugin: - rabbitmq_federation: - runas: root - rabbitmq_management: - runas: root - policy: - rabbitmq_policy: - - name: HA - - pattern: .* - - definition: '{"ha-mode": "all"}' - queue: - my-new-queue: - arguments: - - x-message-ttl: 8640000 - - x-expires: 8640000 - - x-dead-letter-exchange: my-new-exchange - auto_delete: false - durable: true - passwd: password - user: saltstack - vhost: test_vhost - remove_guest_user: true - retry_option: - attempts: 0 - interval: 60 - splay: 10 - until: true - rootgroup: root - service: - enabled: true - name: rabbitmq-server - running: true - tofs: - files_switch: - - any/path/can/be/used/here - - id - - roles - - osfinger - - os - - os_family - source_files: - rabbitmq-config-file-file-managed: - - example.tmpl.jinja - upstream: - upstream_1: - - uri: amqp://saltstack:password@localhost - - trust_user_id: true - - ack_mode: on-confirm - - max_hops: 1 - user: - saltstack: - - password: password - - force: false - - tags: - - administrator - - perms: - - test_vhost: - - .* - - .* - - .* - - runas: root - user1: - - password: password - - force: true - - tags: monitoring, user - - perms: - - /: - - .* - - .* - - .* - - runas: root - user2: - - password: password - - force: true - - tags: monitoring, user - - perms: - - /: - - .* - - .* - - .* - - runas: root - vhost: - - test_vhost - winner: pillar diff --git a/test/integration/default/files/_mapdata/centos-7.yaml b/test/integration/default/files/_mapdata/centos-7.yaml index 7686ae34..6bd1c386 100644 --- a/test/integration/default/files/_mapdata/centos-7.yaml +++ b/test/integration/default/files/_mapdata/centos-7.yaml @@ -1,59 +1,26 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml # yamllint disable rule:indentation rule:line-length -# CentOS Linux-7 +# Centos 7 --- values: added_in_defaults: defaults_value added_in_pillar: pillar_value arch: amd64 - binding: - my-new-binding: - - destination_type: queue - - destination: my-new-queue - - routing_key: a_routing_key_string - - user: saltstack - - passwd: password - - vhost: test_vhost - - arguments: - - x-message-ttl: 8640000 - cluster: - rabbit@locahost: - erlang_cookie: - name: /var/lib/rabbitmq/.erlang.cookie - value: shared-value-for-all-cluster-members - host: localhost # short hostname of node to join to, not fqdn - ram_node: None - runas: rabbitmq - user: rabbit # 'node' would make more sense here config: - context: - listeners.tcp.1: 0.0.0.0:5672 - name: /etc/rabbitmq/rabbitmq.conf + name: "/etc/rabbitmq/rabbitmq.conf" dir: - base: /var/lib/rabbitmq + base: "/var/lib/rabbitmq" cleanlist: - - /usr/local/bin/rabbitmq-env - - /usr/local/bin/rabbitmq-plugins - - /var/run/rabbitmq - data: /var/lib/rabbitmq - env: - context: - RABBITMQ_BASE: /var/lib/rabbitmq - RABBITMQ_LOG_BASE: /var/log/rabbitmq - rabbitmq_mnesia_base: /var/lib/rabbitmq + - "/usr/local/bin/rabbitmq-env" + - "/usr/local/bin/rabbitmq-plugins" + - "/var/run/rabbitmq" + config: "/etc/rabbitmq" + data: "/var/lib/rabbitmq" + service: "/usr/lib/systemd/system" + environ: locale_all: en_US.UTF-8 - name: /etc/rabbitmq/rabbitmq-env.conf - exchange: - my-new-exchange: - - user: saltstack - - passwd: password - - type: fanout - - durable: true - - internal: false - - auto_delete: false - - vhost: test_vhost - - arguments: - - alternate-**exchange: amq.fanout - - test-header: testing + values: {} map_jinja: sources: - Y:G@osarch @@ -63,42 +30,209 @@ values: - C@rabbitmq:lookup - C@rabbitmq - Y:G@id + nodes: + rabbit: + binding: + my-new-binding: + - destination_type: queue + - destination: my-new-queue + - routing_key: a_routing_key_string + - user: saltstack_mq + - passwd: password + - vhost: default_vhost + - arguments: + - x-message-ttl: 8640000 + clustered: false + config: + listeners.tcp.1: 0.0.0.0:5672 + distport: 25672 + erlang_cookie: shared-secret + exchange: + my-new-exchange: + - user: saltstack_mq + - passwd: password + - type: fanout + - durable: true + - internal: false + - auto_delete: false + - vhost: default_vhost + - arguments: + - alternate-**exchange: amq.fanout + - test-header: testing + host: localhost + nodeport: 5672 + plugins: + - rabbitmq_management + - rabbitmq_federation + - rabbitmq_federation_management + policy: + my-new-rabbitmq-policy: + - name: HA + - pattern: ".*" + - definition: '{"ha-mode": "all"}' + rabbitmq_policy: + - name: HA + - pattern: ".*" + - definition: '{"ha-mode": "all"}' + queue: + my-new-queue: + arguments: + - x-message-ttl: 8640000 + - x-expires: 8640000 + - x-dead-letter-exchange: my-new-exchange + auto_delete: false + durable: true + passwd: password + user: saltstack_mq + vhost: default_vhost + queues: {} + remove_guest_user: true + runas: rabbitmq + service: true + upstream: + my-new-upstream1: + - uri: amqp://saltstack_mq:password@localhost + - trust_user_id: true + - ack_mode: on-confirm + user: rabbit + users: + airflow: + force: true + password: airflow + perms: + default_vhost: + - ".*" + - ".*" + - ".*" + tags: + - management + - administrator + saltstack_mq: + force: false + password: password + perms: + default_vhost: + - ".*" + - ".*" + - ".*" + tags: + - administrator + - management + user1: + force: true + password: password + perms: + default_vhost: + - ".*" + - ".*" + - ".*" + tags: + - monitoring + - user + vhosts: + - default_vhost + rabbit2: + binding: + my-new-binding: + - destination_type: queue + - destination: my-new-queue + - routing_key: a_routing_key_string + - user: saltstack_mq + - passwd: password + - vhost: rabbit2_vhost + - arguments: + - x-message-ttl: 8640000 + clustered: false + config: + listeners.tcp.1: 0.0.0.0:5673 + distport: 25673 + erlang_cookie: shared-secret + exchange: + my-new-exchange: + - user: saltstack_mq + - passwd: password + - type: fanout + - durable: true + - internal: false + - auto_delete: false + - vhost: rabbit2_vhost + - arguments: + - alternate-**exchange: amq.fanout + - test-header: testing + host: localhost + nodeport: 5673 + plugins: [] + policy: + my-new-rabbitmq-policy: + - name: HA + - pattern: ".*" + - definition: '{"ha-mode": "all"}' + queue: + my-new-queue: + arguments: + - x-message-ttl: 8640000 + - x-expires: 8640000 + - x-dead-letter-exchange: my-new-exchange + auto_delete: false + durable: true + passwd: password + user: saltstack_mq + vhost: rabbit2_vhost + remove_guest_user: true + service: true + upstream: + my-new-upstream1: + - uri: amqp://saltstack_mq:password@localhost + - trust_user_id: true + - ack_mode: on-confirm + - max_hops: 1 + user: rabbit2 + users: + airflow: + force: true + password: airflow + perms: + rabbit2_vhost: + - ".*" + - ".*" + - ".*" + tags: + - management + - administrator + saltstack_mq: + force: false + password: password + perms: + rabbit2_vhost: + - ".*" + - ".*" + - ".*" + tags: + - administrator + user1: + force: true + password: password + perms: + rabbit2_vhost: + - ".*" + - ".*" + - ".*" + tags: + - monitoring + - user + vhosts: + - rabbit2_vhost pkg: - deps: [] + deps: + - socat name: rabbitmq-server use_upstream: repo - plugin: - rabbitmq_federation: - runas: root - rabbitmq_management: - runas: root - policy: - rabbitmq_policy: - - name: HA - - pattern: .* - - definition: '{"ha-mode": "all"}' - queue: - my-new-queue: - arguments: - - x-message-ttl: 8640000 - - x-expires: 8640000 - - x-dead-letter-exchange: my-new-exchange - auto_delete: false - durable: true - passwd: password - user: saltstack - vhost: test_vhost - remove_guest_user: true retry_option: attempts: 0 interval: 60 splay: 10 until: true rootgroup: root - service: - enabled: true - name: rabbitmq-server - running: true tofs: files_switch: - any/path/can/be/used/here @@ -110,44 +244,4 @@ values: source_files: rabbitmq-config-file-file-managed: - example.tmpl.jinja - upstream: - upstream_1: - - uri: amqp://saltstack:password@localhost - - trust_user_id: true - - ack_mode: on-confirm - - max_hops: 1 - user: - saltstack: - - password: password - - force: false - - tags: - - administrator - - perms: - - test_vhost: - - .* - - .* - - .* - - runas: root - user1: - - password: password - - force: true - - tags: monitoring, user - - perms: - - /: - - .* - - .* - - .* - - runas: root - user2: - - password: password - - force: true - - tags: monitoring, user - - perms: - - /: - - .* - - .* - - .* - - runas: root - vhost: - - test_vhost winner: pillar diff --git a/test/integration/default/files/_mapdata/centos-8.yaml b/test/integration/default/files/_mapdata/centos-8.yaml index f41ede1a..8aa0b13b 100644 --- a/test/integration/default/files/_mapdata/centos-8.yaml +++ b/test/integration/default/files/_mapdata/centos-8.yaml @@ -1,59 +1,26 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml # yamllint disable rule:indentation rule:line-length -# CentOS Linux-8 +# Centos 8 --- values: added_in_defaults: defaults_value added_in_pillar: pillar_value arch: amd64 - binding: - my-new-binding: - - destination_type: queue - - destination: my-new-queue - - routing_key: a_routing_key_string - - user: saltstack - - passwd: password - - vhost: test_vhost - - arguments: - - x-message-ttl: 8640000 - cluster: - rabbit@locahost: - erlang_cookie: - name: /var/lib/rabbitmq/.erlang.cookie - value: shared-value-for-all-cluster-members - host: localhost # short hostname of node to join to, not fqdn - ram_node: None - runas: rabbitmq - user: rabbit # 'node' would make more sense here config: - context: - listeners.tcp.1: 0.0.0.0:5672 - name: /etc/rabbitmq/rabbitmq.conf + name: "/etc/rabbitmq/rabbitmq.conf" dir: - base: /var/lib/rabbitmq + base: "/var/lib/rabbitmq" cleanlist: - - /usr/local/bin/rabbitmq-env - - /usr/local/bin/rabbitmq-plugins - - /var/run/rabbitmq - data: /var/lib/rabbitmq - env: - context: - RABBITMQ_BASE: /var/lib/rabbitmq - RABBITMQ_LOG_BASE: /var/log/rabbitmq - rabbitmq_mnesia_base: /var/lib/rabbitmq + - "/usr/local/bin/rabbitmq-env" + - "/usr/local/bin/rabbitmq-plugins" + - "/var/run/rabbitmq" + config: "/etc/rabbitmq" + data: "/var/lib/rabbitmq" + service: "/usr/lib/systemd/system" + environ: locale_all: en_US.UTF-8 - name: /etc/rabbitmq/rabbitmq-env.conf - exchange: - my-new-exchange: - - user: saltstack - - passwd: password - - type: fanout - - durable: true - - internal: false - - auto_delete: false - - vhost: test_vhost - - arguments: - - alternate-**exchange: amq.fanout - - test-header: testing + values: {} map_jinja: sources: - Y:G@osarch @@ -63,42 +30,209 @@ values: - C@rabbitmq:lookup - C@rabbitmq - Y:G@id + nodes: + rabbit: + binding: + my-new-binding: + - destination_type: queue + - destination: my-new-queue + - routing_key: a_routing_key_string + - user: saltstack_mq + - passwd: password + - vhost: default_vhost + - arguments: + - x-message-ttl: 8640000 + clustered: false + config: + listeners.tcp.1: 0.0.0.0:5672 + distport: 25672 + erlang_cookie: shared-secret + exchange: + my-new-exchange: + - user: saltstack_mq + - passwd: password + - type: fanout + - durable: true + - internal: false + - auto_delete: false + - vhost: default_vhost + - arguments: + - alternate-**exchange: amq.fanout + - test-header: testing + host: localhost + nodeport: 5672 + plugins: + - rabbitmq_management + - rabbitmq_federation + - rabbitmq_federation_management + policy: + my-new-rabbitmq-policy: + - name: HA + - pattern: ".*" + - definition: '{"ha-mode": "all"}' + rabbitmq_policy: + - name: HA + - pattern: ".*" + - definition: '{"ha-mode": "all"}' + queue: + my-new-queue: + arguments: + - x-message-ttl: 8640000 + - x-expires: 8640000 + - x-dead-letter-exchange: my-new-exchange + auto_delete: false + durable: true + passwd: password + user: saltstack_mq + vhost: default_vhost + queues: {} + remove_guest_user: true + runas: rabbitmq + service: true + upstream: + my-new-upstream1: + - uri: amqp://saltstack_mq:password@localhost + - trust_user_id: true + - ack_mode: on-confirm + user: rabbit + users: + airflow: + force: true + password: airflow + perms: + default_vhost: + - ".*" + - ".*" + - ".*" + tags: + - management + - administrator + saltstack_mq: + force: false + password: password + perms: + default_vhost: + - ".*" + - ".*" + - ".*" + tags: + - administrator + - management + user1: + force: true + password: password + perms: + default_vhost: + - ".*" + - ".*" + - ".*" + tags: + - monitoring + - user + vhosts: + - default_vhost + rabbit2: + binding: + my-new-binding: + - destination_type: queue + - destination: my-new-queue + - routing_key: a_routing_key_string + - user: saltstack_mq + - passwd: password + - vhost: rabbit2_vhost + - arguments: + - x-message-ttl: 8640000 + clustered: false + config: + listeners.tcp.1: 0.0.0.0:5673 + distport: 25673 + erlang_cookie: shared-secret + exchange: + my-new-exchange: + - user: saltstack_mq + - passwd: password + - type: fanout + - durable: true + - internal: false + - auto_delete: false + - vhost: rabbit2_vhost + - arguments: + - alternate-**exchange: amq.fanout + - test-header: testing + host: localhost + nodeport: 5673 + plugins: [] + policy: + my-new-rabbitmq-policy: + - name: HA + - pattern: ".*" + - definition: '{"ha-mode": "all"}' + queue: + my-new-queue: + arguments: + - x-message-ttl: 8640000 + - x-expires: 8640000 + - x-dead-letter-exchange: my-new-exchange + auto_delete: false + durable: true + passwd: password + user: saltstack_mq + vhost: rabbit2_vhost + remove_guest_user: true + service: true + upstream: + my-new-upstream1: + - uri: amqp://saltstack_mq:password@localhost + - trust_user_id: true + - ack_mode: on-confirm + - max_hops: 1 + user: rabbit2 + users: + airflow: + force: true + password: airflow + perms: + rabbit2_vhost: + - ".*" + - ".*" + - ".*" + tags: + - management + - administrator + saltstack_mq: + force: false + password: password + perms: + rabbit2_vhost: + - ".*" + - ".*" + - ".*" + tags: + - administrator + user1: + force: true + password: password + perms: + rabbit2_vhost: + - ".*" + - ".*" + - ".*" + tags: + - monitoring + - user + vhosts: + - rabbit2_vhost pkg: - deps: [] + deps: + - socat name: rabbitmq-server use_upstream: repo - plugin: - rabbitmq_federation: - runas: root - rabbitmq_management: - runas: root - policy: - rabbitmq_policy: - - name: HA - - pattern: .* - - definition: '{"ha-mode": "all"}' - queue: - my-new-queue: - arguments: - - x-message-ttl: 8640000 - - x-expires: 8640000 - - x-dead-letter-exchange: my-new-exchange - auto_delete: false - durable: true - passwd: password - user: saltstack - vhost: test_vhost - remove_guest_user: true retry_option: attempts: 0 interval: 60 splay: 10 until: true rootgroup: root - service: - enabled: true - name: rabbitmq-server - running: true tofs: files_switch: - any/path/can/be/used/here @@ -110,44 +244,4 @@ values: source_files: rabbitmq-config-file-file-managed: - example.tmpl.jinja - upstream: - upstream_1: - - uri: amqp://saltstack:password@localhost - - trust_user_id: true - - ack_mode: on-confirm - - max_hops: 1 - user: - saltstack: - - password: password - - force: false - - tags: - - administrator - - perms: - - test_vhost: - - .* - - .* - - .* - - runas: root - user1: - - password: password - - force: true - - tags: monitoring, user - - perms: - - /: - - .* - - .* - - .* - - runas: root - user2: - - password: password - - force: true - - tags: monitoring, user - - perms: - - /: - - .* - - .* - - .* - - runas: root - vhost: - - test_vhost winner: pillar diff --git a/test/integration/default/files/_mapdata/debian-10.yaml b/test/integration/default/files/_mapdata/debian-10.yaml index bfde01a6..20d48769 100644 --- a/test/integration/default/files/_mapdata/debian-10.yaml +++ b/test/integration/default/files/_mapdata/debian-10.yaml @@ -1,59 +1,24 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml # yamllint disable rule:indentation rule:line-length -# Debian-10 +# Debian 10 --- values: added_in_defaults: defaults_value added_in_pillar: pillar_value arch: amd64 - binding: - my-new-binding: - - destination_type: queue - - destination: my-new-queue - - routing_key: a_routing_key_string - - user: saltstack - - passwd: password - - vhost: test_vhost - - arguments: - - x-message-ttl: 8640000 - cluster: - rabbit@locahost: - erlang_cookie: - name: /var/lib/rabbitmq/.erlang.cookie - value: shared-value-for-all-cluster-members - host: localhost # short hostname of node to join to, not fqdn - ram_node: None - runas: rabbitmq - user: rabbit # 'node' would make more sense here - config: - context: - listeners.tcp.1: 0.0.0.0:5672 - name: /etc/rabbitmq/rabbitmq.conf dir: - base: /var/lib/rabbitmq + base: "/var/lib/rabbitmq" cleanlist: - - /usr/local/bin/rabbitmq-env - - /usr/local/bin/rabbitmq-plugins - - /var/run/rabbitmq - data: /var/lib/rabbitmq - env: - context: - RABBITMQ_BASE: /var/lib/rabbitmq - RABBITMQ_LOG_BASE: /var/log/rabbitmq - rabbitmq_mnesia_base: /var/lib/rabbitmq + - "/usr/local/bin/rabbitmq-env" + - "/usr/local/bin/rabbitmq-plugins" + - "/var/run/rabbitmq" + config: "/etc/rabbitmq" + data: "/var/lib/rabbitmq" + service: "/usr/lib/systemd/system" + environ: locale_all: en_US.UTF-8 - name: /etc/rabbitmq/rabbitmq-env.conf - exchange: - my-new-exchange: - - user: saltstack - - passwd: password - - type: fanout - - durable: true - - internal: false - - auto_delete: false - - vhost: test_vhost - - arguments: - - alternate-**exchange: amq.fanout - - test-header: testing + values: {} map_jinja: sources: - Y:G@osarch @@ -63,43 +28,209 @@ values: - C@rabbitmq:lookup - C@rabbitmq - Y:G@id + nodes: + rabbit: + binding: + my-new-binding: + - destination_type: queue + - destination: my-new-queue + - routing_key: a_routing_key_string + - user: saltstack_mq + - passwd: password + - vhost: default_vhost + - arguments: + - x-message-ttl: 8640000 + clustered: false + config: + listeners.tcp.1: 0.0.0.0:5672 + distport: 25672 + erlang_cookie: shared-secret + exchange: + my-new-exchange: + - user: saltstack_mq + - passwd: password + - type: fanout + - durable: true + - internal: false + - auto_delete: false + - vhost: default_vhost + - arguments: + - alternate-**exchange: amq.fanout + - test-header: testing + host: localhost + nodeport: 5672 + plugins: + - rabbitmq_management + - rabbitmq_federation + - rabbitmq_federation_management + policy: + my-new-rabbitmq-policy: + - name: HA + - pattern: ".*" + - definition: '{"ha-mode": "all"}' + rabbitmq_policy: + - name: HA + - pattern: ".*" + - definition: '{"ha-mode": "all"}' + queue: + my-new-queue: + arguments: + - x-message-ttl: 8640000 + - x-expires: 8640000 + - x-dead-letter-exchange: my-new-exchange + auto_delete: false + durable: true + passwd: password + user: saltstack_mq + vhost: default_vhost + queues: {} + remove_guest_user: true + runas: rabbitmq + service: true + upstream: + my-new-upstream1: + - uri: amqp://saltstack_mq:password@localhost + - trust_user_id: true + - ack_mode: on-confirm + user: rabbit + users: + airflow: + force: true + password: airflow + perms: + default_vhost: + - ".*" + - ".*" + - ".*" + tags: + - management + - administrator + saltstack_mq: + force: false + password: password + perms: + default_vhost: + - ".*" + - ".*" + - ".*" + tags: + - administrator + - management + user1: + force: true + password: password + perms: + default_vhost: + - ".*" + - ".*" + - ".*" + tags: + - monitoring + - user + vhosts: + - default_vhost + rabbit2: + binding: + my-new-binding: + - destination_type: queue + - destination: my-new-queue + - routing_key: a_routing_key_string + - user: saltstack_mq + - passwd: password + - vhost: rabbit2_vhost + - arguments: + - x-message-ttl: 8640000 + clustered: false + config: + listeners.tcp.1: 0.0.0.0:5673 + distport: 25673 + erlang_cookie: shared-secret + exchange: + my-new-exchange: + - user: saltstack_mq + - passwd: password + - type: fanout + - durable: true + - internal: false + - auto_delete: false + - vhost: rabbit2_vhost + - arguments: + - alternate-**exchange: amq.fanout + - test-header: testing + host: localhost + nodeport: 5673 + plugins: [] + policy: + my-new-rabbitmq-policy: + - name: HA + - pattern: ".*" + - definition: '{"ha-mode": "all"}' + queue: + my-new-queue: + arguments: + - x-message-ttl: 8640000 + - x-expires: 8640000 + - x-dead-letter-exchange: my-new-exchange + auto_delete: false + durable: true + passwd: password + user: saltstack_mq + vhost: rabbit2_vhost + remove_guest_user: true + service: true + upstream: + my-new-upstream1: + - uri: amqp://saltstack_mq:password@localhost + - trust_user_id: true + - ack_mode: on-confirm + - max_hops: 1 + user: rabbit2 + users: + airflow: + force: true + password: airflow + perms: + rabbit2_vhost: + - ".*" + - ".*" + - ".*" + tags: + - management + - administrator + saltstack_mq: + force: false + password: password + perms: + rabbit2_vhost: + - ".*" + - ".*" + - ".*" + tags: + - administrator + user1: + force: true + password: password + perms: + rabbit2_vhost: + - ".*" + - ".*" + - ".*" + tags: + - monitoring + - user + vhosts: + - rabbit2_vhost pkg: deps: - - libtinfo5 + - libtinfo5 name: rabbitmq-server use_upstream: repo - plugin: - rabbitmq_federation: - runas: root - rabbitmq_management: - runas: root - policy: - rabbitmq_policy: - - name: HA - - pattern: .* - - definition: '{"ha-mode": "all"}' - queue: - my-new-queue: - arguments: - - x-message-ttl: 8640000 - - x-expires: 8640000 - - x-dead-letter-exchange: my-new-exchange - auto_delete: false - durable: true - passwd: password - user: saltstack - vhost: test_vhost - remove_guest_user: true retry_option: attempts: 0 interval: 60 splay: 10 until: true rootgroup: root - service: - enabled: true - name: rabbitmq-server - running: true tofs: files_switch: - any/path/can/be/used/here @@ -111,44 +242,4 @@ values: source_files: rabbitmq-config-file-file-managed: - example.tmpl.jinja - upstream: - upstream_1: - - uri: amqp://saltstack:password@localhost - - trust_user_id: true - - ack_mode: on-confirm - - max_hops: 1 - user: - saltstack: - - password: password - - force: false - - tags: - - administrator - - perms: - - test_vhost: - - .* - - .* - - .* - - runas: root - user1: - - password: password - - force: true - - tags: monitoring, user - - perms: - - /: - - .* - - .* - - .* - - runas: root - user2: - - password: password - - force: true - - tags: monitoring, user - - perms: - - /: - - .* - - .* - - .* - - runas: root - vhost: - - test_vhost winner: pillar diff --git a/test/integration/default/files/_mapdata/debian-11.yaml b/test/integration/default/files/_mapdata/debian-11.yaml new file mode 100644 index 00000000..71b1ad9d --- /dev/null +++ b/test/integration/default/files/_mapdata/debian-11.yaml @@ -0,0 +1,245 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +# yamllint disable rule:indentation rule:line-length +# Debian 11 +--- +values: + added_in_defaults: defaults_value + added_in_pillar: pillar_value + arch: amd64 + dir: + base: "/var/lib/rabbitmq" + cleanlist: + - "/usr/local/bin/rabbitmq-env" + - "/usr/local/bin/rabbitmq-plugins" + - "/var/run/rabbitmq" + config: "/etc/rabbitmq" + data: "/var/lib/rabbitmq" + service: "/usr/lib/systemd/system" + environ: + locale_all: en_US.UTF-8 + values: {} + map_jinja: + sources: + - Y:G@osarch + - Y:G@os_family + - Y:G@os + - Y:G@osfinger + - C@rabbitmq:lookup + - C@rabbitmq + - Y:G@id + nodes: + rabbit: + binding: + my-new-binding: + - destination_type: queue + - destination: my-new-queue + - routing_key: a_routing_key_string + - user: saltstack_mq + - passwd: password + - vhost: default_vhost + - arguments: + - x-message-ttl: 8640000 + clustered: false + config: + listeners.tcp.1: 0.0.0.0:5672 + distport: 25672 + erlang_cookie: shared-secret + exchange: + my-new-exchange: + - user: saltstack_mq + - passwd: password + - type: fanout + - durable: true + - internal: false + - auto_delete: false + - vhost: default_vhost + - arguments: + - alternate-**exchange: amq.fanout + - test-header: testing + host: localhost + nodeport: 5672 + plugins: + - rabbitmq_management + - rabbitmq_federation + - rabbitmq_federation_management + policy: + my-new-rabbitmq-policy: + - name: HA + - pattern: ".*" + - definition: '{"ha-mode": "all"}' + rabbitmq_policy: + - name: HA + - pattern: ".*" + - definition: '{"ha-mode": "all"}' + queue: + my-new-queue: + arguments: + - x-message-ttl: 8640000 + - x-expires: 8640000 + - x-dead-letter-exchange: my-new-exchange + auto_delete: false + durable: true + passwd: password + user: saltstack_mq + vhost: default_vhost + queues: {} + remove_guest_user: true + runas: rabbitmq + service: true + upstream: + my-new-upstream1: + - uri: amqp://saltstack_mq:password@localhost + - trust_user_id: true + - ack_mode: on-confirm + user: rabbit + users: + airflow: + force: true + password: airflow + perms: + default_vhost: + - ".*" + - ".*" + - ".*" + tags: + - management + - administrator + saltstack_mq: + force: false + password: password + perms: + default_vhost: + - ".*" + - ".*" + - ".*" + tags: + - administrator + - management + user1: + force: true + password: password + perms: + default_vhost: + - ".*" + - ".*" + - ".*" + tags: + - monitoring + - user + vhosts: + - default_vhost + rabbit2: + binding: + my-new-binding: + - destination_type: queue + - destination: my-new-queue + - routing_key: a_routing_key_string + - user: saltstack_mq + - passwd: password + - vhost: rabbit2_vhost + - arguments: + - x-message-ttl: 8640000 + clustered: false + config: + listeners.tcp.1: 0.0.0.0:5673 + distport: 25673 + erlang_cookie: shared-secret + exchange: + my-new-exchange: + - user: saltstack_mq + - passwd: password + - type: fanout + - durable: true + - internal: false + - auto_delete: false + - vhost: rabbit2_vhost + - arguments: + - alternate-**exchange: amq.fanout + - test-header: testing + host: localhost + nodeport: 5673 + plugins: [] + policy: + my-new-rabbitmq-policy: + - name: HA + - pattern: ".*" + - definition: '{"ha-mode": "all"}' + queue: + my-new-queue: + arguments: + - x-message-ttl: 8640000 + - x-expires: 8640000 + - x-dead-letter-exchange: my-new-exchange + auto_delete: false + durable: true + passwd: password + user: saltstack_mq + vhost: rabbit2_vhost + remove_guest_user: true + service: true + upstream: + my-new-upstream1: + - uri: amqp://saltstack_mq:password@localhost + - trust_user_id: true + - ack_mode: on-confirm + - max_hops: 1 + user: rabbit2 + users: + airflow: + force: true + password: airflow + perms: + rabbit2_vhost: + - ".*" + - ".*" + - ".*" + tags: + - management + - administrator + saltstack_mq: + force: false + password: password + perms: + rabbit2_vhost: + - ".*" + - ".*" + - ".*" + tags: + - administrator + user1: + force: true + password: password + perms: + rabbit2_vhost: + - ".*" + - ".*" + - ".*" + tags: + - monitoring + - user + vhosts: + - rabbit2_vhost + pkg: + deps: + - libtinfo5 + name: rabbitmq-server + use_upstream: repo + retry_option: + attempts: 0 + interval: 60 + splay: 10 + until: true + rootgroup: root + tofs: + files_switch: + - any/path/can/be/used/here + - id + - roles + - osfinger + - os + - os_family + source_files: + rabbitmq-config-file-file-managed: + - example.tmpl.jinja + winner: pillar diff --git a/test/integration/default/files/_mapdata/debian-9.yaml b/test/integration/default/files/_mapdata/debian-9.yaml index ad0369b3..8d22a75a 100644 --- a/test/integration/default/files/_mapdata/debian-9.yaml +++ b/test/integration/default/files/_mapdata/debian-9.yaml @@ -1,59 +1,24 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml # yamllint disable rule:indentation rule:line-length -# Debian-9 +# Debian 9 --- values: added_in_defaults: defaults_value added_in_pillar: pillar_value arch: amd64 - binding: - my-new-binding: - - destination_type: queue - - destination: my-new-queue - - routing_key: a_routing_key_string - - user: saltstack - - passwd: password - - vhost: test_vhost - - arguments: - - x-message-ttl: 8640000 - cluster: - rabbit@locahost: - erlang_cookie: - name: /var/lib/rabbitmq/.erlang.cookie - value: shared-value-for-all-cluster-members - host: localhost # short hostname of node to join to, not fqdn - ram_node: None - runas: rabbitmq - user: rabbit # 'node' would make more sense here - config: - context: - listeners.tcp.1: 0.0.0.0:5672 - name: /etc/rabbitmq/rabbitmq.conf dir: - base: /var/lib/rabbitmq + base: "/var/lib/rabbitmq" cleanlist: - - /usr/local/bin/rabbitmq-env - - /usr/local/bin/rabbitmq-plugins - - /var/run/rabbitmq - data: /var/lib/rabbitmq - env: - context: - RABBITMQ_BASE: /var/lib/rabbitmq - RABBITMQ_LOG_BASE: /var/log/rabbitmq - rabbitmq_mnesia_base: /var/lib/rabbitmq + - "/usr/local/bin/rabbitmq-env" + - "/usr/local/bin/rabbitmq-plugins" + - "/var/run/rabbitmq" + config: "/etc/rabbitmq" + data: "/var/lib/rabbitmq" + service: "/usr/lib/systemd/system" + environ: locale_all: en_US.UTF-8 - name: /etc/rabbitmq/rabbitmq-env.conf - exchange: - my-new-exchange: - - user: saltstack - - passwd: password - - type: fanout - - durable: true - - internal: false - - auto_delete: false - - vhost: test_vhost - - arguments: - - alternate-**exchange: amq.fanout - - test-header: testing + values: {} map_jinja: sources: - Y:G@osarch @@ -63,43 +28,209 @@ values: - C@rabbitmq:lookup - C@rabbitmq - Y:G@id + nodes: + rabbit: + binding: + my-new-binding: + - destination_type: queue + - destination: my-new-queue + - routing_key: a_routing_key_string + - user: saltstack_mq + - passwd: password + - vhost: default_vhost + - arguments: + - x-message-ttl: 8640000 + clustered: false + config: + listeners.tcp.1: 0.0.0.0:5672 + distport: 25672 + erlang_cookie: shared-secret + exchange: + my-new-exchange: + - user: saltstack_mq + - passwd: password + - type: fanout + - durable: true + - internal: false + - auto_delete: false + - vhost: default_vhost + - arguments: + - alternate-**exchange: amq.fanout + - test-header: testing + host: localhost + nodeport: 5672 + plugins: + - rabbitmq_management + - rabbitmq_federation + - rabbitmq_federation_management + policy: + my-new-rabbitmq-policy: + - name: HA + - pattern: ".*" + - definition: '{"ha-mode": "all"}' + rabbitmq_policy: + - name: HA + - pattern: ".*" + - definition: '{"ha-mode": "all"}' + queue: + my-new-queue: + arguments: + - x-message-ttl: 8640000 + - x-expires: 8640000 + - x-dead-letter-exchange: my-new-exchange + auto_delete: false + durable: true + passwd: password + user: saltstack_mq + vhost: default_vhost + queues: {} + remove_guest_user: true + runas: rabbitmq + service: true + upstream: + my-new-upstream1: + - uri: amqp://saltstack_mq:password@localhost + - trust_user_id: true + - ack_mode: on-confirm + user: rabbit + users: + airflow: + force: true + password: airflow + perms: + default_vhost: + - ".*" + - ".*" + - ".*" + tags: + - management + - administrator + saltstack_mq: + force: false + password: password + perms: + default_vhost: + - ".*" + - ".*" + - ".*" + tags: + - administrator + - management + user1: + force: true + password: password + perms: + default_vhost: + - ".*" + - ".*" + - ".*" + tags: + - monitoring + - user + vhosts: + - default_vhost + rabbit2: + binding: + my-new-binding: + - destination_type: queue + - destination: my-new-queue + - routing_key: a_routing_key_string + - user: saltstack_mq + - passwd: password + - vhost: rabbit2_vhost + - arguments: + - x-message-ttl: 8640000 + clustered: false + config: + listeners.tcp.1: 0.0.0.0:5673 + distport: 25673 + erlang_cookie: shared-secret + exchange: + my-new-exchange: + - user: saltstack_mq + - passwd: password + - type: fanout + - durable: true + - internal: false + - auto_delete: false + - vhost: rabbit2_vhost + - arguments: + - alternate-**exchange: amq.fanout + - test-header: testing + host: localhost + nodeport: 5673 + plugins: [] + policy: + my-new-rabbitmq-policy: + - name: HA + - pattern: ".*" + - definition: '{"ha-mode": "all"}' + queue: + my-new-queue: + arguments: + - x-message-ttl: 8640000 + - x-expires: 8640000 + - x-dead-letter-exchange: my-new-exchange + auto_delete: false + durable: true + passwd: password + user: saltstack_mq + vhost: rabbit2_vhost + remove_guest_user: true + service: true + upstream: + my-new-upstream1: + - uri: amqp://saltstack_mq:password@localhost + - trust_user_id: true + - ack_mode: on-confirm + - max_hops: 1 + user: rabbit2 + users: + airflow: + force: true + password: airflow + perms: + rabbit2_vhost: + - ".*" + - ".*" + - ".*" + tags: + - management + - administrator + saltstack_mq: + force: false + password: password + perms: + rabbit2_vhost: + - ".*" + - ".*" + - ".*" + tags: + - administrator + user1: + force: true + password: password + perms: + rabbit2_vhost: + - ".*" + - ".*" + - ".*" + tags: + - monitoring + - user + vhosts: + - rabbit2_vhost pkg: deps: - - libtinfo5 + - libtinfo5 name: rabbitmq-server use_upstream: repo - plugin: - rabbitmq_federation: - runas: root - rabbitmq_management: - runas: root - policy: - rabbitmq_policy: - - name: HA - - pattern: .* - - definition: '{"ha-mode": "all"}' - queue: - my-new-queue: - arguments: - - x-message-ttl: 8640000 - - x-expires: 8640000 - - x-dead-letter-exchange: my-new-exchange - auto_delete: false - durable: true - passwd: password - user: saltstack - vhost: test_vhost - remove_guest_user: true retry_option: attempts: 0 interval: 60 splay: 10 until: true rootgroup: root - service: - enabled: true - name: rabbitmq-server - running: true tofs: files_switch: - any/path/can/be/used/here @@ -111,44 +242,4 @@ values: source_files: rabbitmq-config-file-file-managed: - example.tmpl.jinja - upstream: - upstream_1: - - uri: amqp://saltstack:password@localhost - - trust_user_id: true - - ack_mode: on-confirm - - max_hops: 1 - user: - saltstack: - - password: password - - force: false - - tags: - - administrator - - perms: - - test_vhost: - - .* - - .* - - .* - - runas: root - user1: - - password: password - - force: true - - tags: monitoring, user - - perms: - - /: - - .* - - .* - - .* - - runas: root - user2: - - password: password - - force: true - - tags: monitoring, user - - perms: - - /: - - .* - - .* - - .* - - runas: root - vhost: - - test_vhost winner: pillar diff --git a/test/integration/default/files/_mapdata/fedora-32.yaml b/test/integration/default/files/_mapdata/fedora-32.yaml index 8488b3f2..47f57b07 100644 --- a/test/integration/default/files/_mapdata/fedora-32.yaml +++ b/test/integration/default/files/_mapdata/fedora-32.yaml @@ -1,59 +1,26 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml # yamllint disable rule:indentation rule:line-length -# Fedora-32 +# Fedora 32 --- values: added_in_defaults: defaults_value added_in_pillar: pillar_value arch: amd64 - binding: - my-new-binding: - - destination_type: queue - - destination: my-new-queue - - routing_key: a_routing_key_string - - user: saltstack - - passwd: password - - vhost: test_vhost - - arguments: - - x-message-ttl: 8640000 - cluster: - rabbit@locahost: - erlang_cookie: - name: /var/lib/rabbitmq/.erlang.cookie - value: shared-value-for-all-cluster-members - host: localhost # short hostname of node to join to, not fqdn - ram_node: None - runas: rabbitmq - user: rabbit # 'node' would make more sense here config: - context: - listeners.tcp.1: 0.0.0.0:5672 - name: /etc/rabbitmq/rabbitmq.conf + name: "/etc/rabbitmq/rabbitmq.conf" dir: - base: /var/lib/rabbitmq + base: "/var/lib/rabbitmq" cleanlist: - - /usr/local/bin/rabbitmq-env - - /usr/local/bin/rabbitmq-plugins - - /var/run/rabbitmq - data: /var/lib/rabbitmq - env: - context: - RABBITMQ_BASE: /var/lib/rabbitmq - RABBITMQ_LOG_BASE: /var/log/rabbitmq - rabbitmq_mnesia_base: /var/lib/rabbitmq + - "/usr/local/bin/rabbitmq-env" + - "/usr/local/bin/rabbitmq-plugins" + - "/var/run/rabbitmq" + config: "/etc/rabbitmq" + data: "/var/lib/rabbitmq" + service: "/usr/lib/systemd/system" + environ: locale_all: en_US.UTF-8 - name: /etc/rabbitmq/rabbitmq-env.conf - exchange: - my-new-exchange: - - user: saltstack - - passwd: password - - type: fanout - - durable: true - - internal: false - - auto_delete: false - - vhost: test_vhost - - arguments: - - alternate-**exchange: amq.fanout - - test-header: testing + values: {} map_jinja: sources: - Y:G@osarch @@ -63,42 +30,209 @@ values: - C@rabbitmq:lookup - C@rabbitmq - Y:G@id + nodes: + rabbit: + binding: + my-new-binding: + - destination_type: queue + - destination: my-new-queue + - routing_key: a_routing_key_string + - user: saltstack_mq + - passwd: password + - vhost: default_vhost + - arguments: + - x-message-ttl: 8640000 + clustered: false + config: + listeners.tcp.1: 0.0.0.0:5672 + distport: 25672 + erlang_cookie: shared-secret + exchange: + my-new-exchange: + - user: saltstack_mq + - passwd: password + - type: fanout + - durable: true + - internal: false + - auto_delete: false + - vhost: default_vhost + - arguments: + - alternate-**exchange: amq.fanout + - test-header: testing + host: localhost + nodeport: 5672 + plugins: + - rabbitmq_management + - rabbitmq_federation + - rabbitmq_federation_management + policy: + my-new-rabbitmq-policy: + - name: HA + - pattern: ".*" + - definition: '{"ha-mode": "all"}' + rabbitmq_policy: + - name: HA + - pattern: ".*" + - definition: '{"ha-mode": "all"}' + queue: + my-new-queue: + arguments: + - x-message-ttl: 8640000 + - x-expires: 8640000 + - x-dead-letter-exchange: my-new-exchange + auto_delete: false + durable: true + passwd: password + user: saltstack_mq + vhost: default_vhost + queues: {} + remove_guest_user: true + runas: rabbitmq + service: true + upstream: + my-new-upstream1: + - uri: amqp://saltstack_mq:password@localhost + - trust_user_id: true + - ack_mode: on-confirm + user: rabbit + users: + airflow: + force: true + password: airflow + perms: + default_vhost: + - ".*" + - ".*" + - ".*" + tags: + - management + - administrator + saltstack_mq: + force: false + password: password + perms: + default_vhost: + - ".*" + - ".*" + - ".*" + tags: + - administrator + - management + user1: + force: true + password: password + perms: + default_vhost: + - ".*" + - ".*" + - ".*" + tags: + - monitoring + - user + vhosts: + - default_vhost + rabbit2: + binding: + my-new-binding: + - destination_type: queue + - destination: my-new-queue + - routing_key: a_routing_key_string + - user: saltstack_mq + - passwd: password + - vhost: rabbit2_vhost + - arguments: + - x-message-ttl: 8640000 + clustered: false + config: + listeners.tcp.1: 0.0.0.0:5673 + distport: 25673 + erlang_cookie: shared-secret + exchange: + my-new-exchange: + - user: saltstack_mq + - passwd: password + - type: fanout + - durable: true + - internal: false + - auto_delete: false + - vhost: rabbit2_vhost + - arguments: + - alternate-**exchange: amq.fanout + - test-header: testing + host: localhost + nodeport: 5673 + plugins: [] + policy: + my-new-rabbitmq-policy: + - name: HA + - pattern: ".*" + - definition: '{"ha-mode": "all"}' + queue: + my-new-queue: + arguments: + - x-message-ttl: 8640000 + - x-expires: 8640000 + - x-dead-letter-exchange: my-new-exchange + auto_delete: false + durable: true + passwd: password + user: saltstack_mq + vhost: rabbit2_vhost + remove_guest_user: true + service: true + upstream: + my-new-upstream1: + - uri: amqp://saltstack_mq:password@localhost + - trust_user_id: true + - ack_mode: on-confirm + - max_hops: 1 + user: rabbit2 + users: + airflow: + force: true + password: airflow + perms: + rabbit2_vhost: + - ".*" + - ".*" + - ".*" + tags: + - management + - administrator + saltstack_mq: + force: false + password: password + perms: + rabbit2_vhost: + - ".*" + - ".*" + - ".*" + tags: + - administrator + user1: + force: true + password: password + perms: + rabbit2_vhost: + - ".*" + - ".*" + - ".*" + tags: + - monitoring + - user + vhosts: + - rabbit2_vhost pkg: - deps: [] + deps: + - socat name: rabbitmq-server use_upstream: repo - plugin: - rabbitmq_federation: - runas: root - rabbitmq_management: - runas: root - policy: - rabbitmq_policy: - - name: HA - - pattern: .* - - definition: '{"ha-mode": "all"}' - queue: - my-new-queue: - arguments: - - x-message-ttl: 8640000 - - x-expires: 8640000 - - x-dead-letter-exchange: my-new-exchange - auto_delete: false - durable: true - passwd: password - user: saltstack - vhost: test_vhost - remove_guest_user: true retry_option: attempts: 0 interval: 60 splay: 10 until: true rootgroup: root - service: - enabled: true - name: rabbitmq-server - running: true tofs: files_switch: - any/path/can/be/used/here @@ -110,44 +244,4 @@ values: source_files: rabbitmq-config-file-file-managed: - example.tmpl.jinja - upstream: - upstream_1: - - uri: amqp://saltstack:password@localhost - - trust_user_id: true - - ack_mode: on-confirm - - max_hops: 1 - user: - saltstack: - - password: password - - force: false - - tags: - - administrator - - perms: - - test_vhost: - - .* - - .* - - .* - - runas: root - user1: - - password: password - - force: true - - tags: monitoring, user - - perms: - - /: - - .* - - .* - - .* - - runas: root - user2: - - password: password - - force: true - - tags: monitoring, user - - perms: - - /: - - .* - - .* - - .* - - runas: root - vhost: - - test_vhost winner: pillar diff --git a/test/integration/default/files/_mapdata/fedora-33.yaml b/test/integration/default/files/_mapdata/fedora-33.yaml index 60a73707..63331180 100644 --- a/test/integration/default/files/_mapdata/fedora-33.yaml +++ b/test/integration/default/files/_mapdata/fedora-33.yaml @@ -1,59 +1,26 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml # yamllint disable rule:indentation rule:line-length -# Fedora-33 +# Fedora 33 --- values: added_in_defaults: defaults_value added_in_pillar: pillar_value arch: amd64 - binding: - my-new-binding: - - destination_type: queue - - destination: my-new-queue - - routing_key: a_routing_key_string - - user: saltstack - - passwd: password - - vhost: test_vhost - - arguments: - - x-message-ttl: 8640000 - cluster: - rabbit@locahost: - erlang_cookie: - name: /var/lib/rabbitmq/.erlang.cookie - value: shared-value-for-all-cluster-members - host: localhost # short hostname of node to join to, not fqdn - ram_node: None - runas: rabbitmq - user: rabbit # 'node' would make more sense here config: - context: - listeners.tcp.1: 0.0.0.0:5672 - name: /etc/rabbitmq/rabbitmq.conf + name: "/etc/rabbitmq/rabbitmq.conf" dir: - base: /var/lib/rabbitmq + base: "/var/lib/rabbitmq" cleanlist: - - /usr/local/bin/rabbitmq-env - - /usr/local/bin/rabbitmq-plugins - - /var/run/rabbitmq - data: /var/lib/rabbitmq - env: - context: - RABBITMQ_BASE: /var/lib/rabbitmq - RABBITMQ_LOG_BASE: /var/log/rabbitmq - rabbitmq_mnesia_base: /var/lib/rabbitmq + - "/usr/local/bin/rabbitmq-env" + - "/usr/local/bin/rabbitmq-plugins" + - "/var/run/rabbitmq" + config: "/etc/rabbitmq" + data: "/var/lib/rabbitmq" + service: "/usr/lib/systemd/system" + environ: locale_all: en_US.UTF-8 - name: /etc/rabbitmq/rabbitmq-env.conf - exchange: - my-new-exchange: - - user: saltstack - - passwd: password - - type: fanout - - durable: true - - internal: false - - auto_delete: false - - vhost: test_vhost - - arguments: - - alternate-**exchange: amq.fanout - - test-header: testing + values: {} map_jinja: sources: - Y:G@osarch @@ -63,42 +30,209 @@ values: - C@rabbitmq:lookup - C@rabbitmq - Y:G@id + nodes: + rabbit: + binding: + my-new-binding: + - destination_type: queue + - destination: my-new-queue + - routing_key: a_routing_key_string + - user: saltstack_mq + - passwd: password + - vhost: default_vhost + - arguments: + - x-message-ttl: 8640000 + clustered: false + config: + listeners.tcp.1: 0.0.0.0:5672 + distport: 25672 + erlang_cookie: shared-secret + exchange: + my-new-exchange: + - user: saltstack_mq + - passwd: password + - type: fanout + - durable: true + - internal: false + - auto_delete: false + - vhost: default_vhost + - arguments: + - alternate-**exchange: amq.fanout + - test-header: testing + host: localhost + nodeport: 5672 + plugins: + - rabbitmq_management + - rabbitmq_federation + - rabbitmq_federation_management + policy: + my-new-rabbitmq-policy: + - name: HA + - pattern: ".*" + - definition: '{"ha-mode": "all"}' + rabbitmq_policy: + - name: HA + - pattern: ".*" + - definition: '{"ha-mode": "all"}' + queue: + my-new-queue: + arguments: + - x-message-ttl: 8640000 + - x-expires: 8640000 + - x-dead-letter-exchange: my-new-exchange + auto_delete: false + durable: true + passwd: password + user: saltstack_mq + vhost: default_vhost + queues: {} + remove_guest_user: true + runas: rabbitmq + service: true + upstream: + my-new-upstream1: + - uri: amqp://saltstack_mq:password@localhost + - trust_user_id: true + - ack_mode: on-confirm + user: rabbit + users: + airflow: + force: true + password: airflow + perms: + default_vhost: + - ".*" + - ".*" + - ".*" + tags: + - management + - administrator + saltstack_mq: + force: false + password: password + perms: + default_vhost: + - ".*" + - ".*" + - ".*" + tags: + - administrator + - management + user1: + force: true + password: password + perms: + default_vhost: + - ".*" + - ".*" + - ".*" + tags: + - monitoring + - user + vhosts: + - default_vhost + rabbit2: + binding: + my-new-binding: + - destination_type: queue + - destination: my-new-queue + - routing_key: a_routing_key_string + - user: saltstack_mq + - passwd: password + - vhost: rabbit2_vhost + - arguments: + - x-message-ttl: 8640000 + clustered: false + config: + listeners.tcp.1: 0.0.0.0:5673 + distport: 25673 + erlang_cookie: shared-secret + exchange: + my-new-exchange: + - user: saltstack_mq + - passwd: password + - type: fanout + - durable: true + - internal: false + - auto_delete: false + - vhost: rabbit2_vhost + - arguments: + - alternate-**exchange: amq.fanout + - test-header: testing + host: localhost + nodeport: 5673 + plugins: [] + policy: + my-new-rabbitmq-policy: + - name: HA + - pattern: ".*" + - definition: '{"ha-mode": "all"}' + queue: + my-new-queue: + arguments: + - x-message-ttl: 8640000 + - x-expires: 8640000 + - x-dead-letter-exchange: my-new-exchange + auto_delete: false + durable: true + passwd: password + user: saltstack_mq + vhost: rabbit2_vhost + remove_guest_user: true + service: true + upstream: + my-new-upstream1: + - uri: amqp://saltstack_mq:password@localhost + - trust_user_id: true + - ack_mode: on-confirm + - max_hops: 1 + user: rabbit2 + users: + airflow: + force: true + password: airflow + perms: + rabbit2_vhost: + - ".*" + - ".*" + - ".*" + tags: + - management + - administrator + saltstack_mq: + force: false + password: password + perms: + rabbit2_vhost: + - ".*" + - ".*" + - ".*" + tags: + - administrator + user1: + force: true + password: password + perms: + rabbit2_vhost: + - ".*" + - ".*" + - ".*" + tags: + - monitoring + - user + vhosts: + - rabbit2_vhost pkg: - deps: [] + deps: + - socat name: rabbitmq-server use_upstream: repo - plugin: - rabbitmq_federation: - runas: root - rabbitmq_management: - runas: root - policy: - rabbitmq_policy: - - name: HA - - pattern: .* - - definition: '{"ha-mode": "all"}' - queue: - my-new-queue: - arguments: - - x-message-ttl: 8640000 - - x-expires: 8640000 - - x-dead-letter-exchange: my-new-exchange - auto_delete: false - durable: true - passwd: password - user: saltstack - vhost: test_vhost - remove_guest_user: true retry_option: attempts: 0 interval: 60 splay: 10 until: true rootgroup: root - service: - enabled: true - name: rabbitmq-server - running: true tofs: files_switch: - any/path/can/be/used/here @@ -110,44 +244,4 @@ values: source_files: rabbitmq-config-file-file-managed: - example.tmpl.jinja - upstream: - upstream_1: - - uri: amqp://saltstack:password@localhost - - trust_user_id: true - - ack_mode: on-confirm - - max_hops: 1 - user: - saltstack: - - password: password - - force: false - - tags: - - administrator - - perms: - - test_vhost: - - .* - - .* - - .* - - runas: root - user1: - - password: password - - force: true - - tags: monitoring, user - - perms: - - /: - - .* - - .* - - .* - - runas: root - user2: - - password: password - - force: true - - tags: monitoring, user - - perms: - - /: - - .* - - .* - - .* - - runas: root - vhost: - - test_vhost winner: pillar diff --git a/test/integration/default/files/_mapdata/fedora-34.yaml b/test/integration/default/files/_mapdata/fedora-34.yaml index 12564313..c0e9221d 100644 --- a/test/integration/default/files/_mapdata/fedora-34.yaml +++ b/test/integration/default/files/_mapdata/fedora-34.yaml @@ -1,59 +1,26 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml # yamllint disable rule:indentation rule:line-length -# Fedora-34 +# Fedora 34 --- values: added_in_defaults: defaults_value added_in_pillar: pillar_value arch: amd64 - binding: - my-new-binding: - - destination_type: queue - - destination: my-new-queue - - routing_key: a_routing_key_string - - user: saltstack - - passwd: password - - vhost: test_vhost - - arguments: - - x-message-ttl: 8640000 - cluster: - rabbit@locahost: - erlang_cookie: - name: /var/lib/rabbitmq/.erlang.cookie - value: shared-value-for-all-cluster-members - host: localhost # short hostname of node to join to, not fqdn - ram_node: None - runas: rabbitmq - user: rabbit # 'node' would make more sense here config: - context: - listeners.tcp.1: 0.0.0.0:5672 - name: /etc/rabbitmq/rabbitmq.conf + name: "/etc/rabbitmq/rabbitmq.conf" dir: - base: /var/lib/rabbitmq + base: "/var/lib/rabbitmq" cleanlist: - - /usr/local/bin/rabbitmq-env - - /usr/local/bin/rabbitmq-plugins - - /var/run/rabbitmq - data: /var/lib/rabbitmq - env: - context: - RABBITMQ_BASE: /var/lib/rabbitmq - RABBITMQ_LOG_BASE: /var/log/rabbitmq - rabbitmq_mnesia_base: /var/lib/rabbitmq + - "/usr/local/bin/rabbitmq-env" + - "/usr/local/bin/rabbitmq-plugins" + - "/var/run/rabbitmq" + config: "/etc/rabbitmq" + data: "/var/lib/rabbitmq" + service: "/usr/lib/systemd/system" + environ: locale_all: en_US.UTF-8 - name: /etc/rabbitmq/rabbitmq-env.conf - exchange: - my-new-exchange: - - user: saltstack - - passwd: password - - type: fanout - - durable: true - - internal: false - - auto_delete: false - - vhost: test_vhost - - arguments: - - alternate-**exchange: amq.fanout - - test-header: testing + values: {} map_jinja: sources: - Y:G@osarch @@ -63,42 +30,209 @@ values: - C@rabbitmq:lookup - C@rabbitmq - Y:G@id + nodes: + rabbit: + binding: + my-new-binding: + - destination_type: queue + - destination: my-new-queue + - routing_key: a_routing_key_string + - user: saltstack_mq + - passwd: password + - vhost: default_vhost + - arguments: + - x-message-ttl: 8640000 + clustered: false + config: + listeners.tcp.1: 0.0.0.0:5672 + distport: 25672 + erlang_cookie: shared-secret + exchange: + my-new-exchange: + - user: saltstack_mq + - passwd: password + - type: fanout + - durable: true + - internal: false + - auto_delete: false + - vhost: default_vhost + - arguments: + - alternate-**exchange: amq.fanout + - test-header: testing + host: localhost + nodeport: 5672 + plugins: + - rabbitmq_management + - rabbitmq_federation + - rabbitmq_federation_management + policy: + my-new-rabbitmq-policy: + - name: HA + - pattern: ".*" + - definition: '{"ha-mode": "all"}' + rabbitmq_policy: + - name: HA + - pattern: ".*" + - definition: '{"ha-mode": "all"}' + queue: + my-new-queue: + arguments: + - x-message-ttl: 8640000 + - x-expires: 8640000 + - x-dead-letter-exchange: my-new-exchange + auto_delete: false + durable: true + passwd: password + user: saltstack_mq + vhost: default_vhost + queues: {} + remove_guest_user: true + runas: rabbitmq + service: true + upstream: + my-new-upstream1: + - uri: amqp://saltstack_mq:password@localhost + - trust_user_id: true + - ack_mode: on-confirm + user: rabbit + users: + airflow: + force: true + password: airflow + perms: + default_vhost: + - ".*" + - ".*" + - ".*" + tags: + - management + - administrator + saltstack_mq: + force: false + password: password + perms: + default_vhost: + - ".*" + - ".*" + - ".*" + tags: + - administrator + - management + user1: + force: true + password: password + perms: + default_vhost: + - ".*" + - ".*" + - ".*" + tags: + - monitoring + - user + vhosts: + - default_vhost + rabbit2: + binding: + my-new-binding: + - destination_type: queue + - destination: my-new-queue + - routing_key: a_routing_key_string + - user: saltstack_mq + - passwd: password + - vhost: rabbit2_vhost + - arguments: + - x-message-ttl: 8640000 + clustered: false + config: + listeners.tcp.1: 0.0.0.0:5673 + distport: 25673 + erlang_cookie: shared-secret + exchange: + my-new-exchange: + - user: saltstack_mq + - passwd: password + - type: fanout + - durable: true + - internal: false + - auto_delete: false + - vhost: rabbit2_vhost + - arguments: + - alternate-**exchange: amq.fanout + - test-header: testing + host: localhost + nodeport: 5673 + plugins: [] + policy: + my-new-rabbitmq-policy: + - name: HA + - pattern: ".*" + - definition: '{"ha-mode": "all"}' + queue: + my-new-queue: + arguments: + - x-message-ttl: 8640000 + - x-expires: 8640000 + - x-dead-letter-exchange: my-new-exchange + auto_delete: false + durable: true + passwd: password + user: saltstack_mq + vhost: rabbit2_vhost + remove_guest_user: true + service: true + upstream: + my-new-upstream1: + - uri: amqp://saltstack_mq:password@localhost + - trust_user_id: true + - ack_mode: on-confirm + - max_hops: 1 + user: rabbit2 + users: + airflow: + force: true + password: airflow + perms: + rabbit2_vhost: + - ".*" + - ".*" + - ".*" + tags: + - management + - administrator + saltstack_mq: + force: false + password: password + perms: + rabbit2_vhost: + - ".*" + - ".*" + - ".*" + tags: + - administrator + user1: + force: true + password: password + perms: + rabbit2_vhost: + - ".*" + - ".*" + - ".*" + tags: + - monitoring + - user + vhosts: + - rabbit2_vhost pkg: - deps: [] + deps: + - socat name: rabbitmq-server use_upstream: repo - plugin: - rabbitmq_federation: - runas: root - rabbitmq_management: - runas: root - policy: - rabbitmq_policy: - - name: HA - - pattern: .* - - definition: '{"ha-mode": "all"}' - queue: - my-new-queue: - arguments: - - x-message-ttl: 8640000 - - x-expires: 8640000 - - x-dead-letter-exchange: my-new-exchange - auto_delete: false - durable: true - passwd: password - user: saltstack - vhost: test_vhost - remove_guest_user: true retry_option: attempts: 0 interval: 60 splay: 10 until: true rootgroup: root - service: - enabled: true - name: rabbitmq-server - running: true tofs: files_switch: - any/path/can/be/used/here @@ -110,44 +244,4 @@ values: source_files: rabbitmq-config-file-file-managed: - example.tmpl.jinja - upstream: - upstream_1: - - uri: amqp://saltstack:password@localhost - - trust_user_id: true - - ack_mode: on-confirm - - max_hops: 1 - user: - saltstack: - - password: password - - force: false - - tags: - - administrator - - perms: - - test_vhost: - - .* - - .* - - .* - - runas: root - user1: - - password: password - - force: true - - tags: monitoring, user - - perms: - - /: - - .* - - .* - - .* - - runas: root - user2: - - password: password - - force: true - - tags: monitoring, user - - perms: - - /: - - .* - - .* - - .* - - runas: root - vhost: - - test_vhost winner: pillar diff --git a/test/integration/default/files/_mapdata/gentoo-2-sysd.yaml b/test/integration/default/files/_mapdata/gentoo-2-sysd.yaml index 4ab181d1..45a6af6b 100644 --- a/test/integration/default/files/_mapdata/gentoo-2-sysd.yaml +++ b/test/integration/default/files/_mapdata/gentoo-2-sysd.yaml @@ -1,153 +1,5 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml # yamllint disable rule:indentation rule:line-length -# Gentoo-2 +# Gentoo --- -values: - added_in_defaults: defaults_value - added_in_pillar: pillar_value - arch: amd64 - binding: - my-new-binding: - - destination_type: queue - - destination: my-new-queue - - routing_key: a_routing_key_string - - user: saltstack - - passwd: password - - vhost: test_vhost - - arguments: - - x-message-ttl: 8640000 - cluster: - rabbit@locahost: - erlang_cookie: - name: /var/lib/rabbitmq/.erlang.cookie - value: shared-value-for-all-cluster-members - host: localhost # short hostname of node to join to, not fqdn - ram_node: None - runas: rabbitmq - user: rabbit # 'node' would make more sense here - config: - context: - listeners.tcp.1: 0.0.0.0:5672 - name: /etc/rabbitmq/rabbitmq.conf - dir: - base: /var/lib/rabbitmq - cleanlist: - - /usr/local/bin/rabbitmq-env - - /usr/local/bin/rabbitmq-plugins - - /var/run/rabbitmq - data: /var/lib/rabbitmq - env: - context: - RABBITMQ_BASE: /var/lib/rabbitmq - RABBITMQ_LOG_BASE: /var/log/rabbitmq - rabbitmq_mnesia_base: /var/lib/rabbitmq - locale_all: en_US.UTF-8 - name: /etc/rabbitmq/rabbitmq-env.conf - exchange: - my-new-exchange: - - user: saltstack - - passwd: password - - type: fanout - - durable: true - - internal: false - - auto_delete: false - - vhost: test_vhost - - arguments: - - alternate-**exchange: amq.fanout - - test-header: testing - map_jinja: - sources: - - Y:G@osarch - - Y:G@os_family - - Y:G@os - - Y:G@osfinger - - C@rabbitmq:lookup - - C@rabbitmq - - Y:G@id - pkg: - deps: [] - name: net-misc/rabbitmq-server - use_upstream: repo - plugin: - rabbitmq_federation: - runas: root - rabbitmq_management: - runas: root - policy: - rabbitmq_policy: - - name: HA - - pattern: .* - - definition: '{"ha-mode": "all"}' - queue: - my-new-queue: - arguments: - - x-message-ttl: 8640000 - - x-expires: 8640000 - - x-dead-letter-exchange: my-new-exchange - auto_delete: false - durable: true - passwd: password - user: saltstack - vhost: test_vhost - remove_guest_user: true - retry_option: - attempts: 0 - interval: 60 - splay: 10 - until: true - rootgroup: root - service: - enabled: true - name: rabbitmq-server - running: true - tofs: - files_switch: - - any/path/can/be/used/here - - id - - roles - - osfinger - - os - - os_family - source_files: - rabbitmq-config-file-file-managed: - - example.tmpl.jinja - upstream: - upstream_1: - - uri: amqp://saltstack:password@localhost - - trust_user_id: true - - ack_mode: on-confirm - - max_hops: 1 - user: - saltstack: - - password: password - - force: false - - tags: - - administrator - - perms: - - test_vhost: - - .* - - .* - - .* - - runas: root - user1: - - password: password - - force: true - - tags: monitoring, user - - perms: - - /: - - .* - - .* - - .* - - runas: root - user2: - - password: password - - force: true - - tags: monitoring, user - - perms: - - /: - - .* - - .* - - .* - - runas: root - vhost: - - test_vhost - winner: pillar diff --git a/test/integration/default/files/_mapdata/gentoo-2-sysv.yaml b/test/integration/default/files/_mapdata/gentoo-2-sysv.yaml index 4ab181d1..45a6af6b 100644 --- a/test/integration/default/files/_mapdata/gentoo-2-sysv.yaml +++ b/test/integration/default/files/_mapdata/gentoo-2-sysv.yaml @@ -1,153 +1,5 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml # yamllint disable rule:indentation rule:line-length -# Gentoo-2 +# Gentoo --- -values: - added_in_defaults: defaults_value - added_in_pillar: pillar_value - arch: amd64 - binding: - my-new-binding: - - destination_type: queue - - destination: my-new-queue - - routing_key: a_routing_key_string - - user: saltstack - - passwd: password - - vhost: test_vhost - - arguments: - - x-message-ttl: 8640000 - cluster: - rabbit@locahost: - erlang_cookie: - name: /var/lib/rabbitmq/.erlang.cookie - value: shared-value-for-all-cluster-members - host: localhost # short hostname of node to join to, not fqdn - ram_node: None - runas: rabbitmq - user: rabbit # 'node' would make more sense here - config: - context: - listeners.tcp.1: 0.0.0.0:5672 - name: /etc/rabbitmq/rabbitmq.conf - dir: - base: /var/lib/rabbitmq - cleanlist: - - /usr/local/bin/rabbitmq-env - - /usr/local/bin/rabbitmq-plugins - - /var/run/rabbitmq - data: /var/lib/rabbitmq - env: - context: - RABBITMQ_BASE: /var/lib/rabbitmq - RABBITMQ_LOG_BASE: /var/log/rabbitmq - rabbitmq_mnesia_base: /var/lib/rabbitmq - locale_all: en_US.UTF-8 - name: /etc/rabbitmq/rabbitmq-env.conf - exchange: - my-new-exchange: - - user: saltstack - - passwd: password - - type: fanout - - durable: true - - internal: false - - auto_delete: false - - vhost: test_vhost - - arguments: - - alternate-**exchange: amq.fanout - - test-header: testing - map_jinja: - sources: - - Y:G@osarch - - Y:G@os_family - - Y:G@os - - Y:G@osfinger - - C@rabbitmq:lookup - - C@rabbitmq - - Y:G@id - pkg: - deps: [] - name: net-misc/rabbitmq-server - use_upstream: repo - plugin: - rabbitmq_federation: - runas: root - rabbitmq_management: - runas: root - policy: - rabbitmq_policy: - - name: HA - - pattern: .* - - definition: '{"ha-mode": "all"}' - queue: - my-new-queue: - arguments: - - x-message-ttl: 8640000 - - x-expires: 8640000 - - x-dead-letter-exchange: my-new-exchange - auto_delete: false - durable: true - passwd: password - user: saltstack - vhost: test_vhost - remove_guest_user: true - retry_option: - attempts: 0 - interval: 60 - splay: 10 - until: true - rootgroup: root - service: - enabled: true - name: rabbitmq-server - running: true - tofs: - files_switch: - - any/path/can/be/used/here - - id - - roles - - osfinger - - os - - os_family - source_files: - rabbitmq-config-file-file-managed: - - example.tmpl.jinja - upstream: - upstream_1: - - uri: amqp://saltstack:password@localhost - - trust_user_id: true - - ack_mode: on-confirm - - max_hops: 1 - user: - saltstack: - - password: password - - force: false - - tags: - - administrator - - perms: - - test_vhost: - - .* - - .* - - .* - - runas: root - user1: - - password: password - - force: true - - tags: monitoring, user - - perms: - - /: - - .* - - .* - - .* - - runas: root - user2: - - password: password - - force: true - - tags: monitoring, user - - perms: - - /: - - .* - - .* - - .* - - runas: root - vhost: - - test_vhost - winner: pillar diff --git a/test/integration/default/files/_mapdata/opensuse-15.yaml b/test/integration/default/files/_mapdata/opensuse-15.yaml index 6c570327..2f6d08b2 100644 --- a/test/integration/default/files/_mapdata/opensuse-15.yaml +++ b/test/integration/default/files/_mapdata/opensuse-15.yaml @@ -1,153 +1,5 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml # yamllint disable rule:indentation rule:line-length -# Leap-15 +# OpenSuse --- -values: - added_in_defaults: defaults_value - added_in_pillar: pillar_value - arch: amd64 - binding: - my-new-binding: - - destination_type: queue - - destination: my-new-queue - - routing_key: a_routing_key_string - - user: saltstack - - passwd: password - - vhost: test_vhost - - arguments: - - x-message-ttl: 8640000 - cluster: - rabbit@locahost: - erlang_cookie: - name: /var/lib/rabbitmq/.erlang.cookie - value: shared-value-for-all-cluster-members - host: localhost # short hostname of node to join to, not fqdn - ram_node: None - runas: rabbitmq - user: rabbit # 'node' would make more sense here - config: - context: - listeners.tcp.1: 0.0.0.0:5672 - name: /etc/rabbitmq/rabbitmq.conf - dir: - base: /var/lib/rabbitmq - cleanlist: - - /usr/local/bin/rabbitmq-env - - /usr/local/bin/rabbitmq-plugins - - /var/run/rabbitmq - data: /var/lib/rabbitmq - env: - context: - RABBITMQ_BASE: /var/lib/rabbitmq - RABBITMQ_LOG_BASE: /var/log/rabbitmq - rabbitmq_mnesia_base: /var/lib/rabbitmq - locale_all: en_US.UTF-8 - name: /etc/rabbitmq/rabbitmq-env.conf - exchange: - my-new-exchange: - - user: saltstack - - passwd: password - - type: fanout - - durable: true - - internal: false - - auto_delete: false - - vhost: test_vhost - - arguments: - - alternate-**exchange: amq.fanout - - test-header: testing - map_jinja: - sources: - - Y:G@osarch - - Y:G@os_family - - Y:G@os - - Y:G@osfinger - - C@rabbitmq:lookup - - C@rabbitmq - - Y:G@id - pkg: - deps: [] - name: rabbitmq-server - use_upstream: repo - plugin: - rabbitmq_federation: - runas: root - rabbitmq_management: - runas: root - policy: - rabbitmq_policy: - - name: HA - - pattern: .* - - definition: '{"ha-mode": "all"}' - queue: - my-new-queue: - arguments: - - x-message-ttl: 8640000 - - x-expires: 8640000 - - x-dead-letter-exchange: my-new-exchange - auto_delete: false - durable: true - passwd: password - user: saltstack - vhost: test_vhost - remove_guest_user: true - retry_option: - attempts: 0 - interval: 60 - splay: 10 - until: true - rootgroup: root - service: - enabled: true - name: rabbitmq-server - running: true - tofs: - files_switch: - - any/path/can/be/used/here - - id - - roles - - osfinger - - os - - os_family - source_files: - rabbitmq-config-file-file-managed: - - example.tmpl.jinja - upstream: - upstream_1: - - uri: amqp://saltstack:password@localhost - - trust_user_id: true - - ack_mode: on-confirm - - max_hops: 1 - user: - saltstack: - - password: password - - force: false - - tags: - - administrator - - perms: - - test_vhost: - - .* - - .* - - .* - - runas: root - user1: - - password: password - - force: true - - tags: monitoring, user - - perms: - - /: - - .* - - .* - - .* - - runas: root - user2: - - password: password - - force: true - - tags: monitoring, user - - perms: - - /: - - .* - - .* - - .* - - runas: root - vhost: - - test_vhost - winner: pillar diff --git a/test/integration/default/files/_mapdata/opensuse-tumbleweed.yaml b/test/integration/default/files/_mapdata/opensuse-tumbleweed.yaml index 9e1ee93b..9967a305 100644 --- a/test/integration/default/files/_mapdata/opensuse-tumbleweed.yaml +++ b/test/integration/default/files/_mapdata/opensuse-tumbleweed.yaml @@ -1,153 +1,5 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml # yamllint disable rule:indentation rule:line-length -# openSUSE Tumbleweed-20210210 +# OpenSuse Tumbleweed --- -values: - added_in_defaults: defaults_value - added_in_pillar: pillar_value - arch: amd64 - binding: - my-new-binding: - - destination_type: queue - - destination: my-new-queue - - routing_key: a_routing_key_string - - user: saltstack - - passwd: password - - vhost: test_vhost - - arguments: - - x-message-ttl: 8640000 - cluster: - rabbit@locahost: - erlang_cookie: - name: /var/lib/rabbitmq/.erlang.cookie - value: shared-value-for-all-cluster-members - host: localhost # short hostname of node to join to, not fqdn - ram_node: None - runas: rabbitmq - user: rabbit # 'node' would make more sense here - config: - context: - listeners.tcp.1: 0.0.0.0:5672 - name: /etc/rabbitmq/rabbitmq.conf - dir: - base: /var/lib/rabbitmq - cleanlist: - - /usr/local/bin/rabbitmq-env - - /usr/local/bin/rabbitmq-plugins - - /var/run/rabbitmq - data: /var/lib/rabbitmq - env: - context: - RABBITMQ_BASE: /var/lib/rabbitmq - RABBITMQ_LOG_BASE: /var/log/rabbitmq - rabbitmq_mnesia_base: /var/lib/rabbitmq - locale_all: en_US.UTF-8 - name: /etc/rabbitmq/rabbitmq-env.conf - exchange: - my-new-exchange: - - user: saltstack - - passwd: password - - type: fanout - - durable: true - - internal: false - - auto_delete: false - - vhost: test_vhost - - arguments: - - alternate-**exchange: amq.fanout - - test-header: testing - map_jinja: - sources: - - Y:G@osarch - - Y:G@os_family - - Y:G@os - - Y:G@osfinger - - C@rabbitmq:lookup - - C@rabbitmq - - Y:G@id - pkg: - deps: [] - name: rabbitmq-server - use_upstream: repo - plugin: - rabbitmq_federation: - runas: root - rabbitmq_management: - runas: root - policy: - rabbitmq_policy: - - name: HA - - pattern: .* - - definition: '{"ha-mode": "all"}' - queue: - my-new-queue: - arguments: - - x-message-ttl: 8640000 - - x-expires: 8640000 - - x-dead-letter-exchange: my-new-exchange - auto_delete: false - durable: true - passwd: password - user: saltstack - vhost: test_vhost - remove_guest_user: true - retry_option: - attempts: 0 - interval: 60 - splay: 10 - until: true - rootgroup: root - service: - enabled: true - name: rabbitmq-server - running: true - tofs: - files_switch: - - any/path/can/be/used/here - - id - - roles - - osfinger - - os - - os_family - source_files: - rabbitmq-config-file-file-managed: - - example.tmpl.jinja - upstream: - upstream_1: - - uri: amqp://saltstack:password@localhost - - trust_user_id: true - - ack_mode: on-confirm - - max_hops: 1 - user: - saltstack: - - password: password - - force: false - - tags: - - administrator - - perms: - - test_vhost: - - .* - - .* - - .* - - runas: root - user1: - - password: password - - force: true - - tags: monitoring, user - - perms: - - /: - - .* - - .* - - .* - - runas: root - user2: - - password: password - - force: true - - tags: monitoring, user - - perms: - - /: - - .* - - .* - - .* - - runas: root - vhost: - - test_vhost - winner: pillar diff --git a/test/integration/default/files/_mapdata/oraclelinux-7.yaml b/test/integration/default/files/_mapdata/oraclelinux-7.yaml index f35d7f04..7894a1f3 100644 --- a/test/integration/default/files/_mapdata/oraclelinux-7.yaml +++ b/test/integration/default/files/_mapdata/oraclelinux-7.yaml @@ -1,153 +1,5 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml # yamllint disable rule:indentation rule:line-length -# Oracle Linux Server-7 +# Oraclelinux 7 --- -values: - added_in_defaults: defaults_value - added_in_pillar: pillar_value - arch: amd64 - binding: - my-new-binding: - - destination_type: queue - - destination: my-new-queue - - routing_key: a_routing_key_string - - user: saltstack - - passwd: password - - vhost: test_vhost - - arguments: - - x-message-ttl: 8640000 - cluster: - rabbit@locahost: - erlang_cookie: - name: /var/lib/rabbitmq/.erlang.cookie - value: shared-value-for-all-cluster-members - host: localhost # short hostname of node to join to, not fqdn - ram_node: None - runas: rabbitmq - user: rabbit # 'node' would make more sense here - config: - context: - listeners.tcp.1: 0.0.0.0:5672 - name: /etc/rabbitmq/rabbitmq.conf - dir: - base: /var/lib/rabbitmq - cleanlist: - - /usr/local/bin/rabbitmq-env - - /usr/local/bin/rabbitmq-plugins - - /var/run/rabbitmq - data: /var/lib/rabbitmq - env: - context: - RABBITMQ_BASE: /var/lib/rabbitmq - RABBITMQ_LOG_BASE: /var/log/rabbitmq - rabbitmq_mnesia_base: /var/lib/rabbitmq - locale_all: en_US.UTF-8 - name: /etc/rabbitmq/rabbitmq-env.conf - exchange: - my-new-exchange: - - user: saltstack - - passwd: password - - type: fanout - - durable: true - - internal: false - - auto_delete: false - - vhost: test_vhost - - arguments: - - alternate-**exchange: amq.fanout - - test-header: testing - map_jinja: - sources: - - Y:G@osarch - - Y:G@os_family - - Y:G@os - - Y:G@osfinger - - C@rabbitmq:lookup - - C@rabbitmq - - Y:G@id - pkg: - deps: [] - name: rabbitmq-server - use_upstream: repo - plugin: - rabbitmq_federation: - runas: root - rabbitmq_management: - runas: root - policy: - rabbitmq_policy: - - name: HA - - pattern: .* - - definition: '{"ha-mode": "all"}' - queue: - my-new-queue: - arguments: - - x-message-ttl: 8640000 - - x-expires: 8640000 - - x-dead-letter-exchange: my-new-exchange - auto_delete: false - durable: true - passwd: password - user: saltstack - vhost: test_vhost - remove_guest_user: true - retry_option: - attempts: 0 - interval: 60 - splay: 10 - until: true - rootgroup: root - service: - enabled: true - name: rabbitmq-server - running: true - tofs: - files_switch: - - any/path/can/be/used/here - - id - - roles - - osfinger - - os - - os_family - source_files: - rabbitmq-config-file-file-managed: - - example.tmpl.jinja - upstream: - upstream_1: - - uri: amqp://saltstack:password@localhost - - trust_user_id: true - - ack_mode: on-confirm - - max_hops: 1 - user: - saltstack: - - password: password - - force: false - - tags: - - administrator - - perms: - - test_vhost: - - .* - - .* - - .* - - runas: root - user1: - - password: password - - force: true - - tags: monitoring, user - - perms: - - /: - - .* - - .* - - .* - - runas: root - user2: - - password: password - - force: true - - tags: monitoring, user - - perms: - - /: - - .* - - .* - - .* - - runas: root - vhost: - - test_vhost - winner: pillar diff --git a/test/integration/default/files/_mapdata/oraclelinux-8.yaml b/test/integration/default/files/_mapdata/oraclelinux-8.yaml index 8d4116ae..3d5b6b16 100644 --- a/test/integration/default/files/_mapdata/oraclelinux-8.yaml +++ b/test/integration/default/files/_mapdata/oraclelinux-8.yaml @@ -1,153 +1,5 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml # yamllint disable rule:indentation rule:line-length -# Oracle Linux Server-8 +# Oraclelinux 8 --- -values: - added_in_defaults: defaults_value - added_in_pillar: pillar_value - arch: amd64 - binding: - my-new-binding: - - destination_type: queue - - destination: my-new-queue - - routing_key: a_routing_key_string - - user: saltstack - - passwd: password - - vhost: test_vhost - - arguments: - - x-message-ttl: 8640000 - cluster: - rabbit@locahost: - erlang_cookie: - name: /var/lib/rabbitmq/.erlang.cookie - value: shared-value-for-all-cluster-members - host: localhost # short hostname of node to join to, not fqdn - ram_node: None - runas: rabbitmq - user: rabbit # 'node' would make more sense here - config: - context: - listeners.tcp.1: 0.0.0.0:5672 - name: /etc/rabbitmq/rabbitmq.conf - dir: - base: /var/lib/rabbitmq - cleanlist: - - /usr/local/bin/rabbitmq-env - - /usr/local/bin/rabbitmq-plugins - - /var/run/rabbitmq - data: /var/lib/rabbitmq - env: - context: - RABBITMQ_BASE: /var/lib/rabbitmq - RABBITMQ_LOG_BASE: /var/log/rabbitmq - rabbitmq_mnesia_base: /var/lib/rabbitmq - locale_all: en_US.UTF-8 - name: /etc/rabbitmq/rabbitmq-env.conf - exchange: - my-new-exchange: - - user: saltstack - - passwd: password - - type: fanout - - durable: true - - internal: false - - auto_delete: false - - vhost: test_vhost - - arguments: - - alternate-**exchange: amq.fanout - - test-header: testing - map_jinja: - sources: - - Y:G@osarch - - Y:G@os_family - - Y:G@os - - Y:G@osfinger - - C@rabbitmq:lookup - - C@rabbitmq - - Y:G@id - pkg: - deps: [] - name: rabbitmq-server - use_upstream: repo - plugin: - rabbitmq_federation: - runas: root - rabbitmq_management: - runas: root - policy: - rabbitmq_policy: - - name: HA - - pattern: .* - - definition: '{"ha-mode": "all"}' - queue: - my-new-queue: - arguments: - - x-message-ttl: 8640000 - - x-expires: 8640000 - - x-dead-letter-exchange: my-new-exchange - auto_delete: false - durable: true - passwd: password - user: saltstack - vhost: test_vhost - remove_guest_user: true - retry_option: - attempts: 0 - interval: 60 - splay: 10 - until: true - rootgroup: root - service: - enabled: true - name: rabbitmq-server - running: true - tofs: - files_switch: - - any/path/can/be/used/here - - id - - roles - - osfinger - - os - - os_family - source_files: - rabbitmq-config-file-file-managed: - - example.tmpl.jinja - upstream: - upstream_1: - - uri: amqp://saltstack:password@localhost - - trust_user_id: true - - ack_mode: on-confirm - - max_hops: 1 - user: - saltstack: - - password: password - - force: false - - tags: - - administrator - - perms: - - test_vhost: - - .* - - .* - - .* - - runas: root - user1: - - password: password - - force: true - - tags: monitoring, user - - perms: - - /: - - .* - - .* - - .* - - runas: root - user2: - - password: password - - force: true - - tags: monitoring, user - - perms: - - /: - - .* - - .* - - .* - - runas: root - vhost: - - test_vhost - winner: pillar diff --git a/test/integration/default/files/_mapdata/ubuntu-16.yaml b/test/integration/default/files/_mapdata/ubuntu-16.yaml index 7d20510b..9011fbe6 100644 --- a/test/integration/default/files/_mapdata/ubuntu-16.yaml +++ b/test/integration/default/files/_mapdata/ubuntu-16.yaml @@ -1,59 +1,24 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml # yamllint disable rule:indentation rule:line-length -# Ubuntu-16.04 +# Ubuntu 16 --- values: added_in_defaults: defaults_value added_in_pillar: pillar_value arch: amd64 - binding: - my-new-binding: - - destination_type: queue - - destination: my-new-queue - - routing_key: a_routing_key_string - - user: saltstack - - passwd: password - - vhost: test_vhost - - arguments: - - x-message-ttl: 8640000 - cluster: - rabbit@locahost: - erlang_cookie: - name: /var/lib/rabbitmq/.erlang.cookie - value: shared-value-for-all-cluster-members - host: localhost # short hostname of node to join to, not fqdn - ram_node: None - runas: rabbitmq - user: rabbit # 'node' would make more sense here - config: - context: - listeners.tcp.1: 0.0.0.0:5672 - name: /etc/rabbitmq/rabbitmq.conf dir: - base: /var/lib/rabbitmq + base: "/var/lib/rabbitmq" cleanlist: - - /usr/local/bin/rabbitmq-env - - /usr/local/bin/rabbitmq-plugins - - /var/run/rabbitmq - data: /var/lib/rabbitmq - env: - context: - RABBITMQ_BASE: /var/lib/rabbitmq - RABBITMQ_LOG_BASE: /var/log/rabbitmq - rabbitmq_mnesia_base: /var/lib/rabbitmq + - "/usr/local/bin/rabbitmq-env" + - "/usr/local/bin/rabbitmq-plugins" + - "/var/run/rabbitmq" + config: "/etc/rabbitmq" + data: "/var/lib/rabbitmq" + service: "/usr/lib/systemd/system" + environ: locale_all: en_US.UTF-8 - name: /etc/rabbitmq/rabbitmq-env.conf - exchange: - my-new-exchange: - - user: saltstack - - passwd: password - - type: fanout - - durable: true - - internal: false - - auto_delete: false - - vhost: test_vhost - - arguments: - - alternate-**exchange: amq.fanout - - test-header: testing + values: {} map_jinja: sources: - Y:G@osarch @@ -63,43 +28,209 @@ values: - C@rabbitmq:lookup - C@rabbitmq - Y:G@id + nodes: + rabbit: + binding: + my-new-binding: + - destination_type: queue + - destination: my-new-queue + - routing_key: a_routing_key_string + - user: saltstack_mq + - passwd: password + - vhost: default_vhost + - arguments: + - x-message-ttl: 8640000 + clustered: false + config: + listeners.tcp.1: 0.0.0.0:5672 + distport: 25672 + erlang_cookie: shared-secret + exchange: + my-new-exchange: + - user: saltstack_mq + - passwd: password + - type: fanout + - durable: true + - internal: false + - auto_delete: false + - vhost: default_vhost + - arguments: + - alternate-**exchange: amq.fanout + - test-header: testing + host: localhost + nodeport: 5672 + plugins: + - rabbitmq_management + - rabbitmq_federation + - rabbitmq_federation_management + policy: + my-new-rabbitmq-policy: + - name: HA + - pattern: ".*" + - definition: '{"ha-mode": "all"}' + rabbitmq_policy: + - name: HA + - pattern: ".*" + - definition: '{"ha-mode": "all"}' + queue: + my-new-queue: + arguments: + - x-message-ttl: 8640000 + - x-expires: 8640000 + - x-dead-letter-exchange: my-new-exchange + auto_delete: false + durable: true + passwd: password + user: saltstack_mq + vhost: default_vhost + queues: {} + remove_guest_user: true + runas: rabbitmq + service: true + upstream: + my-new-upstream1: + - uri: amqp://saltstack_mq:password@localhost + - trust_user_id: true + - ack_mode: on-confirm + user: rabbit + users: + airflow: + force: true + password: airflow + perms: + default_vhost: + - ".*" + - ".*" + - ".*" + tags: + - management + - administrator + saltstack_mq: + force: false + password: password + perms: + default_vhost: + - ".*" + - ".*" + - ".*" + tags: + - administrator + - management + user1: + force: true + password: password + perms: + default_vhost: + - ".*" + - ".*" + - ".*" + tags: + - monitoring + - user + vhosts: + - default_vhost + rabbit2: + binding: + my-new-binding: + - destination_type: queue + - destination: my-new-queue + - routing_key: a_routing_key_string + - user: saltstack_mq + - passwd: password + - vhost: rabbit2_vhost + - arguments: + - x-message-ttl: 8640000 + clustered: false + config: + listeners.tcp.1: 0.0.0.0:5673 + distport: 25673 + erlang_cookie: shared-secret + exchange: + my-new-exchange: + - user: saltstack_mq + - passwd: password + - type: fanout + - durable: true + - internal: false + - auto_delete: false + - vhost: rabbit2_vhost + - arguments: + - alternate-**exchange: amq.fanout + - test-header: testing + host: localhost + nodeport: 5673 + plugins: [] + policy: + my-new-rabbitmq-policy: + - name: HA + - pattern: ".*" + - definition: '{"ha-mode": "all"}' + queue: + my-new-queue: + arguments: + - x-message-ttl: 8640000 + - x-expires: 8640000 + - x-dead-letter-exchange: my-new-exchange + auto_delete: false + durable: true + passwd: password + user: saltstack_mq + vhost: rabbit2_vhost + remove_guest_user: true + service: true + upstream: + my-new-upstream1: + - uri: amqp://saltstack_mq:password@localhost + - trust_user_id: true + - ack_mode: on-confirm + - max_hops: 1 + user: rabbit2 + users: + airflow: + force: true + password: airflow + perms: + rabbit2_vhost: + - ".*" + - ".*" + - ".*" + tags: + - management + - administrator + saltstack_mq: + force: false + password: password + perms: + rabbit2_vhost: + - ".*" + - ".*" + - ".*" + tags: + - administrator + user1: + force: true + password: password + perms: + rabbit2_vhost: + - ".*" + - ".*" + - ".*" + tags: + - monitoring + - user + vhosts: + - rabbit2_vhost pkg: deps: - - libtinfo5 + - libtinfo5 name: rabbitmq-server use_upstream: repo - plugin: - rabbitmq_federation: - runas: root - rabbitmq_management: - runas: root - policy: - rabbitmq_policy: - - name: HA - - pattern: .* - - definition: '{"ha-mode": "all"}' - queue: - my-new-queue: - arguments: - - x-message-ttl: 8640000 - - x-expires: 8640000 - - x-dead-letter-exchange: my-new-exchange - auto_delete: false - durable: true - passwd: password - user: saltstack - vhost: test_vhost - remove_guest_user: true retry_option: attempts: 0 interval: 60 splay: 10 until: true rootgroup: root - service: - enabled: true - name: rabbitmq-server - running: true tofs: files_switch: - any/path/can/be/used/here @@ -111,44 +242,4 @@ values: source_files: rabbitmq-config-file-file-managed: - example.tmpl.jinja - upstream: - upstream_1: - - uri: amqp://saltstack:password@localhost - - trust_user_id: true - - ack_mode: on-confirm - - max_hops: 1 - user: - saltstack: - - password: password - - force: false - - tags: - - administrator - - perms: - - test_vhost: - - .* - - .* - - .* - - runas: root - user1: - - password: password - - force: true - - tags: monitoring, user - - perms: - - /: - - .* - - .* - - .* - - runas: root - user2: - - password: password - - force: true - - tags: monitoring, user - - perms: - - /: - - .* - - .* - - .* - - runas: root - vhost: - - test_vhost winner: pillar diff --git a/test/integration/default/files/_mapdata/ubuntu-18.yaml b/test/integration/default/files/_mapdata/ubuntu-18.yaml index dadaad2d..912069b5 100644 --- a/test/integration/default/files/_mapdata/ubuntu-18.yaml +++ b/test/integration/default/files/_mapdata/ubuntu-18.yaml @@ -1,59 +1,24 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml # yamllint disable rule:indentation rule:line-length -# Ubuntu-18.04 +# Ubuntu 18 --- values: added_in_defaults: defaults_value added_in_pillar: pillar_value arch: amd64 - binding: - my-new-binding: - - destination_type: queue - - destination: my-new-queue - - routing_key: a_routing_key_string - - user: saltstack - - passwd: password - - vhost: test_vhost - - arguments: - - x-message-ttl: 8640000 - cluster: - rabbit@locahost: - erlang_cookie: - name: /var/lib/rabbitmq/.erlang.cookie - value: shared-value-for-all-cluster-members - host: localhost # short hostname of node to join to, not fqdn - ram_node: None - runas: rabbitmq - user: rabbit # 'node' would make more sense here - config: - context: - listeners.tcp.1: 0.0.0.0:5672 - name: /etc/rabbitmq/rabbitmq.conf dir: - base: /var/lib/rabbitmq + base: "/var/lib/rabbitmq" cleanlist: - - /usr/local/bin/rabbitmq-env - - /usr/local/bin/rabbitmq-plugins - - /var/run/rabbitmq - data: /var/lib/rabbitmq - env: - context: - RABBITMQ_BASE: /var/lib/rabbitmq - RABBITMQ_LOG_BASE: /var/log/rabbitmq - rabbitmq_mnesia_base: /var/lib/rabbitmq + - "/usr/local/bin/rabbitmq-env" + - "/usr/local/bin/rabbitmq-plugins" + - "/var/run/rabbitmq" + config: "/etc/rabbitmq" + data: "/var/lib/rabbitmq" + service: "/usr/lib/systemd/system" + environ: locale_all: en_US.UTF-8 - name: /etc/rabbitmq/rabbitmq-env.conf - exchange: - my-new-exchange: - - user: saltstack - - passwd: password - - type: fanout - - durable: true - - internal: false - - auto_delete: false - - vhost: test_vhost - - arguments: - - alternate-**exchange: amq.fanout - - test-header: testing + values: {} map_jinja: sources: - Y:G@osarch @@ -63,43 +28,209 @@ values: - C@rabbitmq:lookup - C@rabbitmq - Y:G@id + nodes: + rabbit: + binding: + my-new-binding: + - destination_type: queue + - destination: my-new-queue + - routing_key: a_routing_key_string + - user: saltstack_mq + - passwd: password + - vhost: default_vhost + - arguments: + - x-message-ttl: 8640000 + clustered: false + config: + listeners.tcp.1: 0.0.0.0:5672 + distport: 25672 + erlang_cookie: shared-secret + exchange: + my-new-exchange: + - user: saltstack_mq + - passwd: password + - type: fanout + - durable: true + - internal: false + - auto_delete: false + - vhost: default_vhost + - arguments: + - alternate-**exchange: amq.fanout + - test-header: testing + host: localhost + nodeport: 5672 + plugins: + - rabbitmq_management + - rabbitmq_federation + - rabbitmq_federation_management + policy: + my-new-rabbitmq-policy: + - name: HA + - pattern: ".*" + - definition: '{"ha-mode": "all"}' + rabbitmq_policy: + - name: HA + - pattern: ".*" + - definition: '{"ha-mode": "all"}' + queue: + my-new-queue: + arguments: + - x-message-ttl: 8640000 + - x-expires: 8640000 + - x-dead-letter-exchange: my-new-exchange + auto_delete: false + durable: true + passwd: password + user: saltstack_mq + vhost: default_vhost + queues: {} + remove_guest_user: true + runas: rabbitmq + service: true + upstream: + my-new-upstream1: + - uri: amqp://saltstack_mq:password@localhost + - trust_user_id: true + - ack_mode: on-confirm + user: rabbit + users: + airflow: + force: true + password: airflow + perms: + default_vhost: + - ".*" + - ".*" + - ".*" + tags: + - management + - administrator + saltstack_mq: + force: false + password: password + perms: + default_vhost: + - ".*" + - ".*" + - ".*" + tags: + - administrator + - management + user1: + force: true + password: password + perms: + default_vhost: + - ".*" + - ".*" + - ".*" + tags: + - monitoring + - user + vhosts: + - default_vhost + rabbit2: + binding: + my-new-binding: + - destination_type: queue + - destination: my-new-queue + - routing_key: a_routing_key_string + - user: saltstack_mq + - passwd: password + - vhost: rabbit2_vhost + - arguments: + - x-message-ttl: 8640000 + clustered: false + config: + listeners.tcp.1: 0.0.0.0:5673 + distport: 25673 + erlang_cookie: shared-secret + exchange: + my-new-exchange: + - user: saltstack_mq + - passwd: password + - type: fanout + - durable: true + - internal: false + - auto_delete: false + - vhost: rabbit2_vhost + - arguments: + - alternate-**exchange: amq.fanout + - test-header: testing + host: localhost + nodeport: 5673 + plugins: [] + policy: + my-new-rabbitmq-policy: + - name: HA + - pattern: ".*" + - definition: '{"ha-mode": "all"}' + queue: + my-new-queue: + arguments: + - x-message-ttl: 8640000 + - x-expires: 8640000 + - x-dead-letter-exchange: my-new-exchange + auto_delete: false + durable: true + passwd: password + user: saltstack_mq + vhost: rabbit2_vhost + remove_guest_user: true + service: true + upstream: + my-new-upstream1: + - uri: amqp://saltstack_mq:password@localhost + - trust_user_id: true + - ack_mode: on-confirm + - max_hops: 1 + user: rabbit2 + users: + airflow: + force: true + password: airflow + perms: + rabbit2_vhost: + - ".*" + - ".*" + - ".*" + tags: + - management + - administrator + saltstack_mq: + force: false + password: password + perms: + rabbit2_vhost: + - ".*" + - ".*" + - ".*" + tags: + - administrator + user1: + force: true + password: password + perms: + rabbit2_vhost: + - ".*" + - ".*" + - ".*" + tags: + - monitoring + - user + vhosts: + - rabbit2_vhost pkg: deps: - - libtinfo5 + - libtinfo5 name: rabbitmq-server use_upstream: repo - plugin: - rabbitmq_federation: - runas: root - rabbitmq_management: - runas: root - policy: - rabbitmq_policy: - - name: HA - - pattern: .* - - definition: '{"ha-mode": "all"}' - queue: - my-new-queue: - arguments: - - x-message-ttl: 8640000 - - x-expires: 8640000 - - x-dead-letter-exchange: my-new-exchange - auto_delete: false - durable: true - passwd: password - user: saltstack - vhost: test_vhost - remove_guest_user: true retry_option: attempts: 0 interval: 60 splay: 10 until: true rootgroup: root - service: - enabled: true - name: rabbitmq-server - running: true tofs: files_switch: - any/path/can/be/used/here @@ -111,44 +242,4 @@ values: source_files: rabbitmq-config-file-file-managed: - example.tmpl.jinja - upstream: - upstream_1: - - uri: amqp://saltstack:password@localhost - - trust_user_id: true - - ack_mode: on-confirm - - max_hops: 1 - user: - saltstack: - - password: password - - force: false - - tags: - - administrator - - perms: - - test_vhost: - - .* - - .* - - .* - - runas: root - user1: - - password: password - - force: true - - tags: monitoring, user - - perms: - - /: - - .* - - .* - - .* - - runas: root - user2: - - password: password - - force: true - - tags: monitoring, user - - perms: - - /: - - .* - - .* - - .* - - runas: root - vhost: - - test_vhost winner: pillar diff --git a/test/integration/default/files/_mapdata/ubuntu-20.yaml b/test/integration/default/files/_mapdata/ubuntu-20.yaml index 0ad2f573..afff9476 100644 --- a/test/integration/default/files/_mapdata/ubuntu-20.yaml +++ b/test/integration/default/files/_mapdata/ubuntu-20.yaml @@ -1,59 +1,24 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml # yamllint disable rule:indentation rule:line-length -# Ubuntu-20.04 +# Ubuntu 20 --- values: added_in_defaults: defaults_value added_in_pillar: pillar_value arch: amd64 - binding: - my-new-binding: - - destination_type: queue - - destination: my-new-queue - - routing_key: a_routing_key_string - - user: saltstack - - passwd: password - - vhost: test_vhost - - arguments: - - x-message-ttl: 8640000 - cluster: - rabbit@locahost: - erlang_cookie: - name: /var/lib/rabbitmq/.erlang.cookie - value: shared-value-for-all-cluster-members - host: localhost # short hostname of node to join to, not fqdn - ram_node: None - runas: rabbitmq - user: rabbit # 'node' would make more sense here - config: - context: - listeners.tcp.1: 0.0.0.0:5672 - name: /etc/rabbitmq/rabbitmq.conf dir: - base: /var/lib/rabbitmq + base: "/var/lib/rabbitmq" cleanlist: - - /usr/local/bin/rabbitmq-env - - /usr/local/bin/rabbitmq-plugins - - /var/run/rabbitmq - data: /var/lib/rabbitmq - env: - context: - RABBITMQ_BASE: /var/lib/rabbitmq - RABBITMQ_LOG_BASE: /var/log/rabbitmq - rabbitmq_mnesia_base: /var/lib/rabbitmq + - "/usr/local/bin/rabbitmq-env" + - "/usr/local/bin/rabbitmq-plugins" + - "/var/run/rabbitmq" + config: "/etc/rabbitmq" + data: "/var/lib/rabbitmq" + service: "/usr/lib/systemd/system" + environ: locale_all: en_US.UTF-8 - name: /etc/rabbitmq/rabbitmq-env.conf - exchange: - my-new-exchange: - - user: saltstack - - passwd: password - - type: fanout - - durable: true - - internal: false - - auto_delete: false - - vhost: test_vhost - - arguments: - - alternate-**exchange: amq.fanout - - test-header: testing + values: {} map_jinja: sources: - Y:G@osarch @@ -63,43 +28,209 @@ values: - C@rabbitmq:lookup - C@rabbitmq - Y:G@id + nodes: + rabbit: + binding: + my-new-binding: + - destination_type: queue + - destination: my-new-queue + - routing_key: a_routing_key_string + - user: saltstack_mq + - passwd: password + - vhost: default_vhost + - arguments: + - x-message-ttl: 8640000 + clustered: false + config: + listeners.tcp.1: 0.0.0.0:5672 + distport: 25672 + erlang_cookie: shared-secret + exchange: + my-new-exchange: + - user: saltstack_mq + - passwd: password + - type: fanout + - durable: true + - internal: false + - auto_delete: false + - vhost: default_vhost + - arguments: + - alternate-**exchange: amq.fanout + - test-header: testing + host: localhost + nodeport: 5672 + plugins: + - rabbitmq_management + - rabbitmq_federation + - rabbitmq_federation_management + policy: + my-new-rabbitmq-policy: + - name: HA + - pattern: ".*" + - definition: '{"ha-mode": "all"}' + rabbitmq_policy: + - name: HA + - pattern: ".*" + - definition: '{"ha-mode": "all"}' + queue: + my-new-queue: + arguments: + - x-message-ttl: 8640000 + - x-expires: 8640000 + - x-dead-letter-exchange: my-new-exchange + auto_delete: false + durable: true + passwd: password + user: saltstack_mq + vhost: default_vhost + queues: {} + remove_guest_user: true + runas: rabbitmq + service: true + upstream: + my-new-upstream1: + - uri: amqp://saltstack_mq:password@localhost + - trust_user_id: true + - ack_mode: on-confirm + user: rabbit + users: + airflow: + force: true + password: airflow + perms: + default_vhost: + - ".*" + - ".*" + - ".*" + tags: + - management + - administrator + saltstack_mq: + force: false + password: password + perms: + default_vhost: + - ".*" + - ".*" + - ".*" + tags: + - administrator + - management + user1: + force: true + password: password + perms: + default_vhost: + - ".*" + - ".*" + - ".*" + tags: + - monitoring + - user + vhosts: + - default_vhost + rabbit2: + binding: + my-new-binding: + - destination_type: queue + - destination: my-new-queue + - routing_key: a_routing_key_string + - user: saltstack_mq + - passwd: password + - vhost: rabbit2_vhost + - arguments: + - x-message-ttl: 8640000 + clustered: false + config: + listeners.tcp.1: 0.0.0.0:5673 + distport: 25673 + erlang_cookie: shared-secret + exchange: + my-new-exchange: + - user: saltstack_mq + - passwd: password + - type: fanout + - durable: true + - internal: false + - auto_delete: false + - vhost: rabbit2_vhost + - arguments: + - alternate-**exchange: amq.fanout + - test-header: testing + host: localhost + nodeport: 5673 + plugins: [] + policy: + my-new-rabbitmq-policy: + - name: HA + - pattern: ".*" + - definition: '{"ha-mode": "all"}' + queue: + my-new-queue: + arguments: + - x-message-ttl: 8640000 + - x-expires: 8640000 + - x-dead-letter-exchange: my-new-exchange + auto_delete: false + durable: true + passwd: password + user: saltstack_mq + vhost: rabbit2_vhost + remove_guest_user: true + service: true + upstream: + my-new-upstream1: + - uri: amqp://saltstack_mq:password@localhost + - trust_user_id: true + - ack_mode: on-confirm + - max_hops: 1 + user: rabbit2 + users: + airflow: + force: true + password: airflow + perms: + rabbit2_vhost: + - ".*" + - ".*" + - ".*" + tags: + - management + - administrator + saltstack_mq: + force: false + password: password + perms: + rabbit2_vhost: + - ".*" + - ".*" + - ".*" + tags: + - administrator + user1: + force: true + password: password + perms: + rabbit2_vhost: + - ".*" + - ".*" + - ".*" + tags: + - monitoring + - user + vhosts: + - rabbit2_vhost pkg: deps: - - libtinfo5 + - libtinfo5 name: rabbitmq-server use_upstream: repo - plugin: - rabbitmq_federation: - runas: root - rabbitmq_management: - runas: root - policy: - rabbitmq_policy: - - name: HA - - pattern: .* - - definition: '{"ha-mode": "all"}' - queue: - my-new-queue: - arguments: - - x-message-ttl: 8640000 - - x-expires: 8640000 - - x-dead-letter-exchange: my-new-exchange - auto_delete: false - durable: true - passwd: password - user: saltstack - vhost: test_vhost - remove_guest_user: true retry_option: attempts: 0 interval: 60 splay: 10 until: true rootgroup: root - service: - enabled: true - name: rabbitmq-server - running: true tofs: files_switch: - any/path/can/be/used/here @@ -111,44 +242,4 @@ values: source_files: rabbitmq-config-file-file-managed: - example.tmpl.jinja - upstream: - upstream_1: - - uri: amqp://saltstack:password@localhost - - trust_user_id: true - - ack_mode: on-confirm - - max_hops: 1 - user: - saltstack: - - password: password - - force: false - - tags: - - administrator - - perms: - - test_vhost: - - .* - - .* - - .* - - runas: root - user1: - - password: password - - force: true - - tags: monitoring, user - - perms: - - /: - - .* - - .* - - .* - - runas: root - user2: - - password: password - - force: true - - tags: monitoring, user - - perms: - - /: - - .* - - .* - - .* - - runas: root - vhost: - - test_vhost winner: pillar