diff --git a/ansible/seed-vm-provision.yml b/ansible/seed-vm-provision.yml index 581f2c018..cbe19308b 100644 --- a/ansible/seed-vm-provision.yml +++ b/ansible/seed-vm-provision.yml @@ -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: diff --git a/releasenotes/notes/fix-remote-seed-vm-provisioning-faa8de569ca6bc89.yaml b/releasenotes/notes/fix-remote-seed-vm-provisioning-faa8de569ca6bc89.yaml new file mode 100644 index 000000000..70a910514 --- /dev/null +++ b/releasenotes/notes/fix-remote-seed-vm-provisioning-faa8de569ca6bc89.yaml @@ -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 `_ for more + details.