Permission change based on file extension using ansible -
i want change permission of file based on it's extension using ansible, example have directory test
, within directory have lot of shell script(.sh) , python(.py) files. want change permission of shell script 0700 , python files 0644. can please me how can achieve this. thanks
there many ways this. should work. tweak needs.
- file: path={{item}} mode=0644 with_fileglob: - <full_path>/*.py - file: path={{item}} mode=0700 with_fileglob: - <full_path>/*.sh
if files on remote, this:
- shell: ls /test/*.py register: py_files - file: path={{item}} mode=0644 with_items: py_files.stdout_lines
Comments
Post a Comment