Created
June 26, 2014 21:02
-
-
Save maxim/0146d15fa18a238f14b9 to your computer and use it in GitHub Desktop.
How to recursilvely chmod dirs and files (separately) with Ansible, without always seeing "changed" status.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: ensure all dir permissions are set correctly | |
shell: find /my/dir -type d -print0 | xargs -0 chmod -c 2755 | |
register: chmod_result | |
changed_when: "chmod_result.stdout != \"\"" | |
- name: ensure all file permissions are set correctly | |
shell: find /my/dir -type f -print0 | xargs -0 chmod -c 0650 | |
register: chmod_result | |
changed_when: "chmod_result.stdout != \"\"" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks! Had never seen the
-c
flag before; looks like it's also supported by GNUchown
andchgrp