Configure the rabbitmq ha policy in config file

Closes-Bug: #1580884
Change-Id: Ief5917d48dbf6abe4a5861e73b24d534b889bd52
This commit is contained in:
Jeffrey Zhang 2016-05-11 20:21:52 +08:00
parent c98e9c44f2
commit e7441a4212
4 changed files with 24 additions and 4 deletions

View File

@ -14,7 +14,7 @@
with_items:
- "rabbitmq"
- name: Copying over rabbitmq*.conf
- name: Copying over rabbitmq configs
template:
src: "{{ item }}.j2"
dest: "{{ node_config_directory }}/rabbitmq/{{ item }}"
@ -22,3 +22,4 @@
- "rabbitmq-env.conf"
- "rabbitmq.config"
- "rabbitmq-clusterer.config"
- "definitions.json"

View File

@ -0,0 +1,14 @@
{
"vhosts": [
{"name": "/"}
],
"users": [
{"name": "{{ rabbitmq_user }}", "password": "{{ rabbitmq_password }}", "tags": "administrator"}
],
"permissions": [
{"user": "{{ rabbitmq_user }}", "vhost": "/", "configure": ".*", "write": ".*", "read": ".*"}
],
"policies":[
{"vhost": "/", "name": "ha-all", "pattern": ".*", "apply-to": "all", "definition": {"ha-mode":"all"}, "priority":0}
]
}

View File

@ -8,15 +8,14 @@
{tcp_listeners, [
{"{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}", {{ rabbitmq_port }}}
]},
{default_user, <<"{{ rabbitmq_user }}">>},
{default_pass, <<"{{ rabbitmq_password }}">>},
{cluster_partition_handling, autoheal}
]},
{rabbitmq_management, [
{listener, [
{ip, "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}"},
{port, {{ rabbitmq_management_port }}}
]}
]},
{load_definitions, "/etc/rabbitmq/definitions.json"}
]},
{rabbitmq_clusterer, [{config, "/etc/rabbitmq/rabbitmq-clusterer.config"}]}
].

View File

@ -18,6 +18,12 @@
"dest": "/etc/rabbitmq/rabbitmq-clusterer.config",
"owner": "rabbitmq",
"perm": "0600"
},
{
"source": "{{ container_config_directory }}/definitions.json",
"dest": "/etc/rabbitmq/definitions.json",
"owner": "rabbitmq",
"perm": "0600"
}
]
}