You may try to create a file/fact for puppet to indicate that it
shouldn't touch that folder on that computer. Other than that no ideas,
but again post a more concrete usage scenario. Also maybe puppet isn't
the right tool for you since it works by ensuring some specific
settings, not allowing local changes. Maybe you need to generalize you
manifests instead of allowing local changes.
Welcome to puppet ;) ,
Silviu
- I'd like puppet to let user change some files in the skeleton as they want, i.e. skip this directory if it just existsDo you have an idea about how I could do that ?
Change the ownership of the files on the server (but this implies that the users exists on the server too). Second what puppet version? There were some bugs in older versions that made puppet hash all the files in a folder if the folder was maintained by puppet, maybe that's the problem in your case. Also try changing the hash property of file. If you want that folder under a certain user you should allow puppet to ensure that.
This is not possible, and would break the way puppet works if it were to be implemented. Usually local changes can be integrated through the use of the concat module (see puppet forge). But I don't know your real usage of the files so it may be different. If you post what you need to do maybe someone would give you a better idea of achieving just that.
You may try to create a file/fact for puppet to indicate that it shouldn't touch that folder on that computer. Other than that no ideas, but again post a more concrete usage scenario. Also maybe puppet isn't the right tool for you since it works by ensuring some specific settings, not allowing local changes. Maybe you need to generalize you manifests instead of allowing local changes.
Welcome to puppet ;) ,
Silviu
Do you mean you want the users to be able to change all the files? I just pushed the directory using an exec with a "creates". I think I used a combination of wget and tar.
> Jean-Baptiste Barth wrote:
>
>> I'd like to be able to deploy a skeleton directory through puppet, i.e. puppet deploys it only if it does not exist.
> [...]
>> But I have 2 problems for the moment :
>> - if I don't set owner/group, it takes uid/gid on the puppetmaster, which does not exist on the node ; if I do set these options, the directory is scanned each time and all files are chown'ed to this user/group, which is absolutely not desired behaviour in my case (puppet should not change ownership for files it doesn't manage in my case...)
>> - I'd like puppet to let user change some files in the skeleton as they want, i.e. skip this directory if it just exists
>
> The second problem you can solve by using the 'replace => false'
> parameter to the file type. However, if the user *removes* one
> of the files in the skeleton directory, then Puppet will download
> it again, so maybe it isn't quite enough.
>
> And even with 'replace => false', Puppet will manage ownerships
> and modes of all files.
>
> One solution is to develop a custom fact that gets set to true
> if the target directory already exists, and not set if it doesn't.
> Then you can do
>
> if $dir_opt_foo_data_exists != "true" {
> file {
> "/opt/foo/data": source => ..., recurse => true, ...;
> }
> }
>
> This doesn't scale very well to many directories, though, as you
> need one custom fact for each such directory. Another way is to
> do it with an exec:
>
> exec {
> opt-foo-data:
> command => "wget -r http://.../ && chown -R auser:agroup data",
> cwd => "/opt/foo", path => "/bin:/usr/bin",
> creates => "/opt/foo";
> }
>
> Note the use of the parameter 'creates => "/opt/foo"', which will
> make Puppet only run the command if /opt/foo doesn't already exist.
>
> The disadvantage is that you need to configure and run a web server
> (or ftp server) somewhere as well.
I usually do it this way (using wget and tar), but you could push the directory somewhere else using puppet and put "cp -a" in the exec.