-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from gaima8/no-ha
Separate the creation of exchange(s), queue(s), and binding(s) from HA policies
- Loading branch information
Showing
4 changed files
with
50 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
- name: rabbitmq_config | checking if rabbitmqadmin is installed | ||
stat: | ||
path: /usr/sbin/rabbitmqadmin | ||
register: rabbitmqadmin_check | ||
|
||
- name: rabbit_config | Installing rabbitMQ admin | ||
get_url: | ||
url: http://guest:guest@localhost:15672/cli/rabbitmqadmin | ||
dest: /usr/sbin/rabbitmqadmin | ||
mode: u=rwx,g=rw,o=rw | ||
become: true | ||
notify: restart rabbitmq-server | ||
when: not rabbitmqadmin_check['stat']['exists'] | ||
|
||
- name: rabbitmq_config | creating exchange(s) | ||
command: rabbitmqadmin declare exchange name={{ item['exchange_name'] }} type={{ item['type'] }} --vhost={{ item['vhost'] | default('/') }} | ||
run_once: true | ||
delegate_to: "{{ rabbitmq_master }}" | ||
become: true | ||
with_items: "{{ rabbitmq_config }}" | ||
when: item['exchange_name'] is defined | ||
|
||
- name: rabbitmq_config | creating queue(s) | ||
command: rabbitmqadmin declare queue name={{ item['queue_name'] }} durable={{ item['durable']|lower }} --vhost={{ item['vhost'] | default('/') }} queue_type={{ item['queue_type'] | default('classic') }} | ||
run_once: true | ||
delegate_to: "{{ rabbitmq_master }}" | ||
become: true | ||
when: | ||
- item['queue_name'] is defined | ||
with_items: "{{ rabbitmq_config }}" | ||
|
||
- include: rabbitmq_ha_config.yml | ||
when: rabbitmq_config_ha | ||
|
||
- name: rabbitmq_config | creating binding(s) | ||
command: rabbitmqadmin declare binding source={{ item['exchange_name'] }} destination_type="queue" destination={{ item['queue_name'] }} routing_key={{ item['routing_key'] }} --vhost={{ item['vhost'] | default('/') }} # noqa 204 | ||
run_once: true | ||
delegate_to: "{{ rabbitmq_master }}" | ||
become: true | ||
with_items: "{{ rabbitmq_config }}" | ||
when: item['exchange_name'] is defined and item['queue_name'] is defined |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters