Ansible - Mode 755 for directories and 644 for files recursively

后端 未结 4 1937
难免孤独
难免孤独 2021-01-31 01:15

I\'d like to allow anyone to list and read all files in my directory tree, but I don\'t want to make the files executable :

dir
  \\subdir1
      file1
  \\subdi         


        
4条回答
  •  孤独总比滥情好
    2021-01-31 01:50

    Since version 1.8, Ansible supports symbolic modes. Thus, the following would perform the task you want:

    - name: Make my directory tree readable
      file:
        path: dir
        mode: u=rwX,g=rX,o=rX
        recurse: yes
    

    Because X (instead of x) only applies to directories or files with at least one x bit set.

提交回复
热议问题