diff --git a/defaults/main.yml b/defaults/main.yml index e64e355a..2a60d512 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -39,6 +39,10 @@ neutron_db_max_overflow: 20 neutron_db_pool_size: 120 neutron_db_pool_timeout: 30 +## RabbitMQ info +neutron_rabbitmq_userid: neutron +neutron_rabbitmq_vhost: /neutron + ## Plugins neutron_plugin_core: neutron.plugins.ml2.plugin.Ml2Plugin # Other plugins can be added to the system by simply extending the list `neutron_plugin_base`. diff --git a/tasks/neutron_messaging_setup.yml b/tasks/neutron_messaging_setup.yml new file mode 100644 index 00000000..1cea089f --- /dev/null +++ b/tasks/neutron_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: "{{ neutron_rabbitmq_vhost }}" + state: "present" + delegate_to: "{{ groups['rabbitmq_all'][0] }}" + tags: + - neutron-rabbitmq + - neutron-rabbitmq-vhost + +- name: Ensure rabbitmq user + rabbitmq_user: + user: "{{ neutron_rabbitmq_userid }}" + password: "{{ neutron_rabbitmq_password }}" + vhost: "{{ neutron_rabbitmq_vhost }}" + configure_priv: ".*" + read_priv: ".*" + write_priv: ".*" + state: "present" + delegate_to: "{{ groups['rabbitmq_all'][0] }}" + tags: + - neutron-rabbitmq + - neutron-rabbitmq-user diff --git a/tasks/neutron_pre_install.yml b/tasks/neutron_pre_install.yml index b134c956..63a93646 100644 --- a/tasks/neutron_pre_install.yml +++ b/tasks/neutron_pre_install.yml @@ -92,3 +92,7 @@ tags: - sudoers - neutron-sudoers + +- include: neutron_messaging_setup.yml + when: > + inventory_hostname == groups['neutron_all'][0] diff --git a/templates/neutron.conf.j2 b/templates/neutron.conf.j2 index b9622533..c39cfa05 100644 --- a/templates/neutron.conf.j2 +++ b/templates/neutron.conf.j2 @@ -149,8 +149,9 @@ root_helper = sudo /usr/local/bin/neutron-rootwrap /etc/neutron/rootwrap.conf # Messaging service [oslo_messaging_rabbit] rabbit_port = {{ rabbitmq_port }} -rabbit_userid = {{ rabbitmq_userid }} -rabbit_password = {{ rabbitmq_password }} +rabbit_userid = {{ neutron_rabbitmq_userid }} +rabbit_password = {{ neutron_rabbitmq_password }} +rabbit_virtual_host = {{ neutron_rabbitmq_vhost }} rabbit_hosts = {{ rabbitmq_servers }} # Concurrency (locking mechanisms)