Hello list, I am having a problem with template file. Why are variables not interpolated? [root@puppet manifests]# cat /etc/motd memory free = <%= memoryfree %> domain = <%= domain %> operating system = <%= operatingsystem %> This is the template file [root@puppet manifests]# cat ../templates/motd.erb memory free = <%= memoryfree %> domain = <% domain %> operating system = <% operatingsystem %> This is the puppet resource [root@puppet manifests]# cat /etc/puppet/manifests/motd.pp file { "/etc/motd": group => ''root'', owner => ''root'', mode => ''440'', source => "/etc/puppet/templates/motd.erb" } thanks in advance tim -- GPG me!! gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On 2011-11-29 15:37 , Tim Dunphy wrote:> Hello list, > > I am having a problem with template file. Why are variables not interpolated? > > [root@puppet manifests]# cat /etc/motd > memory free = <%= memoryfree %> > domain = <%= domain %> > operating system = <%= operatingsystem %> > > This is the template file > > [root@puppet manifests]# cat ../templates/motd.erb > memory free = <%= memoryfree %> > domain = <% domain %> > operating system = <% operatingsystem %> > > This is the puppet resource > > [root@puppet manifests]# cat /etc/puppet/manifests/motd.pp > file { "/etc/motd": > group => ''root'', > owner => ''root'', > mode => ''440'', > source => "/etc/puppet/templates/motd.erb" > } > > > thanks in advance > timYou need to tell Puppet that it''s actually a template, not a raw file. Try something like this? file { "/etc/motd": group => ''root'', owner => ''root'', mode => ''440'', content => template("motd.erb"), } -- Jacob Helwig http://about.me/jhelwig
Jacob, Thank you that worked! [root@puppet manifests]# cat motd.pp file { "/etc/motd": group => ''root'', owner => ''root'', mode => ''440'', content => template("/etc/puppet/templates/motd.erb") } [root@puppet manifests]# cat /etc/motd memory free = 389.88 MB domain = jokefire.com operating system = CentOS On Tue, Nov 29, 2011 at 6:39 PM, Jacob Helwig <jacob@puppetlabs.com> wrote:> On 2011-11-29 15:37 , Tim Dunphy wrote: >> Hello list, >> >> I am having a problem with template file. Why are variables not interpolated? >> >> [root@puppet manifests]# cat /etc/motd >> memory free = <%= memoryfree %> >> domain = <%= domain %> >> operating system = <%= operatingsystem %> >> >> This is the template file >> >> [root@puppet manifests]# cat ../templates/motd.erb >> memory free = <%= memoryfree %> >> domain = <% domain %> >> operating system = <% operatingsystem %> >> >> This is the puppet resource >> >> [root@puppet manifests]# cat /etc/puppet/manifests/motd.pp >> file { "/etc/motd": >> group => ''root'', >> owner => ''root'', >> mode => ''440'', >> source => "/etc/puppet/templates/motd.erb" >> } >> >> >> thanks in advance >> tim > > You need to tell Puppet that it''s actually a template, not a raw file. > Try something like this? > > file { "/etc/motd": > group => ''root'', > owner => ''root'', > mode => ''440'', > content => template("motd.erb"), > } > > -- > Jacob Helwig > http://about.me/jhelwig >-- GPG me!! gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.