diff --git a/defaults/main.yml b/defaults/main.yml index 6085b96..b2576fa 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,5 +1,12 @@ --- squid_install: True +squid_deb_packages: + - squid + - squidclient + +squid_el_packages: + - squid + squid_local_nets: - '127.0.0.1/8' @@ -10,6 +17,10 @@ squid_safe_ports: - 80 - 443 +squidclient_enabled: True +squidclient_allowed_hosts: + - '127.0.0.1/8' + squid_max_object_size: '10 MB' squid_disk_cache: '2048 16 256' diff --git a/tasks/main.yml b/tasks/main.yml index 7f7d5fd..72af3c4 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,7 +1,7 @@ --- - block: - name: Install the squid package on RH based systems - yum: pkg=squid state=present + yum: pkg={{ squid_el_packages }} state=present when: - ansible_distribution_file_variety == "RedHat" @@ -10,7 +10,7 @@ - block: - name: Install the squid package on Debian based systems - apt: pkg=squid state=present cache_valid_time=3600 + apt: pkg={{ squid_deb_packages }} state=present cache_valid_time=3600 when: - ansible_distribution_file_variety == "Debian" diff --git a/templates/squid.conf.j2 b/templates/squid.conf.j2 index 7e276a6..e1d8a6b 100644 --- a/templates/squid.conf.j2 +++ b/templates/squid.conf.j2 @@ -19,6 +19,15 @@ acl Safe_ports port {{ port }} acl CONNECT method CONNECT +{% if squidclient_enabled %} +acl PURGE method PURGE +acl localhost src 127.0.0.1 +{% for cidr in squidclient_allowed_hosts %} +acl squidclientnet src {{ cidr }} +{% endfor %} +http_access allow PURGE localhost +http_access allow PURGE squidclientnet +{% endif %} # # Recommended minimum Access Permission configuration: #