-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reworking-varnish-role #2354
base: 2.x
Are you sure you want to change the base?
Reworking-varnish-role #2354
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,24 @@ | ||
--- | ||
- name: Copy Varnish default VCL. | ||
ansible.builtin.template: | ||
src: "{{ item }}" | ||
dest: "{{ varnish_config_path }}/default.vcl" | ||
owner: root | ||
group: root | ||
mode: 0644 | ||
with_first_found: | ||
- "{{ playbook_dir }}/templates/{{ varnish_config.template_filename }}.j2" | ||
- "{{ _ce_provision_base_dir }}/config/files/templates/{{ varnish_config.template_filename }}.j2" | ||
- "default.vcl.j2" | ||
notify: | ||
- reload systemd # handlers in https://github.com/geerlingguy/ansible-role-varnish/blob/master/handlers/main.yml | ||
- restart varnish | ||
- block: | ||
- name: Copy Varnish default VCL. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. indentation should be 2 spaces, or is there a reason here are 4? |
||
ansible.builtin.template: | ||
src: "{{ item }}" | ||
dest: "{{ varnish_config_path }}/default.vcl" | ||
owner: root | ||
group: root | ||
mode: 0644 | ||
with_first_found: | ||
- "{{ playbook_dir }}/templates/{{ varnish_config.template_filename }}.j2" | ||
- "{{ _ce_provision_base_dir }}/config/files/templates/{{ varnish_config.template_filename }}.j2" | ||
- "default.vcl.j2" | ||
# This will keep varnish config as it is even after varnish upgrade | ||
- name: Template varnish systemd service file | ||
ansible.builtin.template: | ||
src: varnish.service.j2 | ||
dest: /etc/systemd/system/varnish.service | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there is also a systemd file in /lib/systemd/system/varnish.service , probably installed by the varnish package. Do we need to take care of that? |
||
mode: '0644' | ||
notify: | ||
- reload systemd | ||
- restart varnish | ||
|
||
# TO DO: add varnish to unattended upgrades |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
[Unit] | ||
Description=Varnish Cache, a high-performance HTTP accelerator | ||
After=network-online.target | ||
|
||
[Service] | ||
Type=forking | ||
KillMode=process | ||
|
||
PIDFile= {{ varnish_pid }} | ||
|
||
# Maximum number of open files (for ulimit -n) | ||
LimitNOFILE= {{ limit_nofile }} | ||
|
||
# Locked shared memory | ||
LimitMEMLOCK= {{ limit_memlock }} | ||
|
||
# Enable this to avoid "fork failed" on reload. | ||
TasksMax= {{ tasks_max }} | ||
|
||
# Maximum size of the corefile. | ||
LimitCORE= {{ limit_core }} | ||
|
||
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 }} | ||
|
||
ExecReload=/usr/sbin/varnishreload | ||
|
||
Restart=on-failure | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason why we need this block? please add a code comment.