From 6f8371f1403e60e57b2b85d60d47484427d5488f Mon Sep 17 00:00:00 2001 From: Chris Hultin Date: Thu, 16 Jun 2016 09:45:04 -0500 Subject: [PATCH] Moving RabbitMQ setup to PreTasks Moving RabbitMQ setup from role to PreTasks. Change-Id: I6479cccf38f147b203dc65187aa5e70b116c1a10 --- defaults/main.yml | 2 +- extras/os-magnum-install.yml | 43 +++++++++++++++++++++++++++--------- tasks/main.yml | 4 ---- tasks/messaging-setup.yml | 38 ------------------------------- 4 files changed, 34 insertions(+), 53 deletions(-) delete mode 100644 tasks/messaging-setup.yml diff --git a/defaults/main.yml b/defaults/main.yml index bedb3956..0defade2 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -73,7 +73,7 @@ magnum_galera_user: magnum # Rabbit vars magnum_rpc_backend: rabbit magnum_rabbitmq_userid: magnum -magnum_rabbitmq_virtualhost: /magnum +magnum_rabbitmq_vhost: /magnum # Keystone AuthToken/Middleware magnum_keystone_auth_plugin: password diff --git a/extras/os-magnum-install.yml b/extras/os-magnum-install.yml index 99b1973f..147ce28b 100644 --- a/extras/os-magnum-install.yml +++ b/extras/os-magnum-install.yml @@ -44,6 +44,37 @@ retries: 3 tags: - ssh-wait + - name: Sort the rabbitmq servers + dist_sort: + value_to_lookup: "{{ container_name }}" + ref_list: "{{ groups['magnum_all'] }}" + src_list: "{{ rabbitmq_servers }}" + register: servers + - name: Set rabbitmq servers + set_fact: + rabbitmq_servers: "{{ servers.sorted_list }}" + - name: Ensure the Magnum RabbitMQ virtualhost exists + rabbitmq_vhost: + name: "{{ magnum_rabbitmq_vhost }}" + state: "present" + delegate_to: "{{ groups['rabbitmq_all'][0] }}" + tags: + - magnum-rabbitmq + - magnum-rabbitmq-vhost + - magnum-rabbitmq-virtualhost + - name: Ensure the Magnum RabbitMQ user exists + rabbitmq_user: + user: "{{ magnum_rabbitmq_userid }}" + password: "{{ magnum_rabbitmq_password }}" + vhost: "{{ magnum_rabbitmq_vhost }}" + configure_priv: ".*" + read_priv: ".*" + write_priv: ".*" + state: "present" + delegate_to: "{{ groups['rabbitmq_all'][0] }}" + tags: + - magnum-rabbitmq + - magnum-rabbitmq-user - name: Create Magnum's database tables mysql_db: login_user: "{{ galera_root_user }}" @@ -72,15 +103,6 @@ - magnum-database-setup - magnum-db-setup - magnum-setup - - name: Sort the rabbitmq servers - dist_sort: - value_to_lookup: "{{ container_name }}" - ref_list: "{{ groups['magnum_all'] }}" - src_list: "{{ rabbitmq_servers }}" - register: servers - - name: Set rabbitmq servers - set_fact: - rabbitmq_servers: "{{ servers.sorted_list }}" - name: Create log dir file: path: "/openstack/log/{{ inventory_hostname }}-magnum" @@ -110,9 +132,10 @@ - "system-crontab-coordination" vars: galera_address: "{{ internal_lb_vip_address }}" - magnum_galera_address: "{{ internal_lb_vip_address }}" magnum_galera_database_name: magnum_service magnum_galera_user: magnum + magnum_rabbitmq_userid: magnum + magnum_rabbitmq_vhost: /magnum ansible_hostname: "{{ container_name }}" is_metal: "{{ properties.is_metal|default(false) }}" diff --git a/tasks/main.yml b/tasks/main.yml index ce2bbd6b..6c93f9eb 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -25,10 +25,6 @@ - include: pre-install.yml -- include: messaging-setup.yml - when: > - inventory_hostname == groups['magnum_all'][0] - - include: install.yml - include: post-install.yml diff --git a/tasks/messaging-setup.yml b/tasks/messaging-setup.yml deleted file mode 100644 index a48fdae3..00000000 --- a/tasks/messaging-setup.yml +++ /dev/null @@ -1,38 +0,0 @@ ---- -# Copyright 2016, Ian Cordasco -# -# 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 the Magnum RabbitMQ virtualhost exists - rabbitmq_vhost: - name: "{{ magnum_rabbitmq_virtualhost }}" - state: "present" - delegate_to: "{{ groups['rabbitmq_all'][0] }}" - tags: - - magnum-rabbitmq - - magnum-rabbitmq-vhost - - magnum-rabbitmq-virtualhost - -- name: Ensure the Magnum RabbitMQ user exists - rabbitmq_user: - user: "{{ magnum_rabbitmq_userid }}" - password: "{{ magnum_rabbitmq_password }}" - vhost: "{{ magnum_rabbitmq_virtualhost }}" - configure_priv: ".*" - read_priv: ".*" - write_priv: ".*" - state: "present" - delegate_to: "{{ groups['rabbitmq_all'][0] }}" - tags: - - magnum-rabbitmq - - magnum-rabbitmq-user