The ‘file’ module could use the “directory_mode” directive.
And ‘unarchive’ could use “owner”, “group”, “mode”, “serole”, “setype”, etc. As well as “directory_mode”
Unless I’m completely missing something, but it seems I should be able to unzip a local archive to the target, set ownership and permissions, etc. in one task instead of two or three.
Hi John,
Those options should be available to both of those modules - I believe it is a mistake in the documentation that they are missing. If you have any trouble specifying those options with either module please let us know, and I will get the documentation updated in the mean time.
Thanks!
Also, as far as the directory_mode option goes, the copy module is the only one that uses that, so it is not available in the other modules.
Why is that? I can think of a huge array of use cases where I’d want to set different permissions on files vs. directories that already exist or are being created from an ‘unarchive’ action.
That option was a recent addition to copy, but was not written into use for any of the other modules, mainly because copy is the only one of the files which does a recursive copy. Synchronize does, but it’s using rsync under the hood, which manages the permissions via flags (and synchronize does not use the general file parameters like file/copy/template/etc. do).
Unarchive works similarly, since tar and other archive formats can preserve the user/group/permissions as well. Those modules could be extended to make that parameter override whatever’s in the file, but that feature has, until now, not been proposed. You’re more than welcome to open a GitHub feature request issue for that functionality.