ansible-roles/apache/tasks/auth.yml

57 lines
1.2 KiB
YAML
Raw Normal View History

2017-07-13 14:09:24 +02:00
---
- name: Init ipaddr_whitelist.conf file
2017-07-13 14:09:24 +02:00
copy:
2017-10-07 13:48:04 +02:00
src: ipaddr_whitelist.conf
dest: /etc/apache2/ipaddr_whitelist.conf
2017-07-13 14:09:24 +02:00
owner: root
group: root
mode: "0640"
force: no
tags:
2018-01-02 19:38:12 +01:00
- apache
- name: Load IP whitelist task
include: ip_whitelist.yml
2017-07-13 14:09:24 +02:00
- name: include private IP whitelist for server-status
lineinfile:
dest: /etc/apache2/mods-available/status.conf
line: " include /etc/apache2/ipaddr_whitelist.conf"
2017-07-13 14:09:24 +02:00
insertafter: 'SetHandler server-status'
state: present
tags:
2018-01-02 19:38:12 +01:00
- apache
2017-07-13 14:09:24 +02:00
- name: Copy private_htpasswd
copy:
src: private_htpasswd
dest: /etc/apache2/private_htpasswd
owner: root
group: root
mode: "0640"
force: no
notify: reload apache
tags:
2018-01-02 19:38:12 +01:00
- apache
2017-07-13 14:09:24 +02:00
- name: add user:pwd to private htpasswd
lineinfile:
dest: /etc/apache2/private_htpasswd
line: "{{ item }}"
state: present
loop: "{{ apache_private_htpasswd_present }}"
2017-07-13 14:09:24 +02:00
notify: reload apache
tags:
2018-01-02 19:38:12 +01:00
- apache
2017-07-13 14:09:24 +02:00
- name: remove user:pwd from private htpasswd
lineinfile:
dest: /etc/apache2/private_htpasswd
line: "{{ item }}"
state: absent
loop: "{{ apache_private_htpasswd_absent }}"
2017-07-13 14:09:24 +02:00
notify: reload apache
tags:
2018-01-02 19:38:12 +01:00
- apache