From ad9bcb08150db26c09150f0ed5442522ad4de53b Mon Sep 17 00:00:00 2001 From: Maxime Guyot Date: Wed, 11 Apr 2018 13:59:12 +0200 Subject: [PATCH] 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 db5a6181c357c4af629450fa1f48773144be17af) --- tasks/main.yml | 4 ++-- tasks/nova_db_post_setup.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 4f6351ac..6812c467 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -130,11 +130,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 diff --git a/tasks/nova_db_post_setup.yml b/tasks/nova_db_post_setup.yml index 758b4a4c..152417f5 100644 --- a/tasks/nova_db_post_setup.yml +++ b/tasks/nova_db_post_setup.yml @@ -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