Install the os-migrate vmware migration kit collection and execute a VM migration from CLI

Configure os-migrate vmware migration kit

Configure the Ansible inventory

In the bastion, create the folder to store the ansible variables:

mkdir -p /home/lab-user/os-migrate-env

Then,create the ansible inventory:

cat << EOF > /home/lab-user/os-migrate-env/inventory.yaml
migrator:
  hosts:
    localhost:
      ansible_connection: local
      ansible_python_interpreter: "{{ ansible_playbook_python }}"

conversion_host:
  hosts:
    {rhoso_conversion_host_ip}:
      ansible_ssh_user: cloud-user
      ansible_ssh_private_key_file: /runner/key
      ansible_ssh_common_args: '-o StrictHostKeyChecking=no'
EOF

Configure the Ansible inventory

In the bastion, create an alias to use the openstack command in the Red Hat OpenStack Services on OpenShift (RHOSO) deployment:

oc project openstack
alias openstack="oc exec -t openstackclient -- openstack"

Get the security group ID:

SECURITY_GROUP_ID=$(openstack security group list | awk '/ basic / {print $2}')

Create the os_migrate_vars.yamls file:

cat << EOF > /home/lab-user/os-migrate-env/os_migrate_vars_demo_redhat_com.yaml
runner_from_aee: false
# osm working directory:
os_migrate_vmw_data_dir: /tmp/os-migrate
copy_openstack_credentials_to_conv_host: false

# Re-use an already deployed conversion host:
already_deploy_conversion_host: true

# If no mapped network then set the openstack network:
openstack_private_network: private

# Security groups for the instance:
security_groups: ${SECURITY_GROUP_ID}
use_existing_flavor: false

# network settings for openstack:
os_migrate_create_network_port: true
copy_metadata_to_conv_host: true
used_mapped_networks: false

# Use for settings rhel network device:
os_migrate_configure_network: true

os_migrate_tear_down: false

vms_list:
  - haproxy-my-guid
EOF
In the vms_list we specify the list of VMs to be migrated in this example, we will migrate the virtual machine haproxy-my-guid

Get the project ID and authurl from the tenant we are executing the conversion:

PROJECT_ID=$(openstack project list | grep ' admin ' | awk '{print $2}')
AUTH_URL=$(openstack endpoint list --service identity --interface public -c URL -f value)

And finally create the secrets files with :

cat << EOF > /home/lab-user/os-migrate-env/secrets_demo_redhat_com.yaml
# VMware parameters:
vcenter_hostname: {vcenter_console}
vcenter_username: {vcenter_full_user}
vcenter_password: {vcenter_password}
vcenter_datacenter: RS01

os_cloud_environ: demo.redhat.com
dst_cloud:
  auth:
    auth_url: ${AUTH_URL}
    username: admin
    project_id: ${PROJECT_ID}
    project_name: admin
    user_domain_name: Default
    password: openstack
  region_name: regionOne
  interface: public
  insecure: true
  identity_api_version: 3
EOF

Execute the virtual machine migration

Navigate to the the vcenter console: {vcenter_console} using username: {vcenter_full_user} and password: {vcenter_password}.

Ha-proxy-vm

Power on the virtual machine haproxy-my-guid

In the bastion, launch the migration:

sudo podman secret create conv-key /home/lab-user/.ssh/my-guidkey.pem
sudo podman run --network host -it -v $PWD/os-migrate-env:/runner/env:z --env ANSIBLE_CALLBACKS_ENABLED=profile_tasks --secret conv-key,target=/runner/key,mode=0600,type=mount --user root quay.io/os-migrate/vmware-migration-kit ansible-playbook -i /runner/env/inventory.yaml os_migrate.vmware_migration_kit.migration -e @/runner/env/os_migrate_vars_demo_redhat_com.yaml -e @/runner/env/secrets_demo_redhat_com.yaml

Check that the VM has been migrated:

alias openstack="oc exec -t openstackclient -- openstack"
openstack server list

Create a floating ip for the ha-proxy VM:

openstack floating ip create public
  1. Sample Output

+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| created_at          | 2025-09-28T08:20:02Z                 |
| description         |                                      |
| dns_domain          |                                      |
| dns_name            |                                      |
| fixed_ip_address    | None                                 |
| floating_ip_address | $FLOATING_IP_HA_PROXY                        |
| floating_network_id | ea391fc3-52c8-4bba-a6d6-4cf0a81a87f6 |
| id                  | f0ed05a7-5f8a-4a17-87ae-4f17b46ebdc4 |
| name                | $FLOATING_IP_HA_PROXY                       |
| port_details        | None                                 |
| port_forwardings    | []                                   |
| port_id             | None                                 |
| project_id          | 1a9affc7161949009e43cb13dfb17307     |
| qos_policy_id       | None                                 |
| revision_number     | 0                                    |
| router_id           | None                                 |
| status              | DOWN                                 |
| subnet_id           | None                                 |
| tags                | []                                   |
| updated_at          | 2025-09-28T08:20:02Z                 |
+---------------------+--------------------------------------+
openstack server add floating ip haproxy-my-guid $FLOATING_IP_HA_PROXY
  1. Sample Output

+--------------------------------------+---------------+--------+-----------------------------------------+--------------------------+--------------------------+
| ID                                   | Name          | Status | Networks                                | Image                    | Flavor                   |
+--------------------------------------+---------------+--------+-----------------------------------------+--------------------------+--------------------------+
| 77844fc9-1c83-4328-8995-3c9a008e8134 | haproxy-my-guid | ACTIVE | private=10.0.0.25, FLOATING_IP | N/A (booted from volume) | osm-vmware-haproxy-tztc2 |
| 7fa1709c-4b6e-4adf-8098-f57a0ee43abd | centos10-ch    | ACTIVE | private=10.0.0.27, {rhoso_conversion_host_ip} | centos9-image            | migrate                  |
+--------------------------------------+---------------+--------+-----------------------------------------+--------------------------+--------------------------+

Ping the migrated VM:

ping $FLOATING_IP
PING $FLOATING_IP (FLOATING_IP) 56(84) bytes of data.
64 bytes from $FLOATING_IP: icmp_seq=1 ttl=63 time=1.41 ms
64 bytes from $FLOATING_IP: icmp_seq=2 ttl=63 time=0.792 ms

Delete the virtual machine, before moving the next chapter.

openstack server delete haproxy-my-guid