Inside templates you have access to a scope object. All of the functions that you can access in the puppet manifests can be accessed via that scope object, although not via the same name. Prepend "function_"
to the beginning of the function name. For example, here I included one template inside another: <%= scope.function_template("template2.erb") %>
http://reductivelabs.com/trac/puppet/wiki/PuppetTemplating has great documentation about the scope object inside templates. For really deep information about template and functions you can look inside lib/puppet/parser/templatewrapper.rb
and lib/puppet/parser/functions.rb
.
Aaah, Puppet hostname detection. What a nightmare...
By default, what name will be used to find which node
definition to use is based on the contents of the fqdn fact. What that actually maps to is dependent on a few different things, and yes, reverse DNS is one of them -- and it's preferred over the machine's own hostname!
However, this name (usually) only applies at certificate generation time. You're actually misusing the node_name
variable -- it should be set to one of 'cert' or 'facter'. The fqdn
parameter is also deprecated.
What you actually want to do is set the certname
parameter on the client to the node name you want to use, and then set node_name
to cert
(or just leave it out, since cert
is the default). This will take the node name from the CN of the certificate that the client presents, and the certname
parameter makes sure that's set to something reasonable rather than whatever facter decides to come up with on it's own. Unfortunately, since you've already got "wrong" certs created, you'll need to regenerate those certs (rm -rf /var/lib/puppet/ssl
on the client and re-run Puppet) after you've setup the config, so that the right certs get created and used.
If this all sounds a little complicated, you're right -- it is. Welcome to Puppet.
Best Answer
if your problem is the lack of a proper DNS server, using /etc/hosts should work, you can then use puppet for keeping /etc/hosts in sync :-)