hi guys,

I am creating my htpasswd files in the following manner which works fine:

vhosts:
  sites:
    - name: my_site
      htpasswd: 
        - name: user1
          pass: pass1
        - name: user2
          pass: pass2

- name: Create htpasswd file
  htpasswd:
    path: "{ item.1.name }}.htpasswd"
    name: "{{ item.1.name }}"
    password: "{{ item.1.password }}"
    ...
  with_subelements:
    - vhosts.sites
    - htpasswd
  when: item.1 is defined

However in the vhost template itself I have several locations where I want 
to refer to either user1 or user2, for example:

<snippet>
  auth_basic_user_file /some/path/user1.htpasswd; 
....
....
    auth_basic_user_file /some/path/user2.htpasswd; 
</snippet>

currently these references are hardcoded, but I would really like to have a 
way where I could refer to them in my list not by index (Since I don't know 
which entry it is going to be) but by name). 

Hope someone can help! 

Thanks,
Nico

-- 
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/a4f698ce-6158-4fba-8689-3845661611f9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to