2018-10-29 21:53:46 +01:00
|
|
|
---
|
2018-11-02 18:15:17 +01:00
|
|
|
|
2022-12-21 17:06:11 +01:00
|
|
|
- name: Is ipaddr_whitelist.conf present?
|
|
|
|
stat:
|
|
|
|
path: /etc/apache2/ipaddr_whitelist.conf
|
|
|
|
register: _ipaddr_whitelist_conf
|
|
|
|
|
|
|
|
- name: Add IP addresses to private IP whitelist
|
2018-10-29 21:53:46 +01:00
|
|
|
lineinfile:
|
|
|
|
dest: /etc/apache2/ipaddr_whitelist.conf
|
|
|
|
line: "Require ip {{ item }}"
|
|
|
|
state: present
|
2021-05-04 14:18:40 +02:00
|
|
|
loop: "{{ apache_ipaddr_whitelist_present }}"
|
2018-10-29 21:53:46 +01:00
|
|
|
notify: reload apache
|
|
|
|
tags:
|
2018-11-02 18:15:17 +01:00
|
|
|
- apache
|
|
|
|
- ips
|
2022-12-21 17:06:11 +01:00
|
|
|
when: _ipaddr_whitelist_conf.stat.exists or not ansible_check_mode
|
2018-11-02 18:15:17 +01:00
|
|
|
|
2022-12-21 17:06:11 +01:00
|
|
|
- name: Remove IP addresses from private IP whitelist
|
2018-11-02 18:15:17 +01:00
|
|
|
lineinfile:
|
|
|
|
dest: /etc/apache2/ipaddr_whitelist.conf
|
|
|
|
line: "Require ip {{ item }}"
|
|
|
|
state: absent
|
2021-05-04 14:18:40 +02:00
|
|
|
loop: "{{ apache_ipaddr_whitelist_absent }}"
|
2018-11-02 18:15:17 +01:00
|
|
|
notify: reload apache
|
|
|
|
tags:
|
|
|
|
- apache
|
|
|
|
- ips
|