Merge "Make rabbitmq inventory group configurable"

This commit is contained in:
Jenkins 2016-07-15 15:59:55 +00:00 committed by Gerrit Code Review
commit 50f23a5b60
10 changed files with 24 additions and 13 deletions

View File

@ -16,7 +16,10 @@
## APT Cache Options
cache_timeout: 600
rabbitmq_primary_cluster_node: "{{ hostvars[groups['rabbitmq_all'][0]]['ansible_hostname'] }}"
# Inventory group containing the hosts for the cluster
rabbitmq_host_group: "rabbitmq_all"
rabbitmq_primary_cluster_node: "{{ hostvars[groups[rabbitmq_host_group][0]]['ansible_hostname'] }}"
# Upgrading the RabbitMQ package requires shutting down the cluster. This variable makes upgrading
# the version an explicit action.

View File

@ -0,0 +1,7 @@
---
features:
- The ``rabbitmq_server`` now supports a configurable inventory
host group. Deployers can override the ``rabbitmq_host_group`` variable
if they wish to use the role to create additional RabbitMQ clusters
on a custom host group.

View File

@ -56,7 +56,7 @@
rabbitmq_user:
user: guest
state: absent
when: inventory_hostname == groups['rabbitmq_all'][0]
when: inventory_hostname == groups[rabbitmq_host_group][0]
tags:
- rabbitmq-user
@ -64,6 +64,6 @@
rabbitmq_user:
user: guest
state: absent
when: inventory_hostname != groups['rabbitmq_all'][0]
when: inventory_hostname != groups[rabbitmq_host_group][0]
tags:
- rabbitmq-user

View File

@ -45,7 +45,7 @@
dest: /etc/hosts
state: present
line: "{{ hostvars[item]['ansible_ssh_host'] }} {{ hostvars[item]['ansible_hostname'] }} {{ hostvars[item]['ansible_hostname'].split('.')[0] }}"
with_items: "{{ groups['rabbitmq_all'] }}"
with_items: "{{ groups[rabbitmq_host_group] }}"
tags:
- rabbitmq-config

View File

@ -16,7 +16,7 @@
- name: Distribute self signed ssl key
copy:
dest: "{{ rabbitmq_ssl_key }}"
content: "{{ hostvars[groups['rabbitmq_all'][0]]['rabbitmq_ssl_key_fact'] | b64decode }}"
content: "{{ hostvars[groups[rabbitmq_host_group][0]]['rabbitmq_ssl_key_fact'] | b64decode }}"
owner: "rabbitmq"
group: "rabbitmq"
mode: "0640"
@ -26,7 +26,7 @@
- name: Distribute self signed ssl cert
copy:
dest: "{{ rabbitmq_ssl_cert }}"
content: "{{ hostvars[groups['rabbitmq_all'][0]]['rabbitmq_ssl_cert_fact'] | b64decode }}"
content: "{{ hostvars[groups[rabbitmq_host_group][0]]['rabbitmq_ssl_cert_fact'] | b64decode }}"
owner: "rabbitmq"
group: "rabbitmq"
mode: "0640"

View File

@ -17,12 +17,12 @@
# RabbitMQ container.
- include: rabbitmq_ssl_key_create.yml
when: >
inventory_hostname == groups['rabbitmq_all'][0]
inventory_hostname == groups[rabbitmq_host_group][0]
- include: rabbitmq_ssl_key_store.yml
when: >
inventory_hostname == groups['rabbitmq_all'][0]
inventory_hostname == groups[rabbitmq_host_group][0]
- include: rabbitmq_ssl_key_distribute.yml
when: >
inventory_hostname != groups['rabbitmq_all'][0]
inventory_hostname != groups[rabbitmq_host_group][0]

View File

@ -4,10 +4,10 @@ container1 ansible_ssh_host=10.100.100.101 ansible_host=10.100.100.101 ansible_b
container2 ansible_ssh_host=10.100.100.102 ansible_host=10.100.100.102 ansible_become=True ansible_user=root
container3 ansible_ssh_host=10.100.100.103 ansible_host=10.100.100.103 ansible_become=True ansible_user=root
[rabbitmq_all]
[rabbitmq_all_other]
container1
container2
container3
[all_containers:children]
rabbitmq_all
rabbitmq_all_other

View File

@ -16,7 +16,7 @@
# NOTE(mancdaz): rabbitmq cannot be upgraded in serial, so when
# rabbitmq_upgrade=True, serial is set to 0, else it is 1 for installs
- name: Install RabbitMQ server
hosts: rabbitmq_all
hosts: "{{ rabbitmq_host_group }}"
serial: "{{ rabbitmq_upgrade|default(false) | bool | ternary(0, 1)}}"
user: root
gather_facts: true

View File

@ -14,7 +14,7 @@
# limitations under the License.
- name: Run functional tests
hosts: rabbitmq_all
hosts: "{{ rabbitmq_host_group }}"
user: root
gather_facts: true
vars_files:

View File

@ -1,3 +1,4 @@
rabbitmq_host_group: "rabbitmq_all_other"
rabbitmq_cookie_token: secrete
rabbitmq_ssl_cert: /etc/rabbitmq/rabbitmq.pem
rabbitmq_ssl_key: /etc/rabbitmq/rabbitmq.key