Let's jump right into examining the role we created called instance-migrate
. The completed role and file named main.yml
located in the instance-migrate/tasks
directory looks similar to the following example:
--- - name: Retrieve hypervisor list shell: nova --os-username={{ OS_USERNAME }} --os-password={{ OS_PASSWORD }} --os-tenant-name={{ OS_TENANT_NAME }} --os-auth-url={{ OS_AUTH_URL }} hypervisor-list | awk 'NR > 3' | awk '$4 != "{{ desthype }}" { print $4 }' register: hypelist - name: Collect pre-migration instance details shell: nova --os-username={{ OS_USERNAME }} --os-password={{ OS_PASSWORD }} --os-tenant-name={{ OS_TENANT_NAME }} --os-auth-url={{ OS_AUTH_URL }} list --name {{ instance }} --fields OS-EXT-SRV-ATTR:host | awk 'NR > 3' | awk '{ print $4 }' register: preinststat - name: Disable unselected hypervisors command: nova --os-username={{ OS_USERNAME }} --os-password={{ OS_PASSWORD }} --os-tenant-name={{ OS_TENANT_NAME }} --os-auth-url={{ OS_AUTH_URL...