Blob Blame History Raw
# Virtual Machine deploy operation

## CentOS infra KVM hosts

If the KVM virtual machine we want to deploy is hosted on a CentOS KVM host and hosted within the `Community Cage` (Red Hat) DC, same thing as for bare-metal host : add it in the [Internal Inventory](https://docs.google.com/spreadsheets/d/1K-aewLJ17z3pRC6K5qyBRJYtNXy1WcxRSVwPkGf4NXQ), and start also "reserving" IP address[es] for Operating System.

Then add the new node to <inventory>/host_vars/<new_node> and also in the <inventory>/kvm file/group (for inheritance).

Ensure that *all* the variables explained in [adhoc-deploy-kvm-guest](https://github.com/CentOS/ansible-infra-playbooks/blob/master/adhoc-deploy-kvm-guest.yml) playbook are set correctly.

Then you can call it like that : 

```
 ansible-playbook playbooks/adhoc-deploy-kvm-guest.yml 
[WARNING] KVM guests to be deployed with CentOS => : <kvm_guest[s]>

```

The process will go like this : 

  * ansible will generate a kickstart locally on the kvm host
  * will deploy a wrapper template/script (calling virt-install) with correct settings
  * call that script to kick that `virt-install` script that will inject the kickstart into initrd on demand
  * wait for sshd to be available on the node
  * clean-up the `virt-install` wrapper script for the kvm guest

!!! tip
    As now in the ansible inventory we know where the VM is hosted, in case you need to reset a node you can use the `adhoc-reset-vm.yml` that will destroy the VM (through delegate_to: ansible task) and restart it

## Cloud providers

### AWS/EC2