Hi, everyone.

Would it be possible to somehow merge those two tasks in one? As you can 
see, the only difference is in *default: [yes|no] *key.
I have to install both default and non-default ACL on a filesystem object, 
but I am am stuck with (perceived) deficiencies of Ansible loops. Can I 
somehow alternate between those two boolean values, whilst also being able 
to loop *with_subelements*?

  vars:
    deploy_username: deploy-a
    directories:
    - path: /var/www
      owner: www-data
      group: www-data
      permissions: "0770"
      recursive_perms: yes
      acl:
      - etype: user
        permissions: rwX
        entity: www-data
      - etype: user
        permissions: rwX
        entity: "{{ deploy_username }}"

  - name: Set ACL on directories
    acl:
      path: "{{ item.0.path }}"
      entity: "{{ item.1.entity }}"
      etype: "{{ item.1.etype }}"
      permissions: "{{ item.1.permissions }}"
      state: present
      default: no
      recursive: "{{ item.0.recursive_perms }}"
    with_subelements:
    - "{{ directories }}"
    - acl


  - name: Set default ACL on directories
    acl:
      path: "{{ item.0.path }}"
      entity: "{{ item.1.entity }}"
      etype: "{{ item.1.etype }}"
      permissions: "{{ item.1.permissions }}"
      state: present
      default: yes
      recursive: "{{ item.0.recursive_perms }}"
    with_subelements:
    - "{{ directories }}"
    - acl






-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/ef584a18-3418-486f-97a6-eecbd67d2181%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to