ansible-nginx/tasks/htpasswd.yml

22 lines
591 B
YAML

---
- name: FILE | Delete htpasswd file
file:
path: "{{ nginx_htpasswd_dir }}/{{ item.name }}"
state: absent
with_items: "{{ nginx_htpasswd }}"
when: item.state is defined and item.state == 'absent'
no_log: true
- name: HTPASSWD | Manage files
htpasswd:
name: "{{ item.1.name }}"
password: "{{ item.1.password }}"
state: "{{ item.1.state | default('present') }}"
path: "{{ nginx_htpasswd_dir }}/{{ item.0.name }}"
with_subelements:
- "{{ nginx_htpasswd }}"
- users
when: item.0.state is not defined or item.0.state == 'present'
no_log: true