Squid: deal with Jessie and Stretch

This commit is contained in:
Jérémy Lecour 2017-03-14 18:06:07 +01:00 committed by Jérémy Lecour
parent 6771a18b20
commit 9dca0f98bf
8 changed files with 41 additions and 28 deletions

View file

@ -1,11 +0,0 @@
/var/log/squid3/*.log {
monthly
compress
rotate 12
missingok
create 640 proxy adm
sharedscripts
postrotate
test ! -e /var/run/squid3.pid || /usr/sbin/squid3 -k rotate
endscript
}

View file

@ -5,6 +5,11 @@
state: restarted
- name: restart squid
service:
name: squid
state: restarted
- name: restart squid3
service:
name: squid3
state: restarted

View file

@ -1,6 +1,6 @@
---
- name: logrotate configuration
copy:
src: logrotate_squid3
dest: /etc/logrotate.d/squid3
template:
src: logrotate.j2
dest: /etc/logrotate.d/{{ squid_daemon }}
force: no

View file

@ -1,35 +1,33 @@
---
- name: Include OS-specific variables
include_vars: "{{ ansible_os_family }}-{{ ansible_distribution_release }}.yml"
- name: package is installed
apt:
name: squid3
name: "{{ squid_package }}"
state: present
- name: squid.conf is present
template:
src: squid.j2
dest: /etc/squid3/squid.conf
notify: restart squid
- name: logrotate configuration
copy:
src: logrotate_squid3
dest: /etc/logrotate.d/squid3
dest: "{{ squid_conf_file }}"
notify: "restart {{ squid_daemon }}"
- name: evolix whitelist is present
copy:
src: whitelist-evolinux.conf
dest: /etc/squid3/whitelist-evolinux.conf
dest: "{{ squid_conf_path }}/whitelist-evolinux.conf"
force: yes
backup: yes
notify: restart squid
notify: "restart {{ squid_daemon }}"
- name: custom whitelist is present
copy:
src: whitelist-custom.conf
dest: /etc/squid3/whitelist-custom.conf
dest: "{{ squid_conf_path }}/whitelist-custom.conf"
force: no
notify: restart squid
notify: "restart {{ squid_daemon }}"
- include: logrotate.yml

View file

@ -0,0 +1,11 @@
/var/log/{{ squid_daemon }}/*.log {
monthly
compress
rotate 12
missingok
create 640 proxy adm
sharedscripts
postrotate
test ! -e /var/run/{{ squid_daemon }}.pid || /usr/sbin/{{ squid_daemon }} -k rotate
endscript
}

View file

@ -8,8 +8,8 @@ acl localhost src 127.0.0.0/32
acl INTERNE src {{ squid_address }}/32 127.0.0.0/8
acl Safe_ports port 80 # http
acl SSL_ports port 443 563
acl WHITELIST url_regex "/etc/squid3/whitelist-evolinux.conf"
acl WHITELIST url_regex "/etc/squid3/whitelist-custom.conf"
acl WHITELIST url_regex "{{ squid_conf_path }}/whitelist-evolinux.conf"
acl WHITELIST url_regex "{{ squid_conf_path }}/whitelist-custom.conf"
http_access deny !WHITELIST
http_access allow INTERNE
http_access deny all

View file

@ -0,0 +1,5 @@
---
squid_package: squid3
squid_daemon: squid3
squid_conf_path: /etc/squid3
squid_conf_file: /etc/squid3/squid.conf

View file

@ -0,0 +1,5 @@
---
squid_package: squid
squid_daemon: squid
squid_conf_path: /etc/squid
squid_conf_file: /etc/squid/squid.conf