I'm just learning saltstack to start automating provisioning and deployment. One thing I'm having trouble finding is how to recursively set ownership on a directory after extracting an archive. When I use the user and group properties, I get a warning that says this functionality will be dropped in archive.extracted
in a future release (carbon).
This seems so trivial, but I can't find a good way to do the equivalent of chown -R user:user
on the dir that's extracted from the tar I'm unpacking.
The only thing I could find via googling was to add a cmd.run statement in the state file that runs chown
and requires the statement that unpacks the tar. There's gotta be a better way, right?
EDIT: the cmd.run
workout works perfectly btw, it just seems like a work around.
Here's how I have used it. I extract the file and then have a file.directory
which set's the permission.
/path/to/extracted/dir:
file.directory:
- user: <someuser>
- group: <group>
- mode: 755 # some permission
- recurse:
- user
- group
- require:
- archive: <State id of `archive.extracted`>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With