Remove rabbitmq content (#13)

This content has been moved to:
https://github.com/ansible-collections/rabbitmq
This commit is contained in:
Jesse Pretorius 2020-03-17 09:01:39 +00:00 committed by GitHub
commit 5d47ab7096
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
54 changed files with 0 additions and 3854 deletions

View file

@ -1,6 +0,0 @@
destructive
shippable/posix/group1
skip/aix
skip/osx
skip/freebsd
skip/rhel

View file

@ -1,2 +0,0 @@
dependencies:
- setup_rabbitmq

View file

@ -1,3 +0,0 @@
---
- import_tasks: tests.yml
when: ansible_distribution == 'Ubuntu'

View file

@ -1,132 +0,0 @@
---
- name: Add test requisites
block:
- name: Add exchange
rabbitmq_exchange:
name: "{{ item }}"
type: direct
with_items:
- exchange-foo
- exchange-bar
- name: Add queue
rabbitmq_queue:
name: queue-foo
- name: Test add binding in check mode
block:
- name: Add binding
rabbitmq_binding:
source: exchange-foo
destination: queue-foo
type: queue
check_mode: true
register: add_binding
- name: Check that binding succeeds with a change
assert:
that:
- add_binding.changed == true
- name: Test add binding
block:
- name: Add binding
rabbitmq_binding:
source: exchange-foo
destination: queue-foo
type: queue
register: add_binding
- name: Check that binding succeeds with a change
assert:
that:
- add_binding.changed == true
- name: Test add binding idempotence
block:
- name: Add binding
rabbitmq_binding:
source: exchange-foo
destination: queue-foo
type: queue
register: add_binding
- name: Check that binding succeeds without a change
assert:
that:
- add_binding.changed == false
- name: Test remove binding in check mode
block:
- name: Remove binding
rabbitmq_binding:
source: exchange-foo
destination: queue-foo
type: queue
state: absent
check_mode: true
register: remove_binding
- name: Check that binding succeeds with a change
assert:
that:
- remove_binding.changed == true
- name: Test remove binding
block:
- name: Remove binding
rabbitmq_binding:
source: exchange-foo
destination: queue-foo
type: queue
state: absent
register: remove_binding
- name: Check that binding succeeds with a change
assert:
that:
- remove_binding.changed == true
- name: Test remove binding idempotence
block:
- name: Remove binding
rabbitmq_binding:
source: exchange-foo
destination: queue-foo
type: queue
state: absent
register: remove_binding
- name: Check that binding succeeds with a change
assert:
that:
- remove_binding.changed == false
- name: Test add exchange to exchange binding
block:
- name: Add binding
rabbitmq_binding:
source: exchange-foo
destination: exchange-bar
type: exchange
register: add_binding
- name: Check that binding succeeds with a change
assert:
that:
- add_binding.changed == true
- name: Test remove exchange to exchange binding
block:
- name: Remove binding
rabbitmq_binding:
source: exchange-foo
destination: exchange-bar
type: exchange
state: absent
register: remove_binding
- name: Check that binding succeeds with a change
assert:
that:
- remove_binding.changed == true

View file

@ -1,6 +0,0 @@
destructive
shippable/posix/group1
skip/aix
skip/osx
skip/freebsd
skip/rhel

View file

@ -1,2 +0,0 @@
dependencies:
- setup_rabbitmq

View file

@ -1,2 +0,0 @@
- import_tasks: tests.yml
when: ansible_distribution == 'Ubuntu'

View file

@ -1,71 +0,0 @@
- block:
- set_fact:
plugin_name: rabbitmq_top
- name: Enable plugin
rabbitmq_plugin:
name: "{{ plugin_name }}"
state: enabled
new_only: True
register: result
- name: Get rabbitmq-plugins output
shell: "rabbitmq-plugins list | grep {{ plugin_name }}"
register: cli_result
- name: Check that the plugin is enabled
assert:
that:
- result is changed
- result is success
- '"{{ plugin_name }}" in result.enabled'
- result.disabled == []
- '"[E" in cli_result.stdout'
- name: Enable plugin (idempotency)
rabbitmq_plugin:
name: "{{ plugin_name }}"
state: enabled
new_only: True
register: result
- name: Check idempotency
assert:
that:
- result is not changed
- name: Disable plugin
rabbitmq_plugin:
name: "{{ plugin_name }}"
state: disabled
register: result
- name: Get rabbitmq-plugins output
shell: "rabbitmq-plugins list | grep {{ plugin_name }}"
register: cli_result
- name: Check that the plugin is disabled
assert:
that:
- result is changed
- result is success
- result.enabled == []
- '"{{ plugin_name }}" in result.disabled'
- '"[E" not in cli_result.stdout'
- name: Disable plugin (idempotency)
rabbitmq_plugin:
name: "{{ plugin_name }}"
state: disabled
register: result
- name: Check idempotency
assert:
that:
- result is not changed
always:
- name: Disable plugin
rabbitmq_plugin:
name: "{{ plugin_name }}"
state: disabled

View file

@ -1,6 +0,0 @@
destructive
shippable/posix/group1
skip/aix
skip/osx
skip/freebsd
skip/rhel

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 B

View file

@ -1,3 +0,0 @@
dependencies:
- setup_rabbitmq
- setup_remote_tmp_dir

View file

@ -1,5 +0,0 @@
# Rabbitmq lookup
- include: ubuntu.yml
when:
- ansible_distribution == 'Ubuntu'
- ansible_distribution_release != 'trusty'

View file

@ -1,171 +0,0 @@
- name: Install requests and pika
pip:
name: requests,pika<1.0.0
state: present
- name: RabbitMQ basic publish test
rabbitmq_publish:
url: "amqp://guest:guest@localhost:5672/%2F"
queue: 'publish_test'
body: "Hello world from ansible module rabbitmq_publish"
content_type: "text/plain"
register: rabbit_basic_output1
- assert:
that:
- "rabbit_basic_output1 is not failed"
- "'publish_test' in rabbit_basic_output1.result.msg"
- "'publish_test' in rabbit_basic_output1.result.queue"
- "'text/plain' in rabbit_basic_output1.result.content_type"
# Testing random queue
- name: Publish to random queue
rabbitmq_publish:
url: "amqp://guest:guest@localhost:5672/%2F"
body: "RANDOM QUEUE POST"
content_type: "text/plain"
register: rabbit_random_queue_output
- assert:
that:
- "rabbit_random_queue_output is not failed"
- "'amq.gen' in rabbit_random_queue_output.result.msg"
- "'amq.gen' in rabbit_random_queue_output.result.queue"
- "'text/plain' in rabbit_random_queue_output.result.content_type"
- name: Copy binary to remote
copy:
src: "{{ role_path }}/files/image.gif"
dest: "{{ remote_tmp_dir }}/image.gif"
- name: Publish binary to a queue
rabbitmq_publish:
url: "amqp://guest:guest@localhost:5672/%2F"
queue: publish_test
src: "{{ remote_tmp_dir }}/image.gif"
register: rabbitmq_publish_file
- assert:
that:
- "rabbitmq_publish_file is not failed"
- "'publish_test' in rabbitmq_publish_file.result.queue"
- "'image/gif' in rabbitmq_publish_file.result.content_type"
- name: Raise error for src and body defined
rabbitmq_publish:
url: "amqp://guest:guest@localhost:5672/%2F"
queue: 'publish_test'
src: "{{ remote_tmp_dir }}/image.gif"
body: blah
register: rabbit_basic_fail_output1
ignore_errors: yes
- assert:
that:
- "rabbit_basic_fail_output1 is failed"
- "'parameters are mutually exclusive' in rabbit_basic_fail_output1.msg"
- name: Publish a file that does not exist
rabbitmq_publish:
url: "amqp://guest:guest@localhost:5672/%2F"
queue: 'publish_test'
src: 'aaaaaaajax-loader.gif'
register: file_missing_fail
ignore_errors: yes
- assert:
that:
- "file_missing_fail is failed"
- "'Unable to open file' in file_missing_fail.msg"
- name: Publish with proto/host/port/user/pass
rabbitmq_publish:
proto: amqp
host: localhost
port: 5672
username: guest
password: guest
vhost: '%2F'
queue: publish_test
body: Testing with proto/host/port/username/password/vhost
register: host_port_output
- assert:
that:
- "host_port_output is not failed"
- name: Publish with host/port/user but missing proto
rabbitmq_publish:
host: localhost
port: 5672
username: guest
password: guest
vhost: '%2F'
queue: publish_test
body: Testing with proto/host/port/username/password/vhost
ignore_errors: yes
register: host_port_missing_proto_output
- assert:
that:
- "host_port_missing_proto_output is failed"
- "'Connection parameters must be passed via' in host_port_missing_proto_output.msg"
- name: Publish with proto/host/port/user and url
rabbitmq_publish:
url: "amqp://guest:guest@localhost:5672/%2F"
proto: amqp
host: localhost
port: 5672
username: guest
password: guest
vhost: '%2F'
queue: publish_test
body: Testing with proto/host/port/username/password/vhost
ignore_errors: yes
register: host_and_url_output
- assert:
that:
- "host_and_url_output is failed"
- "'cannot be specified at the same time' in host_and_url_output.msg"
- name: Publish headers to queue
rabbitmq_publish:
url: "amqp://guest:guest@localhost:5672/%2F"
queue: 'publish_test'
body: blah
headers:
myHeader: Value1
secondHeader: Value2
register: test_headers1
ignore_errors: yes
- name: Publish headers with file
rabbitmq_publish:
url: "amqp://guest:guest@localhost:5672/%2F"
queue: 'publish_test'
src: "{{ remote_tmp_dir }}/image.gif"
headers:
myHeader: Value1
secondHeader: Value2
register: test_headers2
ignore_errors: yes
- name: Collect all messages off the publish queue
set_fact:
messages: "{{ lookup('rabbitmq', url='amqp://guest:guest@localhost:5672/%2F', queue='publish_test') }}"
- name: Check contents of published messages
assert:
that:
- messages|length == 5
- "'Hello world from ansible module rabbitmq_publish' in messages[0]['msg']"
- "'text/plain' in messages[0]['content_type']"
- "'image/gif' in messages[1]['content_type']"
- "'image.gif' in messages[1]['headers']['filename']"
- "'Testing with proto/host/port/username/password/vhost' in messages[2]['msg']"
# - messages[3]['headers']['myHeader'] is defined
# - messages[4]['headers']['filename'] is defined
# - messages[4]['headers']['secondHeader'] is defined

View file

@ -1,6 +0,0 @@
destructive
shippable/posix/group1
skip/aix
skip/osx
skip/freebsd
skip/rhel

View file

@ -1,2 +0,0 @@
dependencies:
- setup_rabbitmq

View file

@ -1,10 +0,0 @@
---
- when: ansible_distribution == 'Ubuntu'
block:
- import_tasks: tests.yml
- import_tasks: tests.yml
environment:
RABBITMQ_NODENAME: test

View file

@ -1,137 +0,0 @@
---
- name: Test add user in check mode
block:
- name: Add user
rabbitmq_user: user=joe password=changeme
check_mode: true
register: add_user
- name: Check that user adding succeeds with a change
assert:
that:
- add_user.changed == true
- name: Test add user
block:
- name: Add user
rabbitmq_user: user=joe password=changeme
register: add_user
- name: Check that user adding succeeds with a change
assert:
that:
- add_user.changed == true
- name: Test add user idempotence
block:
- name: Add user
rabbitmq_user: user=joe password=changeme
register: add_user
- name: Check that user adding succeeds without a change
assert:
that:
- add_user.changed == false
- name: Test change user permissions in check mode
block:
- name: Add user with permissions
rabbitmq_user: user=joe password=changeme vhost=/ configure_priv=.* read_priv=.* write_priv=.*
check_mode: true
register: add_user
- name: Check that changing permissions succeeds with a change
assert:
that:
- add_user.changed == true
- name: Test change user permissions
block:
- name: Add user with permissions
rabbitmq_user: user=joe password=changeme vhost=/ configure_priv=.* read_priv=.* write_priv=.*
register: add_user
- name: Check that changing permissions succeeds with a change
assert:
that:
- add_user.changed == true
- name: Test change user permissions idempotence
block:
- name: Add user with permissions
rabbitmq_user: user=joe password=changeme vhost=/ configure_priv=.* read_priv=.* write_priv=.*
register: add_user
- name: Check that changing permissions succeeds without a change
assert:
that:
- add_user.changed == false
- name: Test add user tags in check mode
block:
- name: Add user with tags
rabbitmq_user: user=joe password=changeme vhost=/ configure_priv=.* read_priv=.* write_priv=.* tags=management,administrator
check_mode: true
register: add_user
- name: Check that adding tags succeeds with a change
assert:
that:
- add_user.changed == true
- name: Test add user tags
block:
- name: Add user with tags
rabbitmq_user: user=joe password=changeme vhost=/ configure_priv=.* read_priv=.* write_priv=.* tags=management,administrator
register: add_user
- name: Check that adding tags succeeds with a change
assert:
that:
- add_user.changed == true
- name: Test add user tags idempotence
block:
- name: Add user with tags
rabbitmq_user: user=joe password=changeme vhost=/ configure_priv=.* read_priv=.* write_priv=.* tags=administrator,management
register: add_user
- name: Check that adding tags succeeds without a change
assert:
that:
- add_user.changed == false
- name: Test remove user in check mode
block:
- name: Remove user
rabbitmq_user: user=joe state=absent
check_mode: true
register: remove_user
- name: Check that user removing succeeds with a change
assert:
that:
- remove_user.changed == true
- name: Test remove user
block:
- name: Remove user
rabbitmq_user: user=joe state=absent
register: remove_user
- name: Check that user removing succeeds with a change
assert:
that:
- remove_user.changed == true
- name: Test remove user idempotence
block:
- name: Remove user
rabbitmq_user: user=joe state=absent
register: remove_user
- name: Check that user removing succeeds without a change
assert:
that:
- remove_user.changed == false

View file

@ -1,6 +0,0 @@
destructive
shippable/posix/group1
skip/aix
skip/osx
skip/freebsd
skip/rhel

View file

@ -1,2 +0,0 @@
dependencies:
- setup_rabbitmq

View file

@ -1,2 +0,0 @@
- import_tasks: tests.yml
when: ansible_distribution == 'Ubuntu'

View file

@ -1,121 +0,0 @@
- block:
- set_fact:
vhost_name: /test
- name: Add host
rabbitmq_vhost:
name: "{{ vhost_name }}"
state: present
register: result
- name: Check that the host was created successfuly
shell: "rabbitmqctl list_vhosts name tracing | grep {{ vhost_name }}"
register: ctl_result
- name: Check that the host is added
assert:
that:
- result is changed
- result is success
- '"false" in ctl_result.stdout' # value for tracing, false is disabled
- name: Add host (idempotency)
rabbitmq_vhost:
name: "{{ vhost_name }}"
state: present
register: result
- name: Check idempotency
assert:
that:
- result is not changed
- name: Enable tracing
rabbitmq_vhost:
name: "{{ vhost_name }}"
tracing: yes
register: result
- name: Get rabbitmqctl output
shell: "rabbitmqctl list_vhosts name tracing | grep {{ vhost_name }}"
register: ctl_result
- name: Check that tracing is enabled
assert:
that:
- result is changed
- result is success
- '"true" in ctl_result.stdout' # value for tracing, true is enabled
- name: Enable tracing (idempotency)
rabbitmq_vhost:
name: "{{ vhost_name }}"
tracing: yes
register: result
- name: Check idempotency
assert:
that:
- result is not changed
- name: Disable tracing
rabbitmq_vhost:
name: "{{ vhost_name }}"
tracing: no
register: result
- name: Get rabbitmqctl output
shell: "rabbitmqctl list_vhosts name tracing | grep {{ vhost_name }}"
register: ctl_result
- name: Check that tracing is disabled
assert:
that:
- result is changed
- result is success
- '"false" in ctl_result.stdout' # value for tracing, false is disabled
- name: Disable tracing (idempotency)
rabbitmq_vhost:
name: "{{ vhost_name }}"
tracing: no
register: result
- name: Check idempotency
assert:
that:
- result is not changed
- name: Remove host
rabbitmq_vhost:
name: "{{ vhost_name }}"
state: absent
register: result
- name: Get rabbitmqctl output
shell: "rabbitmqctl list_vhosts name tracing | grep {{ vhost_name }}"
register: ctl_result
failed_when: ctl_result.rc == 0
- name: Check that the host is removed
assert:
that:
- result is changed
- result is success
- name: Remove host (idempotency)
rabbitmq_vhost:
name: "{{ vhost_name }}"
state: absent
register: result
- name: Check idempotency
assert:
that:
- result is not changed
always:
- name: Remove host
rabbitmq_vhost:
name: "{{ vhost_name }}"
state: absent

View file

@ -1,6 +0,0 @@
destructive
shippable/posix/group1
skip/aix
skip/osx
skip/freebsd
skip/rhel

View file

@ -1,2 +0,0 @@
dependencies:
- setup_rabbitmq

View file

@ -1,5 +0,0 @@
# Rabbitmq lookup
- include: ubuntu.yml
when:
- ansible_distribution == 'Ubuntu'
- ansible_distribution_release != 'trusty'

View file

@ -1,163 +0,0 @@
---
- name: Test setting virtual host limits in check mode
block:
- name: Set virtual host limits in check mode
rabbitmq_vhost_limits:
vhost: /
max_connections: 64
max_queues: 256
state: present
check_mode: true
register: module_result
- name: Check that the module's result is correct
assert:
that:
- module_result is changed
- module_result is success
- name: Get a list of configured virtual host limits
shell: "rabbitmqctl list_vhost_limits"
register: shell_result
- name: Check that the check mode does not make any changes
assert:
that:
- shell_result is success
- "'\"max-connections\":64' not in shell_result.stdout"
- "'\"max-queues\":256' not in shell_result.stdout"
- name: Test setting virtual host limits
block:
- name: Set virtual host limits
rabbitmq_vhost_limits:
vhost: /
max_connections: 64
max_queues: 256
state: present
register: module_result
- name: Check that the module's result is correct
assert:
that:
- module_result is changed
- module_result is success
- name: Get a list of configured virtual host limits
shell: "rabbitmqctl list_vhost_limits"
register: shell_result
- name: Check that the virtual host limits are actually set
assert:
that:
- shell_result is success
- "'\"max-connections\":64' in shell_result.stdout"
- "'\"max-queues\":256' in shell_result.stdout"
- name: Test setting virtual host limits (idempotence)
block:
- name: Set virtual host limits (idempotence)
rabbitmq_vhost_limits:
vhost: /
max_connections: 64
max_queues: 256
state: present
register: module_result
- name: Check the idempotence
assert:
that:
- module_result is not changed
- module_result is success
- name: Test changing virtual host limits
block:
- name: Change virtual host limits
rabbitmq_vhost_limits:
vhost: /
max_connections: 32
state: present
register: module_result
- name: Check that the module's result is correct
assert:
that:
- module_result is changed
- module_result is success
- name: Get a list of configured virtual host limits
shell: "rabbitmqctl list_vhost_limits"
register: shell_result
- name: Check that the virtual host limits are actually set
assert:
that:
- shell_result is success
- "'\"max-connections\":32' in shell_result.stdout"
- "'\"max-queues\":-1' in shell_result.stdout"
- name: Test clearing virtual host limits in check mode
block:
- name: Clear virtual host limits in check mode
rabbitmq_vhost_limits:
vhost: /
state: absent
check_mode: true
register: module_result
- name: Check that the module's result is correct
assert:
that:
- module_result is changed
- module_result is success
- name: Get a list of configured virtual host limits
shell: "rabbitmqctl list_vhost_limits"
register: shell_result
- name: Check that the check mode does not make any changes
assert:
that:
- shell_result is success
- "'\"max-connections\":32' in shell_result.stdout"
- "'\"max-queues\":-1' in shell_result.stdout"
- name: Test clearing virtual host limits
block:
- name: Clear virtual host limits
rabbitmq_vhost_limits:
vhost: /
state: absent
register: module_result
- name: Check that the module's result is correct
assert:
that:
- module_result is changed
- module_result is success
- name: Get a list of configured virtual host limits
shell: "rabbitmqctl list_vhost_limits"
register: shell_result
- name: Check that the virtual host limits are actually cleared
assert:
that:
- shell_result is success
- "'\"max-connections\":' not in shell_result.stdout"
- "'\"max-queues\":' not in shell_result.stdout"
- name: Test clearing virtual host limits (idempotence)
block:
- name: Clear virtual host limits (idempotence)
rabbitmq_vhost_limits:
vhost: /
state: absent
register: module_result
- name: Check the idempotence
assert:
that:
- module_result is not changed
- module_result is success

View file

@ -1,8 +0,0 @@
listeners.ssl.default = 5671
ssl_options.cacertfile = /tls/ca_certificate.pem
ssl_options.certfile = /tls/server_certificate.pem
ssl_options.keyfile = /tls/server_key.pem
ssl_options.password = bunnies
ssl_options.verify = verify_peer
ssl_options.fail_if_no_peer_cert = false