How to set file perms recursively except on certain files?

13 views
Skip to first unread message

fxp

unread,
Oct 18, 2016, 4:08:54 PM10/18/16
to Salt-users
I have a directory of files I want to recursively ensure file perms (0664) on except on a single known file which should be 0755. How can I achieve this easily?

desired ->

dirA/
├── [-rw-rw-r--]  fileA
├── [-rw-rw-r--]  fileB
└── [-rwxr-xr-x]  fileC
├── [-rw-rw-r--]  fileD
├── [-rw-rw-r--]  fileE
└── [-rw-rw-r--]  fileF
...

If I do 2 states as below, they both constantly keep executing each salt highstate run which seems silly. First one resets the perms and second restores it back means there's always 2 changes each run.

/dirA:
  file.directory:
    - file_mode: 0664
    - recurse:
      - mode

/dirA/fileC:
  file.managed:
    - mode: 0755


Thanks,
Reply all
Reply to author
Forward
0 new messages