jim
2012-Nov-20 11:23 UTC
[Puppet Users] Windows Manifest Newline Syntax and Append to file Questions
Hello all, I''m fairly new to puppet and in the majority a windows shop I have two questions 1.) As windows syntax is slight different than linux syntax, how do I create a new line within a bit of content, e.g. hosts file "for windows not linux" e.g. file {''c:/Windows/System32/drivers/etc/hosts'': content => "127.0.0.1 puppet.office \n 127.0.0.1 puppet8081.office", } As it seems to ignore the \n 2.) also can you append to a file, for example your base machines get the standard host file and futher down the tree it goes it might get host entries amended to it. Kind Regards James -- 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/-/IUFifHBoo6IJ. 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.
Josh Cooper
2012-Nov-20 18:26 UTC
Re: [Puppet Users] Windows Manifest Newline Syntax and Append to file Questions
Hi James, On Tue, Nov 20, 2012 at 3:23 AM, jim <stravze@gmail.com> wrote:> Hello all, > > I''m fairly new to puppet and in the majority a windows shop > > I have two questions > > 1.) As windows syntax is slight different than linux syntax, how do I create > a new line within a bit of content, e.g. hosts file "for windows not linux" > > e.g. > > file {''c:/Windows/System32/drivers/etc/hosts'': > content => > "127.0.0.1 puppet.office \n > 127.0.0.1 puppet8081.office", > } > > As it seems to ignore the \nTo manage a text file using native Windows line endings, you''ll want to use \r\n (carriage return, newline). Specifying carriage returns (\r) in the file resources''s content property was fixed in 2.7.20[1], released yesterday[2]. Alternatively, you can create a file containing \r\n on the puppetmaster and then specify the source parameter using a puppet URI, e.g. puppet:///modules/mymodule/hosts With that said, is there a reason you are not using the `host` resource[3]? It should do-the-right-thing on both *nix and windows. Is filesystem redirection causing problems?> 2.) also can you append to a file, for example your base machines get the > standard host file and futher down the tree it goes it might get host > entries amended to it.I imagine this is a common issue when using the `host` resource, I''m curious how other people have solved this.> > Kind Regards > > James > > -- > 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/-/IUFifHBoo6IJ. > 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.Josh [1] http://projects.puppetlabs.com/issues/16119 [2] https://groups.google.com/d/topic/puppet-users/nPkPm3yqo4Q/discussion [3] http://docs.puppetlabs.com/windows/writing.html#hosthost -- Josh Cooper Developer, Puppet Labs -- 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.