saltstack/salt — Issue #740: Wrong permissions when creating subdirectory trees in file state
Author: j0nes2k
Created: 2012-02-22 14:46:22+00:00
State: open

I am trying to create multiple subdirectories via the file state using a for-loop:

{% set dirs = [
'my/dummy/dir1',
'my/dummy/dir2',
'my/dummy/dir3' ] -%}

{% for dir in dirs %}
/home/user/{{ dir }}:
file:
- directory
- user: user
- group: www-data
- mode: 755
- makedirs: True
- require:
- user: user
- group: www-data
{% endfor %}

All directories are created, but the directory permissions are not set correctly for the top directories. The directory "/home/user/my" and "/home/user/my/dummy" belong to root, and only the directories "/home/user/my/dummy/dir[1-3]" belong to user:www-data.