2015-05-28 11:32:57 +02:00
|
|
|
---
|
|
|
|
- name: Load the basic auth modules
|
|
|
|
apache2_module: name={{ item }} state=present
|
2016-09-05 16:40:57 +02:00
|
|
|
with_items: '{{ apache_basic_auth_modules }}'
|
2015-05-28 11:32:57 +02:00
|
|
|
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
|
|
|
|
|
2017-10-13 13:46:17 +02:00
|
|
|
- name: Create the basic auth file when it is unique to all the virtualhosts
|
2015-05-28 11:32:57 +02:00
|
|
|
htpasswd: path={{ apache_basic_auth_file }} name={{ item.username }} password={{ item.password }} create=yes state={{ item.state }}
|
|
|
|
when: apache_basic_users is defined and apache_basic_auth_single_file
|
2017-10-13 13:46:17 +02:00
|
|
|
with_items: '{{ apache_basic_users }}'
|
2015-05-28 11:32:57 +02:00
|
|
|
tags:
|
|
|
|
- apache
|
|
|
|
- apache_basic_auth
|
|
|
|
|
2017-10-13 13:46:17 +02:00
|
|
|
- name: Create the basic auth files
|
2015-05-28 11:32:57 +02:00
|
|
|
htpasswd: path={{ item.auth_file }} name={{ item.username }} password={{ item.password }} create=yes state={{ item.state }}
|
2016-09-13 18:41:27 +02:00
|
|
|
with_items: '{{ apache_basic_users | default([]) }}'
|
2015-05-28 11:32:57 +02:00
|
|
|
when: apache_basic_users is defined and not apache_basic_auth_single_file
|
|
|
|
tags:
|
|
|
|
- apache
|
|
|
|
- apache_basic_auth
|
|
|
|
|