Hi,

What I'd recommend is the following in your puppet manifest just
before the template() call to your file :

$fqdn = downcase($::fqdn)

...and that's it. You will need to puppetlabs-stdlib module.

The other solution is to use ruby inside your erb template, with this
as the first line of the file for example :

<% fqdn = scope.lookupvar('::fqdn').downcase -%>

Then use "fqdn" (the local ruby variable) instead of "@fqdn" (the
puppet variable) in your <%= fqdn %>.

Matthias

On Thu, 7 Aug 2014 09:09:44 -0700 (PDT)
Linwood Johnson <[email protected]> wrote:

> I have created a module for my environment that would control the
> content and formatting of the puppet.conf file on my nodes however I
> have ran into a problem with this.  The problem is, I have a few
> servers out in my environment that was built with their hostnames in
> all caps. What happens is that when I first connected them to the
> puppet master and they created their certs everything is in lower
> case but when the puppet.conf controlling module is applied to the
> server, the certname in the puppet.conf file on the node gets changed
> to the All Caps name which brakes its communication to the puppet
> master. For application reasons I can't change the hostname from All
> Caps back to lower case so how can I modify my template so that it
> would populate the certname with the FQDN in lower case letters?
>  
> So for example:
>  
> The certname in the puppet.conf file is helpme.puppethelp.com but
> when my module is applied it changes the certname to
> HELPME.puppethelp.com  - I know that with the <%= fqdn %> variable,
> this is getting it from facter which is querying /etc/hosts
>  
>  
> Below is my templale for the puppet.conf file.
> [main]
>     # The Puppet log directory.
>     # The default value is '$vardir/log'.
>     logdir = /var/log/puppet
>     # Where Puppet PID files are kept.
>     # The default value is '$vardir/run'.
>     rundir = /var/run/puppet
>     # Where SSL certificates are kept.
>     # The default value is '$confdir/ssl'.
>     ssldir = $vardir/ssl
> [agent]
>     # The file in which puppetd stores a list of the classes
>     # associated with the retrieved configuratiion.  Can be loaded in
>     # the separate ``puppet`` executable using the ``--loadclasses``
>     # option.
>     # The default value is '$confdir/classes.txt'.
>     classfile = $vardir/classes.txt
>     # Where puppetd caches the local configuration.  An
>     # extension indicating the cache format is added automatically.
>     # The default value is '$confdir/localconfig'.
>     localconfig = $vardir/localconfig
>     certname = <%= fqdn %>
>     server =  <%= puppetserver %>
>     pluginsync = true
>     report = true
>     graph = true
>  
> Thanks for your help.
> 



-- 
            Matthias Saou                  ██          ██
                                             ██      ██
Web: http://matthias.saou.eu/              ██████████████
Mail/XMPP:  [email protected]             ████  ██████  ████
                                       ██████████████████████
GPG: 4096R/E755CC63                    ██  ██████████████  ██
     8D91 7E2E F048 9C9C 46AF          ██  ██          ██  ██
     21A9 7A51 7B82 E755 CC63                ████  ████

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/20140808115141.11e53255%40r2d2.marmotte.net.
For more options, visit https://groups.google.com/d/optout.

Reply via email to