I want to put the node name in a template. I was expecting the variable @hostname to do so but I get the servername instead.
The master node is a debian wheezy with puppet 3.7.5-1puppetlabs1, the node is wheezy with puppet 2.7.23-1~deb7u3.
I tried this template:
hostname=<%= @hostname %>
fqdn=<%= @fqdn %>
servername=<%= @servername %>
I go to the node and I type:
# puppet agent --test
And that is what is generated:
hostname=puppet
fqdn=enquestes.my.domain
servername=puppet.my.domain
I was expecting hostname would return enquestes, and that is what I understand reading this other question:
So I wonder if there is something messed up somewhere. Notice the extra newline after the ''puppet'' hostname. It was not in the template but it gets written in the output. I tried also with:
inline_template('<%= hostname %>')
But it returns puppet instead of the node hostname as I expected.
If I go to the node and I type this:
$ facter | grep -i hostname
I get the expected hostname enquestes. So I wonder maybe I missed something and this is the expected behaviour or is there something wrong in my node or master ?
Thank you for your time.