griggheo / ansible-consul-template

Ansible role for installing consul-template
Apache License 2.0
54 stars 52 forks source link

systemd config changes for newer consul-template versions #65

Open MrMMorris opened 9 months ago

MrMMorris commented 9 months ago

I assume this role isn't being updated anymore, but wanted to put this here in case anyone uses it for newer versions (v0.18+) of consul-template. There needs to be some changes to ./templates/consul-template.service.systemd.j2 so that reload and stop/start works correctly. I am posting the full config I have that works:

[Unit]
Description=consul-template
Requires=network-online.target
After=network-online.target consul.service

[Service]
{% if consul_template_use_config_dir %}
ExecStart={{ consul_template_home }}/bin/{{ consul_template_binary }}  -config={{ consul_template_home }}/config
{% else %}
ExecStart={{ consul_template_home }}/bin/{{ consul_template_binary }}  -config={{ consul_template_home }}/config/{{ consul_template_config_file }}
{% endif %}
KillSignal=SIGINT
ExecReload=/bin/kill -HUP $MAINPID
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target
griggheo commented 9 months ago

Although I am not actively updating the code, I will gladly review any PRs you want to submit.

MrMMorris commented 9 months ago

I appreciate that. I might submit a PR if I have time but there are quite a few other changes for newer versions

griggheo commented 9 months ago

Please do submit it with any other changes, if you have time. It does make sense to keep in sync with updates to consul-template.