2016-11-07 14:00:57 +01:00
|
|
|
---
|
|
|
|
|
2023-03-20 23:33:19 +01:00
|
|
|
- ansible.builtin.fail:
|
2017-08-23 01:03:07 +02:00
|
|
|
msg: only compatible with Debian >= 8
|
|
|
|
when:
|
2020-02-25 10:45:35 +01:00
|
|
|
- ansible_distribution != "Debian" or ansible_distribution_major_version is version('8', '<')
|
2017-03-14 18:06:07 +01:00
|
|
|
|
2017-09-14 19:13:59 +02:00
|
|
|
- name: "Set squid name (jessie)"
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.set_fact:
|
2017-09-14 08:55:15 +02:00
|
|
|
squid_daemon_name: squid3
|
2019-07-03 09:41:35 +02:00
|
|
|
when: ansible_distribution_release == "jessie"
|
2017-08-23 01:03:07 +02:00
|
|
|
|
|
|
|
- name: "Set squid name (Debian 9 or later)"
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.set_fact:
|
2017-09-14 08:55:15 +02:00
|
|
|
squid_daemon_name: squid
|
2020-02-25 10:45:35 +01:00
|
|
|
when: ansible_distribution_major_version is version('9', '>=')
|
2017-08-23 01:03:07 +02:00
|
|
|
|
|
|
|
- name: "Install Squid packages"
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.apt:
|
2019-12-31 15:25:10 +01:00
|
|
|
name:
|
|
|
|
- "{{ squid_daemon_name }}"
|
|
|
|
- squidclient
|
2016-11-07 14:00:57 +01:00
|
|
|
state: present
|
2017-08-23 01:03:07 +02:00
|
|
|
|
2021-05-01 22:24:40 +02:00
|
|
|
- name: Fetch packages
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.package_facts:
|
2023-01-06 09:54:51 +01:00
|
|
|
manager: auto
|
2021-05-01 22:24:40 +02:00
|
|
|
|
2023-03-20 23:33:19 +01:00
|
|
|
- ansible.builtin.debug:
|
2021-05-01 22:24:40 +02:00
|
|
|
var: ansible_facts.packages[squid_daemon_name]
|
|
|
|
|
2017-08-23 01:03:07 +02:00
|
|
|
- name: "Set alternative config file (Debian 9 or later)"
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.copy:
|
2017-08-23 01:03:07 +02:00
|
|
|
src: default_squid
|
|
|
|
dest: /etc/default/squid
|
2020-02-25 10:45:35 +01:00
|
|
|
when: ansible_distribution_major_version is version('9', '>=')
|
2016-11-07 14:00:57 +01:00
|
|
|
|
2017-09-14 19:13:59 +02:00
|
|
|
- name: "squid.conf is present (jessie)"
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.template:
|
2017-08-23 01:03:07 +02:00
|
|
|
src: squid.conf.j2
|
2023-12-09 12:28:17 +01:00
|
|
|
dest: /etc/squid/squid.conf
|
2017-08-23 01:03:07 +02:00
|
|
|
notify: "restart squid3"
|
2019-07-03 09:41:35 +02:00
|
|
|
when: ansible_distribution_release == "jessie"
|
2017-01-03 16:50:46 +01:00
|
|
|
|
2017-09-14 19:13:59 +02:00
|
|
|
- name: "evolix whitelist is present (jessie)"
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.copy:
|
2016-12-20 15:58:18 +01:00
|
|
|
src: whitelist-evolinux.conf
|
2023-12-09 12:28:17 +01:00
|
|
|
dest: /etc/squid/whitelist.conf
|
2023-06-28 13:22:59 +02:00
|
|
|
force: false
|
2017-08-23 01:03:07 +02:00
|
|
|
notify: "reload squid3"
|
2019-07-03 09:41:35 +02:00
|
|
|
when: ansible_distribution_release == "jessie"
|
2017-08-23 01:03:07 +02:00
|
|
|
|
2018-08-24 18:11:19 +02:00
|
|
|
- name: "evolinux defaults squid file (Debian 9 or later)"
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.copy:
|
2017-08-23 01:03:07 +02:00
|
|
|
src: evolinux-defaults.conf
|
|
|
|
dest: /etc/squid/evolinux-defaults.conf
|
|
|
|
notify: "restart squid"
|
2020-02-25 10:45:35 +01:00
|
|
|
when: ansible_distribution_major_version is version('9', '>=')
|
2017-08-23 01:03:07 +02:00
|
|
|
|
|
|
|
- name: "evolinux defaults whitelist (Debian 9 or later)"
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.copy:
|
2017-08-23 01:03:07 +02:00
|
|
|
src: evolinux-whitelist-defaults.conf
|
|
|
|
dest: /etc/squid/evolinux-whitelist-defaults.conf
|
|
|
|
notify: "reload squid"
|
2020-02-25 10:45:35 +01:00
|
|
|
when: ansible_distribution_major_version is version('9', '>=')
|
2017-08-23 01:03:07 +02:00
|
|
|
|
|
|
|
- name: "evolinux custom whitelist (Debian 9 or later)"
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.copy:
|
2017-08-23 01:03:07 +02:00
|
|
|
dest: /etc/squid/evolinux-whitelist-custom.conf
|
|
|
|
content: |
|
|
|
|
# Put customized values here.
|
2023-06-28 13:22:59 +02:00
|
|
|
force: false
|
2020-02-25 10:45:35 +01:00
|
|
|
when: ansible_distribution_major_version is version('9', '>=')
|
2017-08-23 01:03:07 +02:00
|
|
|
|
|
|
|
- name: "evolinux acl for local proxy (Debian 9 or later)"
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.template:
|
2017-08-23 01:03:07 +02:00
|
|
|
src: evolinux-acl.conf.j2
|
|
|
|
dest: /etc/squid/evolinux-acl.conf
|
2023-06-28 13:22:59 +02:00
|
|
|
force: false
|
2017-08-23 01:03:07 +02:00
|
|
|
notify: "reload squid"
|
2021-05-09 23:06:42 +02:00
|
|
|
when:
|
|
|
|
- squid_localproxy_enable | bool
|
|
|
|
- ansible_distribution_major_version is version('9', '>=')
|
2017-08-23 01:03:07 +02:00
|
|
|
|
|
|
|
- name: "evolinux custom acl (Debian 9 or later)"
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.copy:
|
2017-08-23 01:03:07 +02:00
|
|
|
dest: /etc/squid/evolinux-acl.conf
|
|
|
|
content: |
|
|
|
|
# Put customized values here.
|
2023-06-28 13:22:59 +02:00
|
|
|
force: false
|
2021-05-09 23:06:42 +02:00
|
|
|
when:
|
|
|
|
- not (squid_localproxy_enable | bool)
|
|
|
|
- ansible_distribution_major_version is version('9', '>=')
|
2017-08-23 01:03:07 +02:00
|
|
|
|
|
|
|
- name: "evolinux http_access for local proxy (Debian 9 or later)"
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.copy:
|
2017-08-23 01:03:07 +02:00
|
|
|
src: evolinux-httpaccess.conf
|
|
|
|
dest: /etc/squid/evolinux-httpaccess.conf
|
2023-06-28 13:22:59 +02:00
|
|
|
force: false
|
2017-08-23 01:03:07 +02:00
|
|
|
notify: "reload squid"
|
2021-05-09 23:06:42 +02:00
|
|
|
when:
|
|
|
|
- squid_localproxy_enable | bool
|
|
|
|
- ansible_distribution_major_version is version('9', '>=')
|
2017-08-23 01:03:07 +02:00
|
|
|
|
|
|
|
- name: "evolinux custom http_access (Debian 9 or later)"
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.copy:
|
2017-08-23 01:03:07 +02:00
|
|
|
dest: /etc/squid/evolinux-httpaccess.conf
|
|
|
|
content: |
|
|
|
|
# Put customized values here.
|
2023-06-28 13:22:59 +02:00
|
|
|
force: false
|
2021-05-09 23:06:42 +02:00
|
|
|
when:
|
|
|
|
- not (squid_localproxy_enable | bool)
|
|
|
|
- ansible_distribution_major_version is version('9', '>=')
|
2017-08-23 01:03:07 +02:00
|
|
|
|
|
|
|
- name: "evolinux overrides for local proxy (Debian 9 or later)"
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.template:
|
2017-08-23 01:03:07 +02:00
|
|
|
src: evolinux-custom.conf.j2
|
|
|
|
dest: /etc/squid/evolinux-custom.conf
|
2023-06-28 13:22:59 +02:00
|
|
|
force: false
|
2017-08-23 01:03:07 +02:00
|
|
|
notify: "reload squid"
|
2021-05-09 23:06:42 +02:00
|
|
|
when:
|
|
|
|
- squid_localproxy_enable | bool
|
|
|
|
- ansible_distribution_major_version is version('9', '>=')
|
2016-11-07 14:00:57 +01:00
|
|
|
|
2017-08-23 01:03:07 +02:00
|
|
|
- name: "evolinux custom overrides (Debian 9 or later)"
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.copy:
|
2017-08-23 01:03:07 +02:00
|
|
|
dest: /etc/squid/evolinux-custom.conf
|
|
|
|
content: |
|
|
|
|
# Put customized values here.
|
2023-06-28 13:22:59 +02:00
|
|
|
force: false
|
2021-05-09 23:06:42 +02:00
|
|
|
when:
|
|
|
|
- not (squid_localproxy_enable | bool)
|
|
|
|
- ansible_distribution_major_version is version('9', '>=')
|
2016-11-07 14:00:57 +01:00
|
|
|
|
2017-09-14 09:19:15 +02:00
|
|
|
- name: add some URL in whitelist (Debian 8)
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.lineinfile:
|
2017-09-14 09:19:15 +02:00
|
|
|
insertafter: EOF
|
2023-12-09 12:28:17 +01:00
|
|
|
dest: /etc/squid/whitelist.conf
|
2017-09-14 09:19:15 +02:00
|
|
|
line: "{{ item }}"
|
|
|
|
state: present
|
2021-05-04 14:18:40 +02:00
|
|
|
loop: '{{ squid_whitelist_items }}'
|
2017-09-14 09:19:15 +02:00
|
|
|
notify: "reload squid3"
|
|
|
|
when: ansible_distribution_major_version == '8'
|
|
|
|
|
|
|
|
- name: add some URL in whitelist (Debian 9 or later)
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.lineinfile:
|
2017-04-04 11:52:08 +02:00
|
|
|
insertafter: EOF
|
2017-08-23 01:03:07 +02:00
|
|
|
dest: /etc/squid/evolinux-whitelist-custom.conf
|
2017-04-04 11:52:08 +02:00
|
|
|
line: "{{ item }}"
|
|
|
|
state: present
|
2021-05-04 14:18:40 +02:00
|
|
|
loop: '{{ squid_whitelist_items }}'
|
2017-08-23 01:03:07 +02:00
|
|
|
notify: "reload squid"
|
2020-02-25 10:45:35 +01:00
|
|
|
when: ansible_distribution_major_version is version('9', '>=')
|
2017-04-04 11:52:08 +02:00
|
|
|
|
2023-03-20 23:33:19 +01:00
|
|
|
- ansible.builtin.include: systemd.yml
|
2020-02-25 10:45:35 +01:00
|
|
|
when: ansible_distribution_major_version is version('10', '>=')
|
2019-07-03 10:07:00 +02:00
|
|
|
|
2023-03-20 23:33:19 +01:00
|
|
|
- ansible.builtin.include: logrotate_jessie.yml
|
2019-07-03 09:41:35 +02:00
|
|
|
when: ansible_distribution_release == "jessie"
|
2017-12-28 11:16:06 +01:00
|
|
|
|
2023-03-20 23:33:19 +01:00
|
|
|
- ansible.builtin.include: logrotate_stretch.yml
|
2020-02-25 10:45:35 +01:00
|
|
|
when: ansible_distribution_major_version is version('9', '>=')
|
2017-01-03 16:50:46 +01:00
|
|
|
|
2023-03-20 23:33:19 +01:00
|
|
|
- ansible.builtin.include: minifirewall.yml
|
2016-11-07 14:00:57 +01:00
|
|
|
|
2023-03-20 23:33:19 +01:00
|
|
|
- ansible.builtin.include: log2mail.yml
|