I have configured two machines to do a warm standby so that machine 2 can take the ip of machine 1 if that should fail and become its replacement. sadly, thats not enough, i need to change the hostname/fqdn too because some software relies on the local hostname and crashes if the hostname is different after the failover. so the question is: how do i change my hostname and change it back once machine 1 is back on track?
Generally speaking, you can write a script which performs the necessary hostname changes to the system - both ways - and use that as a service that your failover configuration uses. If you are using the heartbeat software the /etc/ha.d/resource.d/MailTo script is a fine place to start looking for an example.
There are quite a few example resource scripts here: http://www.linux-ha.org/wiki/Resource_Agents