Ask Your Question

puppet.conf add hostname var environment

asked 2016-09-30 08:35:43 -0500

sayannara gravatar image

I am a Puppet beginner and I can't figure out how I could use an environnent variable in /etc/puppetlab/puppet/puppet.conf to set the certname variable. I would like to use the hostname environnent variable for the certname. I could then deploy a new VM and not need to change every times.

Thank you

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted

answered 2016-09-30 11:59:26 -0500

lupin gravatar image

certname and environment have different meaning and use on puppet. The former is normally translate to your nodes FQDN and the latter for the Puppet Environment which the node will be belong. ie, production, development - production being the default unless you set it explicitly.

A basic content of puppet.conf for a client node would look like this.

server = <your_puppet_master>
certname = <agent_FQDN>
environment = production
edit flag offensive delete link more


Yes of course. I'm sorry I meant the hostname variable of the system. [agent] server = myserver.fqdn certname = $hostname environment = production Thank you

sayannara gravatar imagesayannara ( 2016-10-02 17:40:27 -0500 )edit

the hostname variable is managed by facter on your instances. If you type facter hostname on each of your instances, you'll see the value that puppet would get from using $::hostname within your manifest

DarylW gravatar imageDarylW ( 2016-10-03 12:30:09 -0500 )edit

answered 2016-10-03 09:22:55 -0500

reesek gravatar image

Sounds like your bootstrapping the puppet agent directly into your VM template. You're probably better off performing the puppet agent install as part of the firstboot or some self destructing script. In our case, we're looking to shift server deployments over to Razor, which installs the puppet agent as a post installation step during the kickstart process.

edit flag offensive delete link more

answered 2016-10-03 10:05:20 -0500

sayannara gravatar image

Sounds like your bootstrapping the puppet agent directly into your VM template. Yes exactly

At the moment we only have a few Linux servers. I have no idea of what is a "selft destructing script", "shift server", "Razo". I'm using VMware to host and deploy VM.

Is there any ID I should remove before creating the Template ? I would definitely prefer to adding it to the Template.

edit flag offensive delete link more


I don't know that the type of variable interpolation that you're looking to do is available. What I was suggesting was to bake a start up script into your template that installs the puppet agent the 1st time the VM comes to life, & deletes itself after validating the puppet agent has been installed.

reesek gravatar imagereesek ( 2016-10-04 14:52:37 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2016-09-30 08:35:43 -0500

Seen: 89 times

Last updated: Oct 03 '16