ansible-nginx/tasks/htpasswd.yml

22 lines
654 B
YAML

---
- name: FILE | Delete htpasswd file
ansible.builtin.file:
path: "{{ nginx_htpasswd_dir }}/{{ item.name }}"
state: absent
loop: "{{ nginx_htpasswd }}"
when: item.state is defined and item.state == 'absent'
no_log: "{{ not nginx_debug_role }}"
- name: HTPASSWD | Manage files
community.general.htpasswd:
name: "{{ item.1.name }}"
password: "{{ item.1.password }}"
path: "{{ nginx_htpasswd_dir }}/{{ item.0.name }}"
mode: 0644
owner: root
group: root
loop: "{{ nginx_htpasswd | subelements('users') }}"
when: item.0.state is not defined or item.0.state == 'present'
no_log: "{{ not nginx_debug_role }}"