ansible-role-nginx/tasks/basic-auth.yml

26 lines
1.1 KiB
YAML
Raw Normal View History

2020-06-02 14:52:24 +02:00
---
- block:
- name: Install the python passlib library on deb based distributions
apt: pkg=python-passlib state=present cache_valid_time=3600
2023-03-01 16:08:49 +01:00
when:
- ansible_distribution_file_variety == "Debian"
2023-06-07 11:04:40 +02:00
- ansible_distribution_version is version_compare('18.04', '<=')
2023-03-01 16:08:49 +01:00
- name: Install the python passlib library on deb based distributions
apt: pkg=python3-passlib state=present cache_valid_time=3600
when:
- ansible_distribution_file_variety == "Debian"
- ansible_distribution_version is version_compare('18.04', '>=')
2020-06-02 14:52:24 +02:00
- name: Install the python passlib library on RH based distributions
yum: pkg=python-passlib state=present
when: ansible_distribution_file_variety == "RedHat"
- name: Create the htpasswd file needed by the basic auth
htpasswd: path={{ item.file | default ('/etc/nginx/htpasswd') }} name={{ item.name }} password={{ item.pwd }} state={{ item.state | default('present') }} crypt_scheme={{ item.crypt | default('sha256_crypt') }}
with_items: '{{ nginx_basic_auth_users }}'
when: nginx_basic_auth
tags: nginx