Friday, November 17, 2017

To have unique machine id in multiple VMs - Centos





When you clone a VM, sometimes VM id may not be unique and you end up with same VM id for multiple machines.

So, if that is the case just remove /etc/machine-id and then reboot

Then, run systemd-machine-id-setup.

Now, you will have a unique id in /etc/machine-id.   Now, Live happily ever after :) :) 

# systemd-machine-id-setup
Initializing machine ID from KVM UUID.

# cat /etc/machine-id 
4cd635a844fb4219bb03f8726a64abca


Original error faced while using ansible:

failed: [centosmaster] (item=tmaster) => {
    "assertion": "ansible_hostname == hostvars[item]['ansible_hostname'] or ansible_machine_id != hostvars[item]['ansible_machine_id']", 
    "changed": false, 
    "evaluated_to": false, 
    "failed": true, 
    "item": "tmaster"
}

No comments:

Post a Comment