Ansible: How to remove & register a VM from VCenter? - ansible

I need to do a vmotion and I would need:
Unregister machine from VMWare VCenter.
Register that machine into another cluster.
Is it possible to do with an Ansible module?
Thanks in advance!

Among the same cluster, have you tried :
vmware_vmotion – Move a virtual machine using vMotion, and/or its vmdks using storage vMotion ?
but you're talking about 'another cluster' so i think it won't work :
as said in Live Migration of Virtual Machines
VMware vSphere vMotion is a zero downtime live migration of workloads
from one server to another. This capability is possible across
vSwitches, Clusters, and even Clouds
So you are not doing vMotion by migrating from a cluster to another (you will have down time).
What you want to do is stop vm, download vmdk files from a cluster, upload it to another, and restore a vm with it (but i never did that, i only have one cluster)

As far as I can tell, when using vmware_guest, setting a VM state to "absent" will destroy it instead of unregistering it.
Similarly, I don't see any way to add a VM back to the inventory by way of a VMX file.

Related

ARM template deployment effect on already running MemSQL Instance

I have an ARM template to deploy all of my resources as the production setup. Initially when I used to deploy the resources through the ARM template, everything was fine and our setup is up and running. We did started a MemSQL cluster into the setup. We have an application running using the MemSQL cluster. Now, we have some changes to the setup, specifically to the Ubuntu VMs, where MemSQL is running, like adding disks, assigning private IP etc.
The question what I have here is, does any changes made through the ARM deployment, effects the, in memory data for the running application on the VMs, specifically the MemSQL data?
the answer is - it depends. it wouldn't delete any data (unless you are using complete deployment mode). but it might (depending on what you are doing) detach data disks, or reboot the vms (if you change the sku, for example), if you change private ip addresses cluster might fall apart, as the nodes won't be able to talk to each other, etc.
I'd recommend having a dev cluster where you test your ARM templates and then you can apply the changes to the prod cluster

Is autoscaling possible in vagrant?

I am a newbie to vagrant. So far i know how to create multiple machines and provision them using a single vagrantfile. Currently i am working on a project which requires auto-scaling feature for an application. I am creating 3 VMs and provisioning them using chef. I would like to know is there way to create 4th vagrant VM and provision it at runtime when load increases on all 3 VMs (i.e. auto-scaling). I am using HAproxy as load balancer as my first VM.
Thanks in advance.
there's no reason what you could not provision your 4th VM automatically but there's no auto scaling feature built in with Vagrant.
Basically you will need to build a script to check the load on the VM or the load on your application, depending on which threshold you want to trigger a new VM.
There's no built-in capacity as:
monitoring the load of the VM will be OS specific. do you want to turn a new VM when CPU/RAM reach a peak, you will need to check
monitoring the load on your application would require you to monitor again depending your stack/framework of your app
Vagrant is a tool for development and testing. It is not a production provisioning solution. Look at tools like Terraform, SparkleFormation, and CloudFormation.

Working with pre emptive VMs on Google Compute Engine

I'm trying to work with multiple Pre-emptive VM instances on Google Compute Engine for elastic search service and facing some doubts as follows:-
Is 30sec window enough to store data from a preemptive elastic search instance to a stable VM?
How to save the state of one VM that is ending and restore it to other?
Is there an alternative to Google Autoscaler?
You could try running a 'shutdown-script' to create a snapshot with the command:
gcloud compute disks snapshot [disk_name] --zone=[zone] --snapshot-names=[snapshot_name]
Although you should manage to have different snapshot names. Using this you would have a backup of the current VM state, but there is no automatic way to create another VM from this snapshot when is created.
As far as I know there is no predefined alternative that do the same as the autoscaler. Although you could also try using the shutdown script to starts a VM.

vSphere Cluster creation requirements

I've been searching around but haven't found a clear answer on this.
We're using VMware ESXI with vSphere to manage a handful of VMs (about 15 right now)
However, these are all spread over three separate machines. I'm looking for a way to cluster these together so their resources can be pooled or dynamically allocated. I found vSphere DRS Cluster information, but I'm having a really hard time finding out what I need to get that set up.
Does it require a separate vCenter license to hook into vSphere? And at that point, how do I create a database to group all the server hosts together? Every tutorial I find already has 2+ host machines already grouped together in the vSphere client, and I'm not sure how to go about achieving that.
If you just want to create a failover cluster, then you need VMware HA. VMware DRS is the option for resource dynamical allocation. To manage these two options, you need a vCenter Server. vCenter Server Foundation can manage up to 3 hosts (which is your case). For more information about vCenter, see this link.
For VMware HA and DRS to work, you must have a shared storage (NFS, iSCSI, or Fiber Channel). To know how to create VMware HA cluster using vSphere Client (connected to vCenter Server), see this link.
VMware DRS is an option after you created VMware HA. See this link

How make a cluster of CoreOS on my local infrastructure?

I have some professional servers, and I want to create a cluster of 7-15 machines with CoreOS. I'm a little familiar with Proxmox, but I'm not clear about how create a virtual machine(VM) with CoreOS on proxmox. Also, I'm not sure if the idea of cluster of CoreOS's VM on proxmox it's right to do.
Then, I need:
How create a VM with CoreOS on proxmox.
If will be viable proxmox to create CoreOS's cluster.
I have no experience with Proxmox, but if you can make an image that runs then you can use it to stamp out the cluster. What you'd need to do is boot the ISO, run the installer and then make an image of that. Be sure to delete /etc/machine-id before you create the image.
CoreOS uses cloud-config to connect the machines together and configure a few parameters related to networking -- basically anything to get the machines talking to the cluster. A cloud-config file should be provided as a config-drive image, which is basically like mounting a CD-ROM to the VM. You'll have to check the docs on Proxmox to see if it supports that. More info here: http://coreos.com/docs/cluster-management/setup/cloudinit-config-drive/
The other option you have is to skip the VMs altogether and instead of using Proxmox, just boot CoreOS directly on your hardware. You can do this by booting the ISO and installing or doing something like iPXE: http://coreos.com/docs/running-coreos/bare-metal/booting-with-ipxe/

Resources