geerlingguy / ansible-role-varnish

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

Debian 10/11: varnish.service file defaults used instead of /etc/defaults/varnish #108

Closed denics closed 2 years ago

denics commented 2 years ago

The issue in #66 is still present in Debian 10 and Debian 11. It is easy to test, on a vanilla Debian, simply launch your role with custom port and you will see that the system is always using port 8443 (default Debian).

If you open /etc/systemd/system/multi-user.target.wants/varnish.service you will see that the Execute command is hard-coded.

PROPOSED SOLUTION: override default varnish.service with a custom template, maybe I can propose a patch for Debian, I do not know if this the same behavior with other OS

geerlingguy commented 2 years ago

The service file should be coming from here: https://github.com/geerlingguy/ansible-role-varnish/blob/2a9976231c29faa82b3448beb18acf033b551267/templates/varnish.service.j2

geerlingguy commented 2 years ago

(And that should be copied across if running Debian 8 or higher: https://github.com/geerlingguy/ansible-role-varnish/blob/2a9976231c29faa82b3448beb18acf033b551267/tasks/main.yml#L33-L46

denics commented 2 years ago

Ok, then I confirm that it works as expected, but that Debian will overwrite the service file when upgrade, perhaps adding a WARNING in the doc. Thanks for your roles and collections!