Ask Your Question
1

Using array in template for file resource

asked 2014-01-24 11:45:20 -0500

Gigi Mathews gravatar image

updated 2014-01-25 02:44:29 -0500

doc75 gravatar image

I am trying to use array in template for file resource

file { "/tmp/foo.bar":
  content => [template("puppet:///modules/foobar/foo.bar.$hostname.erb"),
              template("puppet:///modules/foobar/foo.bar.$servertype.erb"),
              template("puppet:///modules/foobar/foo.bar.erb")],
}

I receive following error

err: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find template 'puppet:///modules/foobar/foo.bar.server1.erb' at /etc/puppet/modules/foobar/manifests/foobar.pp:16 on node server1.domain.local warning: Not using cache on failed catalog err: Could not retrieve catalog; skipping run

What am i doing wrong ?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2014-01-24 15:07:42 -0500

spuder gravatar image

updated 2014-01-25 20:07:14 -0500

Puppet templates have a different syntax than puppet files

Remove puppet:///module from the beginning

template('foobar/foo.bar.erb')

http://docs.puppetlabs.com/guides/templating.html

Puppet briefly mentions this difference in their learning puppet tutorial, and apologizes for making templates and files have different syntax.

Note that the path to the template doesn’t use the same semantics as the path in a puppet:/// URL. Sorry about the inconsistency. Link

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-01-24 11:45:20 -0500

Seen: 326 times

Last updated: Jan 25 '14