Merge "Fix seed VM provisioning on a remote seed hypervisor"

This commit is contained in:
Zuul 2020-04-22 12:38:12 +00:00 committed by Gerrit Code Review
commit a8f1045842
2 changed files with 24 additions and 4 deletions

View File

@ -3,7 +3,6 @@
hosts: seed-hypervisor
vars:
seed_host: "{{ groups['seed'][0] }}"
seed_user_data_path: "{{ image_cache_path }}/seed-vm-user-data"
pre_tasks:
- name: Verify the seed host exists in the Ansible inventory
fail:
@ -20,6 +19,12 @@
group: "{{ ansible_user_gid }}"
become: True
- name: Create a temporary user data file locally
tempfile:
state: file
register: seed_user_data_file
delegate_to: localhost
# The user data script is used to bring up the network interfaces that will
# be configured by metadata in the configdrive. For some reason resolv.conf
# gets configured with 660 permissions, so fix that here also.
@ -34,7 +39,8 @@
{% endfor %}
# Fix permissions of resolv.conf.
chmod 644 /etc/resolv.conf
dest: "{{ seed_user_data_path }}"
dest: "{{ seed_user_data_file.path }}"
delegate_to: localhost
roles:
- role: jriguera.configdrive
@ -55,7 +61,7 @@
{{ hostvars[seed_host].network_interfaces |
map('net_configdrive_network_device', seed_host) |
list }}
configdrive_config_user_data_path: "{{ seed_user_data_path }}"
configdrive_config_user_data_path: "{{ seed_user_data_file.path }}"
tasks:
- name: Set a fact containing the configdrive image path
@ -73,9 +79,16 @@
path: "{{ item }}"
state: absent
with_items:
- "{{ seed_user_data_path }}"
- "{{ image_cache_path }}/{{ seed_host | to_uuid }}.gz"
- name: Ensure unnecessary local files are removed
file:
path: "{{ item }}"
state: absent
with_items:
- "{{ seed_user_data_file.path }}"
delegate_to: localhost
- name: Ensure that the seed VM is provisioned
hosts: seed-hypervisor
vars:

View File

@ -0,0 +1,7 @@
---
issues:
- |
Fixes an issue where provisioning a seed VM would fail when the Ansible
control host and the seed hypervisor are different hosts. `See story
2007530 <https://storyboard.openstack.org/#!/story/2007530>`_ for more
details.