Add Varnish Role
This commit is contained in:
parent
44021346e6
commit
1bb4840f48
|
@ -0,0 +1,5 @@
|
|||
# Varnish
|
||||
|
||||
## Tasks
|
||||
|
||||
## Variables
|
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
thread_pools: "{{ ansible_processor_cores * ansible_processor_count }}"
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
- name: reload systemctl
|
||||
command: systemctl daemon-reload
|
|
@ -0,0 +1,24 @@
|
|||
---
|
||||
- name: Install Varnish
|
||||
apt: name=varnish state=present
|
||||
|
||||
- name: Remove default varnish configuration files
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: absent
|
||||
with_fileglob: "/etc/defaults/varnish*"
|
||||
|
||||
- name: Copy Varnish service configuration file
|
||||
copy:
|
||||
src: "/lib/systemd/system/varnish.service"
|
||||
dest: "/etc/systemd/system/"
|
||||
|
||||
- name: Modify Varnish configuration file
|
||||
lineinfile:
|
||||
dest: "/etc/systemd/system/varnish.service"
|
||||
regexp: "^ExecStart="
|
||||
line: |
|
||||
ExecStart=/usr/sbin/varnishd -a 0.0.0.0:80 -T localhost:6082 -f /etc/varnish/default.vcl \
|
||||
-S /etc/varnish/secret -s malloc,2G \
|
||||
-p thread_pools={{ thread_pools }} -p thread_pool_add_delay=2 -p thread_pool_min=500 -p thread_pool_max=5000
|
||||
notify: reload systemctl
|
Loading…
Reference in New Issue