I''ve not quite figured out how to do complex templating in puppet yet. The dhcpd config file is a good example. I want to add an arbitrary number of new host entries to it. I can''t use regular templates because the number of entries is not fixed, and there''s that darn curly brace at the end of the group. group { next-server 10.10.4.46; filename "/pxelinux.0"; host test01 { hardware ethernet 00:0c:29:4d:37:04; fixed-address 10.10.4.48; } } Anyone know how I could do this? 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" <doug.garstang@gmail.com> wrote:> I''ve not quite figured out how to do complex templating in puppet > yet. > > The dhcpd config file is a good example. I want to add an arbitrary > number of new host entries to it. I can''t use regular templates > because the number of entries is not fixed, and there''s that darn > curly brace at the end of the group. > > group { > next-server 10.10.4.46; > filename "/pxelinux.0"; > > host test01 { > hardware ethernet 00:0c:29:4d:37:04; > fixed-address 10.10.4.48; > } > } > > Anyone know how I could do this?I find concatenated snippets work well for this kind of problem. http://github.com/ripienaar/puppet-concat -- R.I.Pienaar -- 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.
Thanks. Totally lost by how to use it though. On Sat, Jun 26, 2010 at 3:59 PM, R.I.Pienaar <rip@devco.net> wrote:> > ----- "Douglas Garstang" <doug.garstang@gmail.com> wrote: > >> I''ve not quite figured out how to do complex templating in puppet >> yet. >> >> The dhcpd config file is a good example. I want to add an arbitrary >> number of new host entries to it. I can''t use regular templates >> because the number of entries is not fixed, and there''s that darn >> curly brace at the end of the group. >> >> group { >> next-server 10.10.4.46; >> filename "/pxelinux.0"; >> >> host test01 { >> hardware ethernet 00:0c:29:4d:37:04; >> fixed-address 10.10.4.48; >> } >> } >> >> Anyone know how I could do this? > > I find concatenated snippets work well for this kind of problem. > > http://github.com/ripienaar/puppet-concat > > -- > R.I.Pienaar > > -- > 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. > >-- Regards, Douglas Garstang http://www.linkedin.com/in/garstang Email: doug.garstang@gmail.com Cell: +1-805-340-5627 -- 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" <doug.garstang@gmail.com> wrote:> Thanks. Totally lost by how to use it though.there''s an example on the page, and I am sure if you take the time to try a bit you''ll work it out. It''s also extensively commented. -- R.I.Pienaar -- 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.
"R.I.Pienaar" <rip@devco.net> writes:> ----- "Douglas Garstang" <doug.garstang@gmail.com> wrote: > >> I''ve not quite figured out how to do complex templating in puppet yet. >> >> The dhcpd config file is a good example. I want to add an arbitrary >> number of new host entries to it. I can''t use regular templates >> because the number of entries is not fixed, and there''s that darn >> curly brace at the end of the group. >> >> group { >> next-server 10.10.4.46; >> filename "/pxelinux.0"; >> >> host test01 { >> hardware ethernet 00:0c:29:4d:37:04; >> fixed-address 10.10.4.48; >> } >> } >> >> Anyone know how I could do this? > > I find concatenated snippets work well for this kind of problem. > http://github.com/ripienaar/puppet-concat*nod* They are pretty much the best solution available at this time. Daniel -- ✣ Daniel Pittman ✉ daniel@rimspace.net ☎ +61 401 155 707 ♽ made with 100 percent post-consumer electrons -- 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 Sat, Jun 26, 2010 at 8:00 PM, Daniel Pittman <daniel@rimspace.net> wrote:> "R.I.Pienaar" <rip@devco.net> writes: >> ----- "Douglas Garstang" <doug.garstang@gmail.com> wrote: >> >>> I''ve not quite figured out how to do complex templating in puppet yet. >>> >>> The dhcpd config file is a good example. I want to add an arbitrary >>> number of new host entries to it. I can''t use regular templates >>> because the number of entries is not fixed, and there''s that darn >>> curly brace at the end of the group. >>> >>> group { >>> next-server 10.10.4.46; >>> filename "/pxelinux.0"; >>> >>> host test01 { >>> hardware ethernet 00:0c:29:4d:37:04; >>> fixed-address 10.10.4.48; >>> } >>> } >>> >>> Anyone know how I could do this? >> >> I find concatenated snippets work well for this kind of problem. >> http://github.com/ripienaar/puppet-concat > > *nod* They are pretty much the best solution available at this time. > DanielI must be missing something fundamental then, because I am getting this: Could not run Puppet configuration client: Could not find dependent Exec[concat_/tmp/foo] for File[/_tmp_foo/fragments/10__tmp_foo] at /etc/puppet/modules/concat/manifests/fragment.pp:45 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 <doug.garstang@gmail.com> writes:> On Sat, Jun 26, 2010 at 8:00 PM, Daniel Pittman <daniel@rimspace.net> wrote: >> "R.I.Pienaar" <rip@devco.net> writes: >>> ----- "Douglas Garstang" <doug.garstang@gmail.com> wrote: >>> >>>> I''ve not quite figured out how to do complex templating in puppet yet.[...]>>>> Anyone know how I could do this? >>> >>> I find concatenated snippets work well for this kind of problem. >>> http://github.com/ripienaar/puppet-concat >> >> *nod* They are pretty much the best solution available at this time. > > I must be missing something fundamental then, because I am getting this: > > Could not run Puppet configuration client: Could not find dependent > Exec[concat_/tmp/foo] for File[/_tmp_foo/fragments/10__tmp_foo] at > /etc/puppet/modules/concat/manifests/fragment.pp:45Did you follow the examples in the documentation of the module, and that R.I.Pienaar pointed you to? Can you post the code that isn''t working for you? My guess is that you have not included the setup and overall file target sections, only a fragment, but without seeing what you wrote we could only guess at what you had actually done... Daniel -- ✣ Daniel Pittman ✉ daniel@rimspace.net ☎ +61 401 155 707 ♽ made with 100 percent post-consumer electrons -- 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 Sun, Jun 27, 2010 at 3:20 AM, Daniel Pittman <daniel@rimspace.net> wrote:> Douglas Garstang <doug.garstang@gmail.com> writes: >> On Sat, Jun 26, 2010 at 8:00 PM, Daniel Pittman <daniel@rimspace.net> wrote: >>> "R.I.Pienaar" <rip@devco.net> writes: >>>> ----- "Douglas Garstang" <doug.garstang@gmail.com> wrote: >>>> >>>>> I''ve not quite figured out how to do complex templating in puppet yet. > > [...] > >>>>> Anyone know how I could do this? >>>> >>>> I find concatenated snippets work well for this kind of problem. >>>> http://github.com/ripienaar/puppet-concat >>> >>> *nod* They are pretty much the best solution available at this time. >> >> I must be missing something fundamental then, because I am getting this: >> >> Could not run Puppet configuration client: Could not find dependent >> Exec[concat_/tmp/foo] for File[/_tmp_foo/fragments/10__tmp_foo] at >> /etc/puppet/modules/concat/manifests/fragment.pp:45 > > Did you follow the examples in the documentation of the module, and that > R.I.Pienaar pointed you to? > > Can you post the code that isn''t working for you? > > My guess is that you have not included the setup and overall file target > sections, only a fragment, but without seeing what you wrote we could only > guess at what you had actually done...Using the simple use case example in the comments at the top of concat/init.pp, simply, node ''test01.fr.xxx.com'' { concat::fragment{ "foo.com_config": target => "/etc/somefile", content => template("dhcp/host.erb"); } } That''s it. I figured it would take the contents of dhcp/host.erb and append it to /etc/somefile, but instead I get the error: Could not run Puppet configuration client: Could not find dependent Exec[concat_/etc/named.conf] for File[/_etc_named.conf/fragments/10_foo.com_config] at /etc/puppet/modules/concat/manifests/fragment.pp:45 And .... now that I think about it... isn''t this incredibly inefficient? Doesn''t the client basically have to reconstruct the file from scratch every time? 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" <doug.garstang@gmail.com> wrote:> On Sun, Jun 27, 2010 at 3:20 AM, Daniel Pittman <daniel@rimspace.net> > wrote: > > Douglas Garstang <doug.garstang@gmail.com> writes: > >> On Sat, Jun 26, 2010 at 8:00 PM, Daniel Pittman > <daniel@rimspace.net> wrote: > >>> "R.I.Pienaar" <rip@devco.net> writes: > >>>> ----- "Douglas Garstang" <doug.garstang@gmail.com> wrote: > >>>> > >>>>> I''ve not quite figured out how to do complex templating in > puppet yet. > > > > [...] > > > >>>>> Anyone know how I could do this? > >>>> > >>>> I find concatenated snippets work well for this kind of problem. > >>>> http://github.com/ripienaar/puppet-concat > >>> > >>> *nod* They are pretty much the best solution available at this > time. > >> > >> I must be missing something fundamental then, because I am getting > this: > >> > >> Could not run Puppet configuration client: Could not find > dependent > >> Exec[concat_/tmp/foo] for File[/_tmp_foo/fragments/10__tmp_foo] at > >> /etc/puppet/modules/concat/manifests/fragment.pp:45 > > > > Did you follow the examples in the documentation of the module, and > that > > R.I.Pienaar pointed you to? > > > > Can you post the code that isn''t working for you? > > > > My guess is that you have not included the setup and overall file > target > > sections, only a fragment, but without seeing what you wrote we > could only > > guess at what you had actually done... > > Using the simple use case example in the comments at the top of > concat/init.pp, simply, > > node ''test01.fr.xxx.com'' { > concat::fragment{ > "foo.com_config": > target => "/etc/somefile", > content => template("dhcp/host.erb"); > } > } > > That''s it. I figured it would take the contents of dhcp/host.erb and > append it to /etc/somefile, but instead I get the error:you''re basically just failing completely at reading documentation in the code or examples given on the github page. This is a recurring theme in your mails.> And .... now that I think about it... isn''t this incredibly > inefficient? Doesn''t the client basically have to reconstruct the > file from scratch every time?it''s not particularly inefficient, a couple of extra exec''s isn''t going to kill anyone. I build machines with 500+ fragments and they execute very quick, especially on 0.25. A machine - low spec virtual machine - with 400 concat fragments: Jun 27 23:30:32 bacula1 puppetd[8668]: Finished catalog run in 39.74 seconds -- 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 Sun, Jun 27, 2010 at 3:51 PM, R.I.Pienaar <rip@devco.net> wrote:> > ----- "Douglas Garstang" <doug.garstang@gmail.com> wrote: > >> On Sun, Jun 27, 2010 at 3:20 AM, Daniel Pittman <daniel@rimspace.net> >> wrote: >> > Douglas Garstang <doug.garstang@gmail.com> writes: >> >> On Sat, Jun 26, 2010 at 8:00 PM, Daniel Pittman >> <daniel@rimspace.net> wrote: >> >>> "R.I.Pienaar" <rip@devco.net> writes: >> >>>> ----- "Douglas Garstang" <doug.garstang@gmail.com> wrote: >> >>>> >> >>>>> I''ve not quite figured out how to do complex templating in >> puppet yet. >> > >> > [...] >> > >> >>>>> Anyone know how I could do this? >> >>>> >> >>>> I find concatenated snippets work well for this kind of problem. >> >>>> http://github.com/ripienaar/puppet-concat >> >>> >> >>> *nod* They are pretty much the best solution available at this >> time. >> >> >> >> I must be missing something fundamental then, because I am getting >> this: >> >> >> >> Could not run Puppet configuration client: Could not find >> dependent >> >> Exec[concat_/tmp/foo] for File[/_tmp_foo/fragments/10__tmp_foo] at >> >> /etc/puppet/modules/concat/manifests/fragment.pp:45 >> > >> > Did you follow the examples in the documentation of the module, and >> that >> > R.I.Pienaar pointed you to? >> > >> > Can you post the code that isn''t working for you? >> > >> > My guess is that you have not included the setup and overall file >> target >> > sections, only a fragment, but without seeing what you wrote we >> could only >> > guess at what you had actually done... >> >> Using the simple use case example in the comments at the top of >> concat/init.pp, simply, >> >> node ''test01.fr.xxx.com'' { >> concat::fragment{ >> "foo.com_config": >> target => "/etc/somefile", >> content => template("dhcp/host.erb"); >> } >> } >> >> That''s it. I figured it would take the contents of dhcp/host.erb and >> append it to /etc/somefile, but instead I get the error: > > you''re basically just failing completely at reading documentation in the code or examples given on the github page. This is a recurring theme in your mails.Normally you could expect a simple use case to work just fine. The documentation on the github page is way more complex than I need. If I just extract the bit I need from the documentation in readme.markdown, I get: concat::fragment{"motd_fragment_$name": target => "/etc/motd", content => " -- $body\n" } which is basically how it''s documented in init.pp, and the same as what I am trying to do. 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.