diff --git a/roles/varnish/tasks/main.yml b/roles/varnish/tasks/main.yml index b2ac1f42d0..e3310ab2e8 100644 --- a/roles/varnish/tasks/main.yml +++ b/roles/varnish/tasks/main.yml @@ -32,14 +32,8 @@ - varnish when: ansible_distribution_major_version|int >= 25 and ansible_distribution_major_version|int < 29 -- name: make varnish override file dir - file: name=/etc/systemd/system/varnish.service.d/ state=directory mode=0755 owner=root group=root - tags: - - varnish - when: ansible_distribution_major_version|int >= 29 - - name: install varnish /etc/systemd/system/varnish.service file (fedora 29+) - template: src=varnish.f29.j2 dest=/etc/systemd/system/varnish.service.d/infra.conf owner=root group=root + template: src=varnish.f29.j2 dest=/etc/systemd/system/varnish.service owner=root group=root notify: - reload systemd - restart varnish diff --git a/roles/varnish/templates/varnish.f29.j2 b/roles/varnish/templates/varnish.f29.j2 index 2b1aaedfd3..3cc34b6833 100644 --- a/roles/varnish/templates/varnish.f29.j2 +++ b/roles/varnish/templates/varnish.f29.j2 @@ -12,6 +12,31 @@ {% set VARNISH_STORAGE="malloc,256M" %} {% endif %} +[Unit] +Description=Varnish Cache, a high-performance HTTP accelerator +After=network-online.target + [Service] Type=simple ExecStart=/usr/sbin/varnishd -F -a :{{VARNISH_LISTEN_PORT}} -f /etc/varnish/default.vcl -s {{VARNISH_STORAGE}} + +# Maximum number of open files (for ulimit -n) +LimitNOFILE=131072 + +# Locked shared memory - should suffice to lock the shared memory log +# (varnishd -l argument) +# Default log size is 80MB vsl + 1M vsm + header -> 82MB +# unit is bytes +LimitMEMLOCK=85983232 + +# Enable this to avoid "fork failed" on reload. +TasksMax=infinity + +# Maximum size of the corefile. +LimitCORE=infinity + +ExecStart=/usr/sbin/varnishd -a :6081 -f /etc/varnish/default.vcl -s malloc,256m +ExecReload=/usr/sbin/varnishreload + +[Install] +WantedBy=multi-user.target