Launch a VM Migration with Ansible Automation Platform
Configuring AAP to Launch a Migration
Creating Credentials
-
From the navigation panel, go to Automation Execution → Credentials.
-
Click Create Credentials and set the following parameters:
-
Name: Bastion key
-
Credential Type: Machine
-
Username: cloud-user
-
SSH Private Key: File content from
/home/lab-user/.ssh/my-guidkey.pemon the bastion
-
-
Click Create Credential
Creating an Inventory
-
From the navigation panel, go to Automation Execution → Infrastructure → Inventories.
-
Click Create Inventory → Create Inventory and set the following parameters:
-
Name: Conversion Host Inventory
-
Organization: Default
-
-
Click Create Inventory.
Creating Hosts
Conversion Host
-
From the navigation panel, go to Automation Execution → Infrastructure → Hosts.
-
Click Create Host and set the following parameters:
-
Name: conversion_host
-
Inventory: Conversion Host Inventory
-
Variables:
-
ansible_host: {rhoso_conversion_host_ip}
ansible_ssh_user: cloud-user
Click Create Host.
Migrator Host
-
From the navigation panel, go to Automation Execution → Infrastructure → Hosts.
-
Click Create Host and set the following parameters:
-
Name: migrator
-
Inventory: Conversion Host Inventory
-
Variables:
-
ansible_connection: local
ansible_python_interpreter: '{{ ansible_playbook_python }}'
Click Create Host.
Creating an Execution Environment
If using internal AAP registry:
Step 1: Access Automation Content
-
Log into your AAP web interface
-
Navigate to Automation Content → Execution Environments
-
You should see your pushed execution environment listed (e.g.,
rhospvmt-ee)
Step 2: Use in Controller
-
Locate your execution environment in the list
-
Click the three vertical dots (⋮) menu next to your execution environment
-
Select Use in Controller
-
You will be redirected to the execution environment creation page with the following fields:
-
Name: VMware Migration toolkit execution environment
-
Image: This field is pre-filled with your pushed EE image path
-
Description: Optional description field
-
-
Click Create Execution Environment to complete the configuration
Step 3: Verify Configuration
After clicking "Create Execution Environment":
-
You will be automatically redirected to Automation Execution → Infrastructure → Execution Environments.
-
Verify your execution environment appears in the list with:
-
Name: VMware Migration toolkit execution environment
-
Image: Full registry path to your pushed image
-
Status: Should show as available
-
If using OCP container registry:
-
From the navigation panel, go to Automation Execution → Infrastructure → Execution Environments.
-
Click Create Execution Environment and set the following parameters:
-
Name: VMware Migration toolkit execution environment
-
Image:
default-route-openshift-image-registry.apps.cluster-my-guid.dynamic.redhatworkshops.io/aap/rhospvmt-ee:latest
-
-
Click Create Execution Environment.
Creating a Project
-
From the navigation panel, go to Automation Execution → Projects.
-
Click Create Project and set the following parameters:
-
Name: vmware migration toolkit project
-
Source Control Type: Git
-
Source Control URL:
https://github.com/os-migrate/vmware-migration-kit
-
-
Click Create Project.
Creating the Job Template
Preparing the Bastion
In the bastion, create the folder to store the ansible variables:
cd
mkdir -p /home/lab-user/os-migrate-env
Run the following commands to configure OpenStack CLI access:
oc project openstack
alias openstack="oc exec -t openstackclient -- openstack"
Retrieve necessary OpenStack parameters:
SECURITY_GROUP_ID=$(openstack security group list | awk '/ basic / {print $2}')
PROJECT_ID=$(openstack project list | grep ' admin ' | awk '{print $2}')
AUTH_URL=$(openstack endpoint list --service identity --interface public -c URL -f value)
Create the /home/lab-user/os-migrate-env/os_migrate_for_aap.yaml file:
cat << EOF > /home/lab-user/os-migrate-env/os_migrate_for_aap.yaml
os_migrate_tear_down: false
# osm working directory:
runner_from_aee: true
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, 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
os_migrate_configure_network: true
vms_list:
- winweb01-my-guid
# 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
Configuring the Job Template
-
From the navigation panel, go to Automation Execution → Templates.
-
Click Create Template → Create Job Template and set the following parameters:
-
Name: Windows VM Migration
-
Inventory: Conversion Host Inventory
-
Project: vmware migration toolkit project
-
Playbook:
playbooks/migration.yml -
Execution Environment: VMware Migration toolkit execution environment
-
Credentials: Bastion key
-
Extra Variables: Copy the content of
/home/lab-user/os-migrate-env/os_migrate_for_aap.yamlfrom the bastion
-
-
Click Create Job Template.
Access to the VM using Horizon
-
Access to Horizon using the URL: https://horizon-openstack.apps.my-guid.dynamic.redhatworkshops.io
-
In the top panel, Instances, click on the instance: winweb01-my-guid
-
Click the tab Console to access to the console.