diff --git a/defaults/main.yml b/defaults/main.yml index 046ae1f6..601e40a5 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -47,6 +47,10 @@ glance_enable_v1_registry: True glance_enable_v2_api: True glance_enable_v2_registry: True +## RabbitMQ info +glance_rabbitmq_userid: glance +glance_rabbitmq_vhost: /glance + ## DB info glance_galera_database: glance glance_galera_user: glance diff --git a/tasks/glance_messaging_setup.yml b/tasks/glance_messaging_setup.yml new file mode 100644 index 00000000..ed589f59 --- /dev/null +++ b/tasks/glance_messaging_setup.yml @@ -0,0 +1,37 @@ +--- +# Copyright 2014, Rackspace US, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +- name: Ensure Rabbitmq vhost + rabbitmq_vhost: + name: "{{ glance_rabbitmq_vhost }}" + state: "present" + delegate_to: "{{ groups['rabbitmq_all'][0] }}" + tags: + - glance-rabbitmq + - glance-rabbitmq-vhost + +- name: Ensure rabbitmq user + rabbitmq_user: + user: "{{ glance_rabbitmq_userid }}" + password: "{{ glance_rabbitmq_password }}" + vhost: "{{ glance_rabbitmq_vhost }}" + configure_priv: ".*" + read_priv: ".*" + write_priv: ".*" + state: "present" + delegate_to: "{{ groups['rabbitmq_all'][0] }}" + tags: + - glance-rabbitmq + - glance-rabbitmq-user diff --git a/tasks/glance_pre_install.yml b/tasks/glance_pre_install.yml index 273b5a2d..0f8939f1 100644 --- a/tasks/glance_pre_install.yml +++ b/tasks/glance_pre_install.yml @@ -80,3 +80,7 @@ tags: - glance-dirs - glance-logs + +- include: glance_messaging_setup.yml + when: > + inventory_hostname == groups['glance_all'][0] diff --git a/templates/glance-api.conf.j2 b/templates/glance-api.conf.j2 index b8b5f6e4..a7bb3b8b 100644 --- a/templates/glance-api.conf.j2 +++ b/templates/glance-api.conf.j2 @@ -35,8 +35,9 @@ notification_driver = {{ glance_notification_driver }} rpc_backend = {{ glance_rpc_backend }} rabbit_hosts = {{ rabbitmq_servers }} rabbit_port = {{ rabbitmq_port }} -rabbit_userid = {{ rabbitmq_userid }} -rabbit_password = {{ rabbitmq_password }} +rabbit_userid = {{ glance_rabbitmq_userid }} +rabbit_password = {{ glance_rabbitmq_password }} +rabbit_virtual_host = {{ glance_rabbitmq_vhost }} rabbit_notification_exchange = glance rabbit_notification_topic = notifications rabbit_durable_queues = False diff --git a/templates/glance-registry.conf.j2 b/templates/glance-registry.conf.j2 index 409be22a..5e0b087f 100644 --- a/templates/glance-registry.conf.j2 +++ b/templates/glance-registry.conf.j2 @@ -20,7 +20,9 @@ limit_param_default = 25 notification_driver = {{ glance_notification_driver }} rpc_backend = {{ glance_rpc_backend }} rabbit_hosts = {{ rabbitmq_servers }} -rabbit_password = {{ rabbitmq_password }} +rabbit_userid = {{ glance_rabbitmq_userid }} +rabbit_password = {{ glance_rabbitmq_password }} +rabbit_virtual_host = {{ glance_rabbitmq_vhost }} {% endif %} [database]