Ask Your Question

Chown Recursively excluding a directory.

asked 2018-08-02 22:36:27 -0600

Murugan R gravatar image

Murugan Ramaswamy 9:04 AM (0 minutes ago) to me

My requirement is to run chown command recursively for a path except for one directory in that path.

For example: Path:/opt/test/ Except for path:/opt/test/new/exclude/

How can I achieve this in puppet:

I can do this with Linux command like the below one:

"find /opt/test/ -not -path "/exclude/" -exec chown user1:group1 { } \;"

But I'm not able to use the option -not -path in puppet , Can someone help me on how to achieve this scenario in puppet.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-10-08 15:10:58 -0600

You can't manage directories no file resource exist for. Only the tidy resource is capable of automatically creating file resources according to the client's present directory layout.

You'd have to actually run an exec resource, virtually calling the find(1) command you've already provided.

edit flag offensive delete link more


You can create a file resource for /opt/test/exclude, recursive, and not manage anything about that file resource - puppet will not 'traverse' down that path from the other, above file resource. - it is a shame there isn't an easy 'exclude' parameter on it...

DarylW gravatar imageDarylW ( 2018-10-09 07:44:44 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2018-08-02 22:36:27 -0600

Seen: 155 times

Last updated: Oct 08