forked from evolix/ansible-roles
3882a366e4
This reverts commit c44896d433
.
142 lines
4.2 KiB
YAML
142 lines
4.2 KiB
YAML
---
|
|
|
|
- fail:
|
|
msg: only compatible with Debian >= 8
|
|
when:
|
|
- ansible_distribution != "Debian" or ansible_distribution_major_version | version_compare('8', '<')
|
|
|
|
- name: "Set squid name (jessie)"
|
|
set_fact:
|
|
squid_daemon_name: squid3
|
|
when: ansible_distribution_release == "jessie"
|
|
|
|
- name: "Set squid name (Debian 9 or later)"
|
|
set_fact:
|
|
squid_daemon_name: squid
|
|
when: ansible_distribution_major_version | version_compare('9', '>=')
|
|
|
|
- name: "Install Squid packages"
|
|
apt:
|
|
name: '{{ item }}'
|
|
state: present
|
|
with_items:
|
|
- "{{ squid_daemon_name }}"
|
|
- squidclient
|
|
|
|
- name: "Set alternative config file (Debian 9 or later)"
|
|
copy:
|
|
src: default_squid
|
|
dest: /etc/default/squid
|
|
when: ansible_distribution_major_version | version_compare('9', '>=')
|
|
|
|
- name: "squid.conf is present (jessie)"
|
|
template:
|
|
src: squid.conf.j2
|
|
dest: /etc/squid3/squid.conf
|
|
notify: "restart squid3"
|
|
when: ansible_distribution_release == "jessie"
|
|
|
|
- name: "evolix whitelist is present (jessie)"
|
|
copy:
|
|
src: whitelist-evolinux.conf
|
|
dest: /etc/squid3/whitelist.conf
|
|
force: no
|
|
notify: "reload squid3"
|
|
when: ansible_distribution_release == "jessie"
|
|
|
|
- name: "evolinux custom squid file (Debian 9 or later)"
|
|
copy:
|
|
src: evolinux-defaults.conf
|
|
dest: /etc/squid/evolinux-defaults.conf
|
|
notify: "restart squid"
|
|
when: ansible_distribution_major_version | version_compare('9', '>=')
|
|
|
|
- name: "evolinux defaults whitelist (Debian 9 or later)"
|
|
copy:
|
|
src: evolinux-whitelist-defaults.conf
|
|
dest: /etc/squid/evolinux-whitelist-defaults.conf
|
|
notify: "reload squid"
|
|
when: ansible_distribution_major_version | version_compare('9', '>=')
|
|
|
|
- name: "evolinux custom whitelist (Debian 9 or later)"
|
|
copy:
|
|
dest: /etc/squid/evolinux-whitelist-custom.conf
|
|
content: |
|
|
# Put customized values here.
|
|
force: no
|
|
when: ansible_distribution_major_version | version_compare('9', '>=')
|
|
|
|
- name: "evolinux acl for local proxy (Debian 9 or later)"
|
|
template:
|
|
src: evolinux-acl.conf.j2
|
|
dest: /etc/squid/evolinux-acl.conf
|
|
force: no
|
|
notify: "reload squid"
|
|
when: squid_localproxy_enable and ansible_distribution_major_version | version_compare('9', '>=')
|
|
|
|
- name: "evolinux custom acl (Debian 9 or later)"
|
|
copy:
|
|
dest: /etc/squid/evolinux-acl.conf
|
|
content: |
|
|
# Put customized values here.
|
|
force: no
|
|
when: squid_localproxy_enable == False and ansible_distribution_major_version | version_compare('9', '>=')
|
|
|
|
- name: "evolinux http_access for local proxy (Debian 9 or later)"
|
|
copy:
|
|
src: evolinux-httpaccess.conf
|
|
dest: /etc/squid/evolinux-httpaccess.conf
|
|
force: no
|
|
notify: "reload squid"
|
|
when: squid_localproxy_enable and ansible_distribution_major_version | version_compare('9', '>=')
|
|
|
|
- name: "evolinux custom http_access (Debian 9 or later)"
|
|
copy:
|
|
dest: /etc/squid/evolinux-httpaccess.conf
|
|
content: |
|
|
# Put customized values here.
|
|
force: no
|
|
when: squid_localproxy_enable == False and ansible_distribution_major_version | version_compare('9', '>=')
|
|
|
|
- name: "evolinux overrides for local proxy (Debian 9 or later)"
|
|
template:
|
|
src: evolinux-custom.conf.j2
|
|
dest: /etc/squid/evolinux-custom.conf
|
|
force: no
|
|
notify: "reload squid"
|
|
when: squid_localproxy_enable and ansible_distribution_major_version | version_compare('9', '>=')
|
|
|
|
- name: "evolinux custom overrides (Debian 9 or later)"
|
|
copy:
|
|
dest: /etc/squid/evolinux-custom.conf
|
|
content: |
|
|
# Put customized values here.
|
|
force: no
|
|
when: squid_localproxy_enable == False and ansible_distribution_major_version | version_compare('9', '>=')
|
|
|
|
- name: add some URL in whitelist (Debian 8)
|
|
lineinfile:
|
|
insertafter: EOF
|
|
dest: /etc/squid3/whitelist.conf
|
|
line: "{{ item }}"
|
|
state: present
|
|
with_items: '{{ squid_whitelist_items }}'
|
|
notify: "reload squid3"
|
|
when: ansible_distribution_major_version == '8'
|
|
|
|
- name: add some URL in whitelist (Debian 9 or later)
|
|
lineinfile:
|
|
insertafter: EOF
|
|
dest: /etc/squid/evolinux-whitelist-custom.conf
|
|
line: "{{ item }}"
|
|
state: present
|
|
with_items: '{{ squid_whitelist_items }}'
|
|
notify: "reload squid"
|
|
when: ansible_distribution_major_version | version_compare('9', '>=')
|
|
|
|
- include: logrotate.yml
|
|
|
|
- include: minifirewall.yml
|
|
|
|
- include: log2mail.yml
|