Ask Your Question

how to set up nodes names dynamically

asked 2014-04-23 13:49:43 -0600

wilsonwilson gravatar image


I would like to name dynamically my nodes in my manifests/nodes.pp

I have a hiera file which contains :

postgresql: "postgresql"

My manifests/nodes.pp contains :

$postgresql = hiera('postgresql')


node "$postgresql" {
 include postgresql::install

but when i run my scrip Puppet don't read the hiera file, I have this error :

Error: Could not parse for environment production: Syntax error at ' ' at /home/user/puppet/manifests/nodes.pp:11 on node postgresql.home

Have anyone already had this problem? and succed to solve it?

Thanks, Wilson.

edit retag flag offensive close merge delete


From the information presented, I suspect that you are approaching whatever problem you are trying to solve in a difficult or even wrong way. Can you elaborate on the greater design scheme?

ffrank gravatar imageffrank ( 2014-04-23 14:09:36 -0600 )edit

Ok, so just don't think about my hiera file. How to define a node name in a var in manifests/node.pp? $nodeName = "myNodeName" node "$nodeName"{ include things::for::this::node } Thanks, Wilson.

wilsonwilson gravatar imagewilsonwilson ( 2014-04-24 02:44:43 -0600 )edit

Not saying that this was not possible (I'll check), I still cannot yet fathom why it would ever be useful.

ffrank gravatar imageffrank ( 2014-04-24 08:35:22 -0600 )edit

it's easier to set up my scripts with a tuto if you only have a hiera file to write

wilsonwilson gravatar imagewilsonwilson ( 2014-04-24 08:45:02 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2014-04-25 06:14:04 -0600

t0m gravatar image

You can't do that.

Can you take a step back explain what you're trying to achieve so that we can help with how to achieve it - your specific question implies that you're probably trying to do something in a way that puppet isn't designed to work.

edit flag offensive delete link more


you don't need explaination, it's just a question, and pretty clear, i can't explain more

wilsonwilson gravatar imagewilsonwilson ( 2014-04-29 06:25:35 -0600 )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: 2014-04-23 13:49:43 -0600

Seen: 61 times

Last updated: Apr 25 '14