7c632352a0
The behaviour of the `include` module is badly defined (it try to choose between statically importing the tasks and dynamically including them) and can cause problems depending on any number of constraints (mostly if it choose the wrong behaviour). Replace it with the `import_tasks` (always statically import tasks) unless the `include` is in a loop in which case we replace it with `include_tasks` (always dynamically include tasks).
57 lines
1.2 KiB
YAML
57 lines
1.2 KiB
YAML
---
|
|
|
|
- name: Init ipaddr_whitelist.conf file
|
|
copy:
|
|
src: ipaddr_whitelist.conf
|
|
dest: /etc/apache2/ipaddr_whitelist.conf
|
|
owner: root
|
|
group: root
|
|
mode: "0640"
|
|
force: no
|
|
tags:
|
|
- apache
|
|
|
|
- name: Load IP whitelist task
|
|
import_tasks: ip_whitelist.yml
|
|
|
|
- name: include private IP whitelist for server-status
|
|
lineinfile:
|
|
dest: /etc/apache2/mods-available/status.conf
|
|
line: " include /etc/apache2/ipaddr_whitelist.conf"
|
|
insertafter: 'SetHandler server-status'
|
|
state: present
|
|
tags:
|
|
- apache
|
|
|
|
- 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:
|
|
- apache
|
|
|
|
- name: add user:pwd to private htpasswd
|
|
lineinfile:
|
|
dest: /etc/apache2/private_htpasswd
|
|
line: "{{ item }}"
|
|
state: present
|
|
loop: "{{ apache_private_htpasswd_present }}"
|
|
notify: reload apache
|
|
tags:
|
|
- apache
|
|
|
|
- name: remove user:pwd from private htpasswd
|
|
lineinfile:
|
|
dest: /etc/apache2/private_htpasswd
|
|
line: "{{ item }}"
|
|
state: absent
|
|
loop: "{{ apache_private_htpasswd_absent }}"
|
|
notify: reload apache
|
|
tags:
|
|
- apache
|