--- - name: Set the permissions for each Drupal root directory. file: group: www-data mode: ug=rX,o= owner: "{{ drupal_permissions.user }}" path: "{{ item.root }}" recurse: true state: directory with_items: "{{ drupal_permissions.sites }}" become: true - name: Set permissions for the defined settings files. file: mode: a-X path: "{{ item.0.root }}/{{ item.1 }}" state: file with_subelements: - "{{ drupal_permissions.sites }}" - settings_files become: true - name: Set permissions for the defined files directories. file: mode: ug=rwX,o= path: "{{ item.0.root }}/{{ item.1 }}" recurse: true state: directory with_subelements: - "{{ drupal_permissions.sites }}" - files_directories become: true