Jared Curtis
2012-May-04 23:23 UTC
[Puppet Users] Template populated from multiple defines
I''m trying to create a file similar to this <Users "admin"> <user "user1"> Name User One Phone 1112223333 </user> <user "user2"> Name User Two </user> </Users> I want to be able to add users in this fashion app::users { ''user1'': name => ''User One'', phone => ''1112223333''; ''user2'': name => ''User Two''; } Then use a template to create the actual file. I''ve done something similar to this in the past by using hashes but it seems like a hack and doesn''t cleanly express what variables are available to be set. Anyone have any suggestions on the best way to make this work? -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/tgapeB5oEpYJ. 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.
jcbollinger
2012-May-07 12:50 UTC
[Puppet Users] Re: Template populated from multiple defines
On May 4, 6:23 pm, Jared Curtis <ja...@shift-e.info> wrote:> I''m trying to create a file similar to this > <Users "admin"> > <user "user1"> > Name User One > Phone 1112223333 > </user> > <user "user2"> > Name User Two > </user> > </Users> > > I want to be able to add users in this fashion > app::users { > ''user1'': name => ''User One'', phone => ''1112223333''; > ''user2'': name => ''User Two'';} > > Then use a template to create the actual file. I''ve done something similar > to this in the past by using hashes but it seems like a hack and doesn''t > cleanly express what variables are available to be set. > > Anyone have any suggestions on the best way to make this work?I know no good way to make it work. An instance of a defined type represents something managed on the client, whereas a template is evaluated on the server. It may be that you could cobble the two together, but in the end you''d just be putting a complicated wrapper around exactly the same thing you were doing before. I don''t see what would be gained. John -- 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.
Gabriel Filion
2012-May-07 16:09 UTC
Re: [Puppet Users] Template populated from multiple defines
On 12-05-04 07:23 PM, Jared Curtis wrote:> I''m trying to create a file similar to this > <Users "admin"> > <user "user1"> > Name User One > Phone 1112223333 > </user> > <user "user2"> > Name User Two > </user> > </Users> > > I want to be able to add users in this fashion > app::users { > ''user1'': name => ''User One'', phone => ''1112223333''; > ''user2'': name => ''User Two''; > } > Then use a template to create the actual file. I''ve done something > similar to this in the past by using hashes but it seems like a hack and > doesn''t cleanly express what variables are available to be set. > > Anyone have any suggestions on the best way to make this work?The only way that I could think of doing this would be by using a concatenated file[1]. Each define would create a morcel that would get concatenated to the "main part" (rest of the structure) for the final result. https://github.com/ripienaar/puppet-concat -- Gabriel Filion -- 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.