From 49259b937defe3bc2a1be2867f3c840b16a47a71 Mon Sep 17 00:00:00 2001 From: Mohammed Naser Date: Sat, 5 Jan 2019 16:05:10 -0500 Subject: [PATCH] setup: allow custom conductor host This patch allows using a custom conductor host to do all the deployment and setup steps when installing a brand new compute node such as adding cell mappings, etc. Change-Id: I61fc92d17d32e367ac133000d06bc83358735312 --- defaults/main.yml | 4 ++++ tasks/main.yml | 7 ++----- tasks/nova_compute_wait.yml | 2 +- tasks/nova_db_post_setup.yml | 4 ++-- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 06d06d0c..b337f30d 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -32,6 +32,10 @@ debug: False nova_service_setup_host: "{{ openstack_service_setup_host | default('localhost') }}" nova_service_setup_host_python_interpreter: "{{ openstack_service_setup_host_python_interpreter | default((nova_service_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_python['executable'])) }}" +# Set the host which will run compute initialization tasks such as checking +# for a compute node to be up and running cell discovery. +nova_conductor_setup_host: "{{ groups[nova_services['nova-conductor']['group']][0] }}" + # Set the package install state for distribution and pip packages # Options are 'present' and 'latest' nova_package_state: "latest" diff --git a/tasks/main.yml b/tasks/main.yml index 64c3b696..4d54d57f 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -197,12 +197,11 @@ # where we want to isolate the clouds.yaml configuration, # rather than have it implemented on all compute nodes. - import_tasks: nova_compute_wait.yml - delegate_to: "{{ first_conductor }}" + delegate_to: "{{ nova_conductor_setup_host }}" when: - "nova_services['nova-compute']['group'] in group_names" - "nova_discover_hosts_in_cells_interval | int < 1" vars: - first_conductor: "{{ groups[nova_services['nova-conductor']['group']][0] }}" compute_host_to_wait_for: "{{ ansible_nodename }}" tags: - nova-config @@ -212,11 +211,9 @@ # the database connection string and therefore # cannot run nova-manage. - import_tasks: nova_db_post_setup.yml - delegate_to: "{{ first_conductor }}" + delegate_to: "{{ nova_conductor_setup_host }}" run_once: true when: - "nova_services['nova-compute']['group'] in group_names" - vars: - first_conductor: "{{ groups[nova_services['nova-conductor']['group']][0] }}" tags: - nova-config diff --git a/tasks/nova_compute_wait.yml b/tasks/nova_compute_wait.yml index 2d0f5855..751191bd 100644 --- a/tasks/nova_compute_wait.yml +++ b/tasks/nova_compute_wait.yml @@ -19,7 +19,7 @@ - name: Set the delegated task facts set_fact: - _wait_nova_bin: "{{ hostvars[first_conductor]['nova_bin'] | default(nova_bin) }}" + _wait_nova_bin: "{{ hostvars[nova_conductor_setup_host]['nova_bin'] | default(nova_bin) }}" - block: - name: Wait for the nova-compute service to initialize diff --git a/tasks/nova_db_post_setup.yml b/tasks/nova_db_post_setup.yml index 55f6b9d0..6b51c590 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[first_conductor]['nova_bin'] | default(nova_bin) }}" - _db_nova_system_user_name: "{{ hostvars[first_conductor]['nova_system_user_name'] | default(nova_system_user_name) }}" + _db_nova_bin: "{{ hostvars[nova_conductor_setup_host]['nova_bin'] | default(nova_bin) }}" + _db_nova_system_user_name: "{{ hostvars[nova_conductor_setup_host]['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