File tree Expand file tree Collapse file tree 3 files changed +58
-14
lines changed
roles/debian/varnish_config Expand file tree Collapse file tree 3 files changed +58
-14
lines changed Original file line number Diff line number Diff line change 1
1
---
2
2
# Defaults file for varnish_config, other variables exist from importing geerlingguy.varnish and can be overriden
3
3
4
+ limit_memlock : 82000
5
+ limit_core : infinity
6
+ tasks_max : infinity
7
+ varnish_storage : " malloc,{{ ansible_facts.memtotal_mb // 10 }}M"
4
8
varnish_config :
5
9
# List of IPs that are allowed to ask for content purge.
6
10
allowed_purge_IP : []
@@ -17,3 +21,4 @@ varnish_config:
17
21
upstream_proxies : []
18
22
# Provide an alternative filename if you are providing a template.
19
23
template_filename : default.vcl
24
+ # Varnish systemd overrides to make varnish consistent even after upgrades
Original file line number Diff line number Diff line change 1
1
---
2
- - name : Copy Varnish default VCL.
3
- ansible.builtin.template :
4
- src : " {{ item }}"
5
- dest : " {{ varnish_config_path }}/default.vcl"
6
- owner : root
7
- group : root
8
- mode : 0644
9
- with_first_found :
10
- - " {{ playbook_dir }}/templates/{{ varnish_config.template_filename }}.j2"
11
- - " {{ _ce_provision_base_dir }}/config/files/templates/{{ varnish_config.template_filename }}.j2"
12
- - " default.vcl.j2"
13
- notify :
14
- - reload systemd # handlers in https://github.com/geerlingguy/ansible-role-varnish/blob/master/handlers/main.yml
15
- - restart varnish
2
+ - block :
3
+ - name : Copy Varnish default VCL.
4
+ ansible.builtin.template :
5
+ src : " {{ item }}"
6
+ dest : " {{ varnish_config_path }}/default.vcl"
7
+ owner : root
8
+ group : root
9
+ mode : 0644
10
+ with_first_found :
11
+ - " {{ playbook_dir }}/templates/{{ varnish_config.template_filename }}.j2"
12
+ - " {{ _ce_provision_base_dir }}/config/files/templates/{{ varnish_config.template_filename }}.j2"
13
+ - " default.vcl.j2"
14
+ # This will keep varnish config as it is even after varnish upgrade
15
+ - name : Template varnish systemd service file
16
+ ansible.builtin.template :
17
+ src : varnish.service.j2
18
+ dest : /etc/systemd/system/varnish.service
19
+ mode : ' 0644'
20
+ notify :
21
+ - reload systemd
22
+ - restart varnish
23
+
24
+ # TO DO: add varnish to unattended upgrades
Original file line number Diff line number Diff line change
1
+ [Unit]
2
+ Description=Varnish Cache, a high-performance HTTP accelerator
3
+ After=network-online.target
4
+
5
+ [Service]
6
+ Type=forking
7
+ KillMode=process
8
+
9
+ PIDFile= {{ varnish_pidfile }}
10
+
11
+ # Maximum number of open files (for ulimit -n)
12
+ LimitNOFILE= {{ varnish_limit_nofile }}
13
+
14
+ # Locked shared memory
15
+ LimitMEMLOCK= {{ limit_memlock }}
16
+
17
+ # Enable this to avoid "fork failed" on reload.
18
+ TasksMax= {{ tasks_max }}
19
+
20
+ # Maximum size of the corefile.
21
+ LimitCORE= {{ limit_core }}
22
+
23
+ ExecStart=/usr/sbin/varnishd -a :80 -T 127.0.0.1:6082 -P /run/varnishd.pid -f /etc/varnish/default.vcl -S /etc/varnish/secret -s {{ varnish_storage }}
24
+
25
+ ExecReload=/usr/sbin/varnishreload
26
+
27
+ Restart=on-failure
28
+
29
+ [Install]
30
+ WantedBy=multi-user.target
You can’t perform that action at this time.
0 commit comments