salt.modules.rabbitmq

Module to provide RabbitMQ compatibility to Salt. Todo: A lot, need to add cluster support, logging, and minion configuration data.

salt.modules.rabbitmq.add_user(name, password=None, runas=None)

Add a rabbitMQ user via rabbitmqctl user_add <user> <password>

CLI 范例:

salt '*' rabbitmq.add_user rabbit_user password
salt.modules.rabbitmq.add_vhost(vhost, runas=None)

Adds a vhost via rabbitmqctl add_vhost.

CLI 范例:

salt '*' rabbitmq add_vhost '<vhost_name>'
salt.modules.rabbitmq.change_password(name, password, runas=None)

Changes a user's password.

CLI 范例:

salt '*' rabbitmq.change_password rabbit_user password
salt.modules.rabbitmq.check_password(name, password, runas=None)

2016.3.0 新版功能.

Checks if a user's password is valid.

CLI 范例:

salt '*' rabbitmq.check_password rabbit_user password
salt.modules.rabbitmq.clear_password(name, runas=None)

Removes a user's password.

CLI 范例:

salt '*' rabbitmq.clear_password rabbit_user
salt.modules.rabbitmq.cluster_status(runas=None)

return rabbitmq cluster_status

CLI 范例:

salt '*' rabbitmq.cluster_status
salt.modules.rabbitmq.delete_policy(vhost, name, runas=None)

Delete a policy based on rabbitmqctl clear_policy.

Reference: http://www.rabbitmq.com/ha.html

CLI 范例:

salt '*' rabbitmq.delete_policy / HA'
salt.modules.rabbitmq.delete_user(name, runas=None)

Deletes a user via rabbitmqctl delete_user.

CLI 范例:

salt '*' rabbitmq.delete_user rabbit_user
salt.modules.rabbitmq.delete_vhost(vhost, runas=None)

Deletes a vhost rabbitmqctl delete_vhost.

CLI 范例:

salt '*' rabbitmq.delete_vhost '<vhost_name>'
salt.modules.rabbitmq.disable_plugin(name, runas=None)

Disable a RabbitMQ plugin via the rabbitmq-plugins command.

CLI 范例:

salt '*' rabbitmq.disable_plugin foo
salt.modules.rabbitmq.enable_plugin(name, runas=None)

Enable a RabbitMQ plugin via the rabbitmq-plugins command.

CLI 范例:

salt '*' rabbitmq.enable_plugin foo
salt.modules.rabbitmq.force_reset(runas=None)

Forcefully Return a RabbitMQ node to its virgin state

CLI 范例:

salt '*' rabbitmq.force_reset
salt.modules.rabbitmq.join_cluster(host, user='rabbit', ram_node=None, runas=None)

Join a rabbit cluster

CLI 范例:

salt '*' rabbitmq.join_cluster 'rabbit.example.com' 'rabbit'
salt.modules.rabbitmq.list_permissions(vhost, runas=None)

Lists permissions for vhost via rabbitmqctl list_permissions

CLI 范例:

salt '*' rabbitmq.list_permissions '/myvhost'
salt.modules.rabbitmq.list_policies(vhost='/', runas=None)

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 范例:

salt '*' rabbitmq.list_policies'
salt.modules.rabbitmq.list_queues(runas=None, *args)

Returns queue details of the / virtual host

CLI 范例:

salt '*' rabbitmq.list_queues messages consumers
salt.modules.rabbitmq.list_queues_vhost(vhost, runas=None, *args)

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 范例:

salt '*' rabbitmq.list_queues messages consumers
salt.modules.rabbitmq.list_user_permissions(name, runas=None)

List permissions for a user via rabbitmqctl list_user_permissions

CLI 范例:

salt '*' rabbitmq.list_user_permissions 'user'.
salt.modules.rabbitmq.list_users(runas=None)

Return a list of users based off of rabbitmqctl user_list.

CLI 范例:

salt '*' rabbitmq.list_users
salt.modules.rabbitmq.list_vhosts(runas=None)

Return a list of vhost based on rabbitmqctl list_vhosts.

CLI 范例:

salt '*' rabbitmq.list_vhosts
salt.modules.rabbitmq.plugin_is_enabled(name, runas=None)

Return whether the plugin is enabled.

CLI 范例:

salt '*' rabbitmq.plugin_is_enabled foo
salt.modules.rabbitmq.policy_exists(vhost, name, runas=None)

Return whether the policy exists based on rabbitmqctl list_policies.

Reference: http://www.rabbitmq.com/ha.html

CLI 范例:

salt '*' rabbitmq.policy_exists / HA
salt.modules.rabbitmq.reset(runas=None)

Return a RabbitMQ node to its virgin state

CLI 范例:

salt '*' rabbitmq.reset
salt.modules.rabbitmq.set_permissions(vhost, user, conf='.*', write='.*', read='.*', runas=None)

Sets permissions for vhost via rabbitmqctl set_permissions

CLI 范例:

salt '*' rabbitmq.set_permissions 'myvhost' 'myuser'
salt.modules.rabbitmq.set_policy(vhost, name, pattern, definition, priority=None, runas=None)

Set a policy based on rabbitmqctl set_policy.

Reference: http://www.rabbitmq.com/ha.html

CLI 范例:

salt '*' rabbitmq.set_policy / HA '.*' '{"ha-mode":"all"}'
salt.modules.rabbitmq.set_user_tags(name, tags, runas=None)

Add user tags via rabbitmqctl set_user_tags

CLI 范例:

salt '*' rabbitmq.set_user_tags 'myadmin' 'administrator'
salt.modules.rabbitmq.start_app(runas=None)

Start the RabbitMQ application.

CLI 范例:

salt '*' rabbitmq.start_app
salt.modules.rabbitmq.status(runas=None)

return rabbitmq status

CLI 范例:

salt '*' rabbitmq.status
salt.modules.rabbitmq.stop_app(runas=None)

Stops the RabbitMQ application, leaving the Erlang node running.

CLI 范例:

salt '*' rabbitmq.stop_app
salt.modules.rabbitmq.user_exists(name, runas=None)

Return whether the user exists based on rabbitmqctl list_users.

CLI 范例:

salt '*' rabbitmq.user_exists rabbit_user
salt.modules.rabbitmq.vhost_exists(name, runas=None)

Return whether the vhost exists based on rabbitmqctl list_vhosts.

CLI 范例:

salt '*' rabbitmq.vhost_exists rabbit_host