Module to provide RabbitMQ compatibility to Salt. Todo: A lot, need to add cluster support, logging, and minion configuration data.
Add a rabbitMQ user via rabbitmqctl user_add <user> <password>
CLI Example:
salt '*' rabbitmq.add_user rabbit_user password
Adds a vhost via rabbitmqctl add_vhost.
CLI Example:
salt '*' rabbitmq add_vhost '<vhost_name>'
Changes a user's password.
CLI Example:
salt '*' rabbitmq.change_password rabbit_user password
New in version 2016.3.0.
Checks if a user's password is valid.
CLI Example:
salt '*' rabbitmq.check_password rabbit_user password
Removes a user's password.
CLI Example:
salt '*' rabbitmq.clear_password rabbit_user
return rabbitmq cluster_status
CLI Example:
salt '*' rabbitmq.cluster_status
Delete a policy based on rabbitmqctl clear_policy.
Reference: http://www.rabbitmq.com/ha.html
CLI Example:
salt '*' rabbitmq.delete_policy / HA
Deletes an upstream via rabbitmqctl clear_parameter.
CLI Example:
salt '*' rabbitmq.delete_upstream upstream_name
New in version 3000.
Deletes a user via rabbitmqctl delete_user.
CLI Example:
salt '*' rabbitmq.delete_user rabbit_user
Deletes a vhost rabbitmqctl delete_vhost.
CLI Example:
salt '*' rabbitmq.delete_vhost '<vhost_name>'
Disable a RabbitMQ plugin via the rabbitmq-plugins command.
CLI Example:
salt '*' rabbitmq.disable_plugin foo
Enable a RabbitMQ plugin via the rabbitmq-plugins command.
CLI Example:
salt '*' rabbitmq.enable_plugin foo
Forcefully Return a RabbitMQ node to its virgin state
CLI Example:
salt '*' rabbitmq.force_reset
Join a rabbit cluster
CLI Example:
salt '*' rabbitmq.join_cluster rabbit.example.com rabbit
Returns a list of the names of all available plugins (enabled and disabled).
CLI Example:
salt '*' rabbitmq.list_available_plugins
Returns a list of the names of the enabled plugins.
CLI Example:
salt '*' rabbitmq.list_enabled_plugins
Lists permissions for vhost via rabbitmqctl list_permissions
CLI Example:
salt '*' rabbitmq.list_permissions /myvhost
Return a dictionary of policies nested by vhost and name based on the data returned from rabbitmqctl list_policies.
Reference: http://www.rabbitmq.com/ha.html
CLI Example:
salt '*' rabbitmq.list_policies
Returns queue details of the / virtual host
CLI Example:
salt '*' rabbitmq.list_queues messages consumers
Returns queue details of specified virtual host. This command will consider
first parameter as the vhost name and rest will be treated as
queueinfoitem. For getting details on vhost /
, use list_queues
instead).
CLI Example:
salt '*' rabbitmq.list_queues messages consumers
Returns a dict of upstreams based on rabbitmqctl list_parameters.
runas (str) -- The name of the user to run this command as.
CLI Example:
salt '*' rabbitmq.list_upstreams
New in version 3000.
List permissions for a user via rabbitmqctl list_user_permissions
CLI Example:
salt '*' rabbitmq.list_user_permissions user
Return a list of users based off of rabbitmqctl user_list.
CLI Example:
salt '*' rabbitmq.list_users
Return a list of vhost based on rabbitmqctl list_vhosts.
CLI Example:
salt '*' rabbitmq.list_vhosts
Return whether the plugin is enabled.
CLI Example:
salt '*' rabbitmq.plugin_is_enabled rabbitmq_plugin_name
Return whether the policy exists based on rabbitmqctl list_policies.
Reference: http://www.rabbitmq.com/ha.html
CLI Example:
salt '*' rabbitmq.policy_exists / HA
Return a RabbitMQ node to its virgin state
CLI Example:
salt '*' rabbitmq.reset
Sets permissions for vhost via rabbitmqctl set_permissions
CLI Example:
salt '*' rabbitmq.set_permissions myvhost myuser
Set a policy based on rabbitmqctl set_policy.
Reference: http://www.rabbitmq.com/ha.html
CLI Example:
salt '*' rabbitmq.set_policy / HA '.*' '{"ha-mode":"all"}'
Configures an upstream via rabbitmqctl set_parameter. This can be an exchange-upstream, a queue-upstream or both.
name (str) -- The name of the upstream to configure.
The following parameters apply to federated exchanges and federated queues:
uri (str) -- The AMQP URI(s) for the upstream.
prefetch_count (int) -- The maximum number of unacknowledged messages copied over a link at any one time. Default: 1000
reconnect_delay (int) -- The duration (in seconds) to wait before reconnecting to the broker after being disconnected. Default: 1
ack_mode (str) -- Determines how the link should acknowledge messages.
If set to on-confirm
(the default), messages are acknowledged to the
upstream broker after they have been confirmed downstream. This handles
network errors and broker failures without losing messages, and is the
slowest option.
If set to on-publish
, messages are acknowledged to the upstream broker
after they have been published downstream. This handles network errors
without losing messages, but may lose messages in the event of broker failures.
If set to no-ack
, message acknowledgements are not used. This is the
fastest option, but may lose messages in the event of network or broker failures.
trust_user_id (bool) -- Determines how federation should interact with the validated user-id feature. If set to true, federation will pass through any validated user-id from the upstream, even though it cannot validate it itself. If set to false or not set, it will clear any validated user-id it encounters. You should only set this to true if you trust the upstream server (and by extension, all its upstreams) not to forge user-ids.
The following parameters apply to federated exchanges only:
exchange (str) -- The name of the upstream exchange. Default is to use the same name as the federated exchange.
max_hops (int) -- The maximum number of federation links that a message published to a federated exchange can traverse before it is discarded. Default is 1. Note that even if max-hops is set to a value greater than 1, messages will never visit the same node twice due to travelling in a loop. However, messages may still be duplicated if it is possible for them to travel from the source to the destination via multiple routes.
expires (int) -- The expiry time (in milliseconds) after which an upstream queue for a federated exchange may be deleted, if a connection to the upstream broker is lost. The default is 'none', meaning the queue should never expire. This setting controls how long the upstream queue will last before it is eligible for deletion if the connection is lost. This value is used to set the "x-expires" argument for the upstream queue.
message_ttl (int) -- The expiry time for messages in the upstream queue
for a federated exchange (see expires), in milliseconds. Default is None
,
meaning messages should never expire. This does not apply to federated queues.
This value is used to set the "x-message-ttl" argument for the upstream queue.
ha_policy (str) -- Determines the "x-ha-policy" argument for the upstream
queue for a federated exchange (see expires). This is only of interest
when connecting to old brokers which determine queue HA mode using this
argument. Default is None
, meaning the queue is not HA.
The following parameter applies to federated queues only:
CLI Example:
salt '*' rabbitmq.set_upstream upstream_name ack_mode=on-confirm max_hops=1 trust_user_id=True uri=amqp://hostname
New in version 3000.
Add user tags via rabbitmqctl set_user_tags
CLI Example:
salt '*' rabbitmq.set_user_tags myadmin administrator
Start the RabbitMQ application.
CLI Example:
salt '*' rabbitmq.start_app
return rabbitmq status
CLI Example:
salt '*' rabbitmq.status
Stops the RabbitMQ application, leaving the Erlang node running.
CLI Example:
salt '*' rabbitmq.stop_app
Return whether the upstreamexists based on rabbitmqctl list_parameters.
CLI Example:
salt '*' rabbitmq.upstream_exists rabbit_upstream
New in version 3000.
Return whether the user exists based on rabbitmqctl list_users.
CLI Example:
salt '*' rabbitmq.user_exists rabbit_user
Return whether the vhost exists based on rabbitmqctl list_vhosts.
CLI Example:
salt '*' rabbitmq.vhost_exists rabbit_host