geerlingguy / ansible-role-varnish

Ansible Role - Varnish HTTP accelerator
https://galaxy.ansible.com/geerlingguy/varnish/
MIT License
80 stars 88 forks source link

Add Systemd StartPre and StopPost into Systemd service template #106

Closed nlamirault closed 3 years ago

nlamirault commented 3 years ago

We use your Ansible role to install Varnish. But we must have a systemd service file like that :

$ sudo systemctl cat varnish
# /lib/systemd/system/varnish.service
[Unit]
Description=Varnish Cache, a high-performance HTTP accelerator
After=network-online.target

[Service]
Type=forking
KillMode=process

PIDFile=/run/varnishd.pid

# 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

ExecStartPre=-/bin/mount -t tmpfs tmpfs /var/lib/varnish -o size=512M
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 malloc,4G -t 0 -p http_req_hdr_len=16k
ExecReload=/usr/sbin/varnishreload
ExecStopPost=-/bin/umount /var/lib/varnish

Restart=on-failure

[Install]
WantedBy=multi-user.target
stale[bot] commented 3 years ago

This pull request has been marked 'stale' due to lack of recent activity. If there is no further activity, the PR will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark pull requests as stale.

nlamirault commented 3 years ago

Any news @geerlingguy ?

stale[bot] commented 3 years ago

This issue is no longer marked for closure.

geerlingguy commented 3 years ago

I would need to see some docs in the README for the two new variables, and ideally they'd have defaults (e.g. '') and the check in the template would be to see if there is a value or not (instead of is defined).

stale[bot] commented 3 years ago

This pull request has been marked 'stale' due to lack of recent activity. If there is no further activity, the PR will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark pull requests as stale.

stale[bot] commented 3 years ago

This pull request has been closed due to inactivity. If you feel this is in error, please reopen the pull request or file a new PR with the relevant details.