38 lines
1.3 KiB
YAML
38 lines
1.3 KiB
YAML
---
|
|
- name: Load the basic auth modules
|
|
apache2_module: name={{ item }} state=present
|
|
with_items: '{{ apache_basic_auth_modules }}'
|
|
notify: apache2 reload
|
|
tags:
|
|
- apache
|
|
- apache_basic_auth
|
|
|
|
- name: Create the authentication directory
|
|
file: path={{ apache_basic_auth_dir }} mode=0750 owner=root group={{ apache_group }} state=directory
|
|
tags:
|
|
- apache
|
|
- apache_basic_auth
|
|
|
|
- name: Install the python-passlib library
|
|
apt: pkg=python-passlib state=present
|
|
tags:
|
|
- apache
|
|
- apache_basic_auth
|
|
|
|
- name: Create the basic auth file when it is unique to all the virtualhosts
|
|
htpasswd: path={{ apache_basic_auth_file }} name={{ item.username }} password={{ item.password }} create=yes state={{ item.state }} owner=root group={{ apache_group }} mode=0640
|
|
when: apache_basic_users is defined and apache_basic_auth_single_file
|
|
with_items: '{{ apache_basic_users }}'
|
|
tags:
|
|
- apache
|
|
- apache_basic_auth
|
|
|
|
- name: Create the basic auth files
|
|
htpasswd: path={{ item.auth_file }} name={{ item.username }} password={{ item.password }} create=yes state={{ item.state }} owner=root group={{ apache_group }} mode=0640
|
|
with_items: '{{ apache_basic_users | default([]) }}'
|
|
when: apache_basic_users is defined and not apache_basic_auth_single_file
|
|
tags:
|
|
- apache
|
|
- apache_basic_auth
|
|
|