Juan José Presa Rodal
2012-Jan-23 12:10 UTC
[Puppet Users] Conditionally replace in file type
Hello, I''m making the deployment of an application configuration as follows: file {"/home/user/foo/bar": ensure => directory, recurse => remote, source => "puppet:///configs/${hostname}/home/user/foo/bar", ignore => ["file1.cfg","file2.cfg"], } I am ignoring these two files ("file1.cfg","file2.cfg"), cause they are dynamically modified by the application. So, not puppet managed. And here''s my problem. Because on the other hand I have to initialize both files in the first run. What can I do? Is there any way of mix "ignore" and "replace" parameters? PS: I cannot define other resource with the path of not-managed files, because depending on hostname that path changes. Thanks in advance and apolgize my poor english! ;) -- 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/-/HYtz0hP88Y8J. 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.
>I am ignoring these two files ("file1.cfg","file2.cfg"), cause they are dynamically modified by the application. So, not puppet managed. >And here''s my problem. Because on the other hand I have to initialize both files in the first run.first application run? How would you generally initialize them manually? Asking to get better idea of the problem. -- Krish olindata.com -- 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.
Daniel Pittman
2012-Jan-26 22:28 UTC
Re: [Puppet Users] Conditionally replace in file type
On Thu, Jan 26, 2012 at 13:35, krish <das.srikrishna@gmail.com> wrote:>>I am ignoring these two files ("file1.cfg","file2.cfg"), cause they are dynamically modified by the application. So, not puppet managed. >>And here''s my problem. Because on the other hand I have to initialize both files in the first run. > > first application run? > How would you generally initialize them manually?The right answer to these problems is almost always that you have a `file { ".../foo": ensure => present }` resource in Puppet: that will put it in place if the file is not present, using whatever source you give, but will not touch the content of an existing file. If you are using a recursive file resource to put the rest of the content in place around this, no problem, because the more specific file resource will override the recursive one, and you won''t overwrite. :) -- Daniel Pittman ⎋ Puppet Labs Developer – http://puppetlabs.com ♲ 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.
Juan José Presa Rodal
2012-Jan-26 22:54 UTC
Re: [Puppet Users] Conditionally replace in file type
Ok Daniel, thanks for your reply, but I have not control about these individual "noreplace" files because are $hostname dependent. In different hostnames, have different source locations so I cannot define them in a specific way. E.g: hostname1/home/user/foo/bar/johndoe05/file1.cfg hostname2/home/user/foo/bar/maryjoe02/file1.cfg That was the reason for I need something recursive, similar to ignore parameter. (Or a workaround) Thanks! -- 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/-/B6T9Me-vja4J. 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.
Daniel Pittman
2012-Jan-31 01:22 UTC
Re: [Puppet Users] Conditionally replace in file type
2012/1/26 Juan José Presa Rodal <juanjop@gmail.com>: (I noted that; since this topic was followed up elsewhere I figured to repeat myself. :)> Ok Daniel, thanks for your reply, but I have not control about these > individual "noreplace" files because are $hostname dependent.Generally, what we would encourage is then that you define them on a per-hostname basis. You can do that at the node level, or you can push that down through a define or parameterized class, but the key is to model that - on a per host basis. I assume you meant "they are different on every host", rather than literally being a file with the hostname in it; for that you could just go with `file { "/path/to/${hostname}.cfg": ... }` to define the files. :)> hostname1/home/user/foo/bar/johndoe05/file1.cfg > hostname2/home/user/foo/bar/maryjoe02/file1.cfg > > That was the reason for I need something recursive, similar to ignore > parameter. (Or a workaround)Define them per-node. :) node hostname1 { # define it in the node include common::stuff file { "/home/user/foo/bar/johndoe05/file1.cfg": ... } # use a parameterized class class { "something::else": configpath => "/home/user/foo/bar/johndoe05" } # ...or a define. some::define { "whatever": configpath => "/home/user/foo/bar/johndoe05" } } -- Daniel Pittman ⎋ Puppet Labs Developer – http://puppetlabs.com ♲ 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.