I'd like to get an idea on the recommended practice in scenarios where you have a cluster of nodes setup in master/slave(s) mode which needs specific configuration files.
The following setup includes writing a custom fact to retrieve a value from the hostname and then comparing it against a pre-determined host value set in hiera. i.e:
# list of hosts
host01,host02,host03
# custom fact
rank: 01,02,03
# set in hiera
master:01
if $::rank == $master {
class { 'solr::conf::master' : }
} else{
class { 'solr::conf::slave' :
master_fqdn => $master_fqdn,
}
}
I understand that if the master goes down a manual hiera update is required to set the new hiera master value.
i'm keen to know if there other (better) ways of handing this?