Can someone tell me why this works: file { "/etc/sudoers": source => [ "puppet://$server/security/etc/sudoers:${fqdn}", "puppet://$server/security/etc/sudoers" ], owner => root, group => root, mode => 440, } but, this does not: file { "/opt/jboss/current/server/$name/conf/jboss-log4j.xml": template => [ template("elements/jboss_inst/conf/jboss-log4j.xml.${fqdn}.erb"), template("elements/jboss_inst/conf/jboss-log4j.xml.erb") ]; } For the template, puppet complains that the first file does not exist, but for the source one, if the first file does not exist, it will quietly fall through to the second one. Is there another way to do this with templates? Doug -- 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.
Hmm.. Puppet does not support going over multiple templates like it does in plain files. maybe there is even a feature request for it ;) Ohad On Tue, Mar 23, 2010 at 6:34 AM, Douglas Garstang <doug.garstang@gmail.com>wrote:> Can someone tell me why this works: > > file { > "/etc/sudoers": > source => [ > "puppet://$server/security/etc/sudoers:${fqdn}", > "puppet://$server/security/etc/sudoers" > ], > owner => root, group => root, mode => 440, > } > > but, this does not: > > file { > "/opt/jboss/current/server/$name/conf/jboss-log4j.xml": > template => [ > > template("elements/jboss_inst/conf/jboss-log4j.xml.${fqdn}.erb"), > template("elements/jboss_inst/conf/jboss-log4j.xml.erb") > ]; > } > > For the template, puppet complains that the first file does not exist, > but for the source one, if the first file does not exist, it will > quietly fall through to the second one. Is there another way to do > this with templates? > > Doug > > -- > 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<puppet-users%2Bunsubscribe@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. > >-- 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.
Douglas Garstang
2010-Mar-23 05:23 UTC
Re: [Puppet Users] Source and Template file defaults
On Mon, Mar 22, 2010 at 7:15 PM, Ohad Levy <ohadlevy@gmail.com> wrote:> Hmm.. Puppet does not support going over multiple templates like it does in > plain files. > > maybe there is even a feature request for it ;)Aw crap. I''ve been told that twice in the last few days. Is there another way I could emulate this functionality, because I really really need it. Doug. -- 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.
You could probably create your own function, which checks if a file exists and if it does call the template function on it. Ohad On Tue, Mar 23, 2010 at 1:23 PM, Douglas Garstang <doug.garstang@gmail.com>wrote:> On Mon, Mar 22, 2010 at 7:15 PM, Ohad Levy <ohadlevy@gmail.com> wrote: > > Hmm.. Puppet does not support going over multiple templates like it does > in > > plain files. > > > > maybe there is even a feature request for it ;) > > Aw crap. I''ve been told that twice in the last few days. Is there > another way I could emulate this functionality, because I really > really need it. > > Doug. > > -- > 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<puppet-users%2Bunsubscribe@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. > >-- 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.
Douglas Garstang wrote:> On Mon, Mar 22, 2010 at 7:15 PM, Ohad Levy <ohadlevy@gmail.com> wrote:>> Hmm.. Puppet does not support going over multiple templates like it does in >> plain files. >> >> maybe there is even a feature request for it ;) > > Aw crap. I''ve been told that twice in the last few days. Is there > another way I could emulate this functionality, because I really > really need it.You could do it like this: $templ = file("/config/foo/xyzzy.$fqdn.erb", "/config/foo/xyzzy.default.erb") $content = inline_template($templ) file { "/my/file": content => $content; } Unfortunately, the file() function requires paths to be specified with an absolute path, and doesn''t look up paths either via the fileserver.conf modules (like puppet:/// URLs do), or modules in your manifests (like the template() function do). So, it can be done, but it''s not very nice. /Bellman -- 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.
Douglas Garstang
2010-Mar-29 23:56 UTC
Re: [Puppet Users] Source and Template file defaults
On Tue, Mar 23, 2010 at 4:00 AM, Thomas Bellman <bellman@nsc.liu.se> wrote:> Douglas Garstang wrote: > >> On Mon, Mar 22, 2010 at 7:15 PM, Ohad Levy <ohadlevy@gmail.com> wrote: > >>> Hmm.. Puppet does not support going over multiple templates like it does >>> in >>> plain files. >>> >>> maybe there is even a feature request for it ;) >> >> Aw crap. I''ve been told that twice in the last few days. Is there >> another way I could emulate this functionality, because I really >> really need it. > > You could do it like this: > > $templ = file("/config/foo/xyzzy.$fqdn.erb", > "/config/foo/xyzzy.default.erb") > $content = inline_template($templ) > file { > "/my/file": content => $content; > } > > Unfortunately, the file() function requires paths to be specified with > an absolute path, and doesn''t look up paths either via the fileserver.conf > modules (like puppet:/// URLs do), or modules in your manifests (like the > template() function do). So, it can be done, but it''s not very nice.Is this supported in puppet 0.24.x or is it a 0.25 thing? The docs don''t say what version of the puppet they refer to. Doug. -- 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.
Douglas Garstang wrote:> On Tue, Mar 23, 2010 at 4:00 AM, Thomas Bellman <bellman@nsc.liu.se> wrote:>> You could do it like this: >> >> $templ = file("/config/foo/xyzzy.$fqdn.erb", >> "/config/foo/xyzzy.default.erb") >> $content = inline_template($templ) >> file { >> "/my/file": content => $content; >> }[...]> Is this supported in puppet 0.24.x or is it a 0.25 thing? The docs > don''t say what version of the puppet they refer to.The file() function has been there since 0.22.2, but inline_template() didn''t come until 0.24.7. This based on looking through the Git repository for Puppet. /Bellman -- 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.