Use first conductor for nova-manage cell_v2 discover_hosts

Using a random conductor leads to unpredictable results with lazy eval

Change-Id: I846f78c80e4b5eb8421dbdebf3fc943be0bc84df
Closed-Bug: 1762742
(cherry picked from commit db5a6181c3)
This commit is contained in:
Maxime Guyot 2018-04-11 13:59:12 +02:00 committed by Jesse Pretorius (odyssey4me)
parent a08b153f55
commit 7a860832b0
2 changed files with 4 additions and 4 deletions

View File

@ -134,11 +134,11 @@
# the database connection string and therefore
# cannot run nova-manage.
- include: nova_db_post_setup.yml
delegate_to: "{{ random_conductor }}"
delegate_to: "{{ first_conductor }}"
run_once: true
when:
- "nova_services['nova-compute']['group'] in group_names"
vars:
random_conductor: "{{ groups[nova_services['nova-conductor']['group']] | random }}"
first_conductor: "{{ groups[nova_services['nova-conductor']['group']][0] }}"
tags:
- nova-config

View File

@ -15,8 +15,8 @@
- name: Set the delegated task facts
set_fact:
_db_nova_bin: "{{ hostvars[random_conductor]['nova_bin'] | default(nova_bin) }}"
_db_nova_system_user_name: "{{ hostvars[random_conductor]['nova_system_user_name'] | default(nova_system_user_name) }}"
_db_nova_bin: "{{ hostvars[first_conductor]['nova_bin'] | default(nova_bin) }}"
_db_nova_system_user_name: "{{ hostvars[first_conductor]['nova_system_user_name'] | default(nova_system_user_name) }}"
# This needs to be done after Compute hosts are added.
- name: Perform a cell_v2 discover