squid: minifirewall main file is configurable

This commit is contained in:
Jérémy Lecour 2018-12-04 14:24:38 +01:00 committed by Jérémy Lecour
parent c3e4a78442
commit c96e8130ff
2 changed files with 7 additions and 5 deletions

View file

@ -6,3 +6,5 @@ squid_address: "{{ ansible_default_ipv4.address }}"
squid_whitelist_items: [] squid_whitelist_items: []
squid_localproxy_enable: False squid_localproxy_enable: False
minifirewall_main_file: /etc/default/minifirewall

View file

@ -1,28 +1,28 @@
--- ---
- name: Check if Minifirewall is present - name: Check if Minifirewall is present
stat: stat:
path: /etc/default/minifirewall path: "{{ minifirewall_main_file }}"
check_mode: no check_mode: no
register: minifirewall_test register: minifirewall_test
- block: - block:
- name: HTTPSITES list is commented in minifirewall - name: HTTPSITES list is commented in minifirewall
replace: replace:
dest: /etc/default/minifirewall dest: "{{ minifirewall_main_file }}"
regexp: "^(HTTPSITES='[^0-9])" regexp: "^(HTTPSITES='[^0-9])"
replace: '#\1' replace: '#\1'
notify: restart minifirewall notify: restart minifirewall
- name: all HTTPSITES are authorized in minifirewall - name: all HTTPSITES are authorized in minifirewall
lineinfile: lineinfile:
dest: /etc/default/minifirewall dest: "{{ minifirewall_main_file }}"
line: "HTTPSITES='0.0.0.0/0'" line: "HTTPSITES='0.0.0.0/0'"
insertafter: "^#HTTPSITES=" insertafter: "^#HTTPSITES="
notify: restart minifirewall notify: restart minifirewall
- name: add iptables rules for the proxy - name: add iptables rules for the proxy
lineinfile: lineinfile:
dest: /etc/default/minifirewall dest: "{{ minifirewall_main_file }}"
regexp: "^#? *{{ item }}" regexp: "^#? *{{ item }}"
line: "{{ item }}" line: "{{ item }}"
insertafter: "^# Proxy" insertafter: "^# Proxy"
@ -35,7 +35,7 @@
- name: remove minifirewall example rule for the proxy - name: remove minifirewall example rule for the proxy
lineinfile: lineinfile:
dest: /etc/default/minifirewall dest: "{{ minifirewall_main_file }}"
regexp: '^#.*(-t nat).*(-d X\.X\.X\.X)' regexp: '^#.*(-t nat).*(-d X\.X\.X\.X)'
state: absent state: absent
notify: restart minifirewall notify: restart minifirewall