Files
openstack-ansible-os_nova/tasks/nova_db_post_setup.yml
Logan V 953f324f2b Scope vars references correctly when delegated
In my environment, my computes have "untagged" venvs, so the path
to the venv on nova_compute hosts has "nova-untagged" instead of
"nova-<tag>", meaning this tasks breaks because it is delegated from
computes to a conductor host, but does not use the conductor vars to
reference the location of nova's venv.

Change-Id: I3967cbad0cbcc2214db1ca1f2225f3d140fd1774
2017-09-04 16:08:18 +00:00

43 lines
1.7 KiB
YAML

---
# Copyright 2017, 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: Set the delegated task facts
set_fact:
_db_nova_bin: "{{ hostvars[conductor_host]['nova_bin'] | default(nova_bin) }}"
_db_nova_system_user_name: "{{ hostvars[conductor_host]['nova_system_user_name'] | default(nova_system_user_name) }}"
_db_nova_cell1_name: "{{ hostvars[conductor_host]['nova_cell1_name'] | default(nova_cell1_name) }}"
# This needs to be done after Compute hosts are added.
- name: Perform a cell_v2 discover
command: "{{ _db_nova_bin }}/nova-manage cell_v2 discover_hosts"
become: yes
become_user: "{{ _db_nova_system_user_name }}"
changed_when: false
# When upgrading we need to map existing instances to the new cell1
# To do this we need the cell UUID.
- name: Get UUID of new Nova Cell
shell: "{{ _db_nova_bin }}/nova-manage cell_v2 list_cells | grep ' {{ _db_nova_cell1_name }} '"
become: yes
become_user: "{{ _db_nova_system_user_name }}"
register: cell1_uuid
changed_when: false
- name: Map instances to new Cell1
command: "{{ _db_nova_bin }}/nova-manage cell_v2 map_instances --cell_uuid {{ cell1_uuid['stdout'].split()[3] }}"
become: yes
become_user: "{{ _db_nova_system_user_name }}"
changed_when: false