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
This commit is contained in:
parent
648142d56f
commit
953f324f2b
@ -13,24 +13,30 @@
|
||||
# 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: "{{ nova_bin }}/nova-manage cell_v2 discover_hosts"
|
||||
command: "{{ _db_nova_bin }}/nova-manage cell_v2 discover_hosts"
|
||||
become: yes
|
||||
become_user: "{{ nova_system_user_name }}"
|
||||
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: "{{ nova_bin }}/nova-manage cell_v2 list_cells | grep ' {{ nova_cell1_name }} '"
|
||||
shell: "{{ _db_nova_bin }}/nova-manage cell_v2 list_cells | grep ' {{ _db_nova_cell1_name }} '"
|
||||
become: yes
|
||||
become_user: "{{ nova_system_user_name }}"
|
||||
become_user: "{{ _db_nova_system_user_name }}"
|
||||
register: cell1_uuid
|
||||
changed_when: false
|
||||
|
||||
- name: Map instances to new Cell1
|
||||
command: "{{ nova_bin }}/nova-manage cell_v2 map_instances --cell_uuid {{ cell1_uuid['stdout'].split()[3] }}"
|
||||
command: "{{ _db_nova_bin }}/nova-manage cell_v2 map_instances --cell_uuid {{ cell1_uuid['stdout'].split()[3] }}"
|
||||
become: yes
|
||||
become_user: "{{ nova_system_user_name }}"
|
||||
become_user: "{{ _db_nova_system_user_name }}"
|
||||
changed_when: false
|
||||
|
Loading…
x
Reference in New Issue
Block a user