Machine Guid/Uuid that is unique to each operating system that never changes?



  • Salt uses your computer hostname as the minion id but that can be annoying if you ever end up changing your hostname after. You would end up having to change the minion id and on the salt master, you will need to accept the new minion id and remove the old minion id. You could create a script that makes the changes to the minion id file, restart the service and have salt master automatically accept the new minion and remove the old minion. If you were to use a unique Guid or UUID as the minion id then you can avoid this.

    From a Windows systems, which value is unique that never changes?

    # This won't change unless you reinstall
    Get-ItemProperty -Path Registry::HKLM\SOFTWARE\Microsoft\Cryptography | Select-Object -ExpandProperty MachineGuid
    

    OR

    # Both command shows the same the UUID value
    Get-WmiObject -Class Win32_ComputerSystemProduct | Select-Object -ExpandProperty UUID
    
    - OR -
    
    (Get-CimInstance -Class Win32_ComputerSystemProduct).UUID
    

    From a Linux systems, which value is unique that never changes?

    # This won't change unless you reinstall or use the systemd-machine-id-setup command
    cat /etc/machine-id
    

    OR

    # Both command shows the same the UUID value
    sudo dmidecode -s system-uuid
    
    - OR -
    
    sudo cat /sys/class/dmi/id/product_uuid
    

Log in to reply