Nate Carlson
2011-Mar-25 15:58 UTC
[Puppet Users] Performing text substitution on templates/source files?
Hi! I have a situation where we want to take files from our upstream software vendor, replace Maven-style variables with real data (from variables set based on the environment within Puppet), and then deploy the changed file to the puppet client. Here''s an example upstream configuration: -- begin sql.properties -- sql.store.driver=@jdbc.driver@ sql.store.url=@jdbc.url@ sql.store.user=@jdbc.user@ sql.store.password=@jdbc.password@ sql.store.dbProperties=@jdbc.properties@ -- end sql.properties -- I know that I could change this to erb-style variables and use the ''template'' function to do the text changes, with something like.. -- begin sql.erb -- sql.store.driver=%<= jdbc.driver %> sql.store.url=%<= jdbc.url %> sql.store.user=%<= jdbc.user %> sql.store.password=%<= jdbc.password %> sql.store.dbProperties=%<= jdbc.properties %> -- end sql.erb -- ..but I''d really prefer to keep the files in the same format that they are upstream, so I don''t have to modify the files each time a new upstream version is released. Is there any way to do this besides deploying the file as-is and using the "simple text pattern" changes described at http://npc.me/haWrvF? I know that would work, but it seems like a kludge... ;) Thanks! -Nate -- 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.
Nate Carlson
2011-Mar-25 17:29 UTC
[Puppet Users] Performing text substitution on templates/source files?
Hi! I have a situation where we want to take files from our upstream software vendor, replace Maven-style variables with real data (from variables set based on the environment within Puppet), and then deploy the changed file to the puppet client. Here''s an example upstream configuration: -- begin sql.properties -- sql.store.driver=@jdbc.driver@ sql.store.url=@jdbc.url@ sql.store.user=@jdbc.user@ sql.store.password=@jdbc.password@ sql.store.dbProperties=@jdbc.properties@ -- end sql.properties -- I know that I could change this to erb-style variables and use the ''template'' function to do the text changes, with something like.. -- begin sql.erb -- sql.store.driver=%<= jdbc.driver %> sql.store.url=%<= jdbc.url %> sql.store.user=%<= jdbc.user %> sql.store.password=%<= jdbc.password %> sql.store.dbProperties=%<= jdbc.properties %> -- end sql.erb -- ..but I''d really prefer to keep the files in the same format that they are upstream, so I don''t have to modify the files each time a new upstream version is released. Is there any way to do this besides deploying the file as-is and using the "simple text pattern" changes described at http://npc.me/haWrvF? I know that would work, but it seems like a kludge... ;) Thanks! -Nate -- 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.
Denmat
2011-Mar-25 21:50 UTC
Re: [Puppet Users] Performing text substitution on templates/source files?
Hi, You can think of using augeas but you''ll need to create your own ''lens''. Never made one myself so not sure of the effort involved. Cheers, On 26/03/2011, at 2:58, Nate Carlson <puppet@natecarlson.com> wrote:> Hi! > > I have a situation where we want to take files from our upstream software vendor, replace Maven-style variables with real data (from variables set based on the environment within Puppet), and then deploy the changed file to the puppet client. > > Here''s an example upstream configuration: > > -- begin sql.properties -- > sql.store.driver=@jdbc.driver@ > sql.store.url=@jdbc.url@ > sql.store.user=@jdbc.user@ > sql.store.password=@jdbc.password@ > sql.store.dbProperties=@jdbc.properties@ > -- end sql.properties -- > > I know that I could change this to erb-style variables and use the ''template'' function to do the text changes, with something like.. > > -- begin sql.erb -- > sql.store.driver=%<= jdbc.driver %> > sql.store.url=%<= jdbc.url %> > sql.store.user=%<= jdbc.user %> > sql.store.password=%<= jdbc.password %> > sql.store.dbProperties=%<= jdbc.properties %> > -- end sql.erb -- > > ..but I''d really prefer to keep the files in the same format that they are upstream, so I don''t have to modify the files each time a new upstream version is released. > > Is there any way to do this besides deploying the file as-is and using the "simple text pattern" changes described at http://npc.me/haWrvF? I know that would work, but it seems like a kludge... ;) > > Thanks! > > -Nate > > -- > 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 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.