Native YAML - messaging (#3599)

This commit is contained in:
Fabio Alessandro Locati 2016-12-01 13:59:53 +00:00 committed by Matt Clay
parent 5209969a7c
commit 8a6df38cc5
8 changed files with 60 additions and 26 deletions

View file

@ -94,10 +94,18 @@ options:
EXAMPLES = ''' EXAMPLES = '''
# Bind myQueue to directExchange with routing key info # Bind myQueue to directExchange with routing key info
- rabbitmq_binding: name=directExchange destination=myQueue type=queue routing_key=info - rabbitmq_binding:
name: directExchange
destination: myQueue
type: queue
routing_key: info
# Bind directExchange to topicExchange with routing key *.info # Bind directExchange to topicExchange with routing key *.info
- rabbitmq_binding: name=topicExchange destination=topicExchange type=exchange routing_key="*.info" - rabbitmq_binding:
name: topicExchange
destination: topicExchange
type: exchange
routing_key: *.info
''' '''
import requests import requests

View file

@ -80,10 +80,14 @@ options:
EXAMPLES = ''' EXAMPLES = '''
# Create direct exchange # Create direct exchange
- rabbitmq_exchange: name=directExchange - rabbitmq_exchange:
name: directExchange
# Create topic exchange on vhost # Create topic exchange on vhost
- rabbitmq_exchange: name=topicExchange type=topic vhost=myVhost - rabbitmq_exchange:
name: topicExchange
type: topic
vhost: myVhost
''' '''
import requests import requests

View file

@ -63,10 +63,11 @@ options:
EXAMPLES = """ EXAMPLES = """
# Set the federation parameter 'local_username' to a value of 'guest' (in quotes) # Set the federation parameter 'local_username' to a value of 'guest' (in quotes)
- rabbitmq_parameter: component=federation - rabbitmq_parameter:
name=local-username component: federation
value='"guest"' name: local-username
state=present value: '"guest"'
state: present
""" """
class RabbitMqParameter(object): class RabbitMqParameter(object):

View file

@ -56,7 +56,9 @@ options:
EXAMPLES = ''' EXAMPLES = '''
# Enables the rabbitmq_management plugin # Enables the rabbitmq_management plugin
- rabbitmq_plugin: names=rabbitmq_management state=enabled - rabbitmq_plugin:
names: rabbitmq_management
state: enabled
''' '''
import os import os

View file

@ -74,13 +74,19 @@ options:
EXAMPLES = ''' EXAMPLES = '''
- name: ensure the default vhost contains the HA policy via a dict - name: ensure the default vhost contains the HA policy via a dict
rabbitmq_policy: name=HA pattern='.*' rabbitmq_policy:
name: HA
pattern: .*
args: args:
tags: tags:
"ha-mode": all ha-mode: all
- name: ensure the default vhost contains the HA policy - name: ensure the default vhost contains the HA policy
rabbitmq_policy: name=HA pattern='.*' tags="ha-mode=all" rabbitmq_policy:
name: HA
pattern: .*
tags:
- ha-mode: all
''' '''
class RabbitMqPolicy(object): class RabbitMqPolicy(object):
def __init__(self, module, name): def __init__(self, module, name):

View file

@ -94,10 +94,15 @@ options:
EXAMPLES = ''' EXAMPLES = '''
# Create a queue # Create a queue
- rabbitmq_queue: name=myQueue - rabbitmq_queue:
name: myQueue
# Create a queue on remote host # Create a queue on remote host
- rabbitmq_queue: name=myRemoteQueue login_user=user login_password=secret login_host=remote.example.org - rabbitmq_queue:
name: myRemoteQueue
login_user: user
login_password: secret
login_host: remote.example.org
''' '''
import requests import requests

View file

@ -107,20 +107,26 @@ options:
EXAMPLES = ''' EXAMPLES = '''
# Add user to server and assign full access control on / vhost. # Add user to server and assign full access control on / vhost.
# The user might have permission rules for other vhost but you don't care. # The user might have permission rules for other vhost but you don't care.
- rabbitmq_user: user=joe - rabbitmq_user:
password=changeme user: joe
vhost=/ password: changeme
configure_priv=.* vhost: /
read_priv=.* configure_priv: .*
write_priv=.* read_priv: .*
state=present write_priv: .*
state: present
# Add user to server and assign full access control on / vhost. # Add user to server and assign full access control on / vhost.
# The user doesn't have permission rules for other vhosts # The user doesn't have permission rules for other vhosts
- rabbitmq_user: user=joe - rabbitmq_user:
password=changeme user: joe
permissions=[{vhost='/', configure_priv='.*', read_priv='.*', write_priv='.*'}] password: changeme
state=present permissions:
- vhost: /
configure_priv: .*
read_priv: .*
write_priv: .*
state: present
''' '''
class RabbitMqUser(object): class RabbitMqUser(object):

View file

@ -55,7 +55,9 @@ options:
EXAMPLES = ''' EXAMPLES = '''
# Ensure that the vhost /test exists. # Ensure that the vhost /test exists.
- rabbitmq_vhost: name=/test state=present - rabbitmq_vhost:
name: /test
state: present
''' '''
class RabbitMqVhost(object): class RabbitMqVhost(object):