A playbook to migrate an existing on prem VM running on KVM hypervisor to AWS.
This playbook uses the cloud.aws_ops.clone_on_prem_vm
role to clone an existing VM on prem using the KVM hypervisor and the cloud.aws_ops.import_image_and_run_aws_instance
role to import a local .raw image into an Amazon machine image (AMI) and run an AWS EC2 instance. For a complete list of requirements, see clone_on_prem_vm and import_image_and_run_aws_instance, respectively.
For a full list of accepted variables see: clone_on_prem_vm and respectively import_image_and_run_aws_instance.
Create a credentials.yml
file with the folling contents:
aws_access_key: "xxxxxxxxxxxxxxxxxxxx"
aws_secret_key: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
aws_region: "us-east-1"
Create an inventory.yml
file with information about the host running the KVM hypervisor.
---
all:
hosts:
kvm:
ansible_host: myhost
ansible_user: myuser
ansible_ssh_private_key_file: /path/to/private_key
groups: mygroup
All the variables defined in section Playbook Variables
can be defined inside the vars.yml
file.
Run the playbook:
ansible-playbook cloud.aws_ops.move_vm_from_on_prem_to_aws.move_vm_from_on_prem_to_aws -e "@credentials.yml" -e "@vars.yml" -i inventory.yml