---
- name: Create or update htpasswd files
  htpasswd:
    path: "{{ item[0].path }}"
    name: "{{ item[1].login }}"
    password: "{{ item[1].pass | default(omit) }}"
    owner: root
    group: nginx
    mode: 0640
    state: "{{ (item[1].state | default('present')) }}"
  with_subelements:
    - "{{ nginx_htpasswd }}"
    - users
  tags: web

