I have an exec command to change the hostname. I only want to execute that if the hostname is not what it should be:
exec { 'update hostname':
command => 'sudo hostname VM01',
unless => '[[ "$(hostname)" == "VM01" ]]';
}
Now the [[ "$(hostname)" == "VM01" ]]
command seems to work just as expected if I execute it manually but Puppet seems to ignore it.
I also tried:
test "$(hostname)" == "VM01"
test $(hostname) == "VM01"
[ <(hostname) == "VM01" ]
[ hostname == "VM01" ]
Can some one point out my mistake I just don't get it.