griggheo / ansible-consul-template

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

Systemd service fails due to redirected output #17

Closed DavidWittman closed 8 years ago

DavidWittman commented 8 years ago

The consul-template service fails to start because of the attempt to redirect stdout to a log file. Systemd does not execute the ExecStart command as a shell, so these are passed as additional arguments to the consul-template command, which causes it to fail. See the output below:

# journalctl -u consul-template
-- Logs begin at Sat 2016-01-09 17:34:28 UTC, end at Sat 2016-01-09 18:39:27 UTC. --
Jan 09 18:32:29 mesos-slave-02 systemd[1]: Started consul-template.
Jan 09 18:32:29 mesos-slave-02 systemd[1]: Starting consul-template...
Jan 09 18:32:29 mesos-slave-02 consul-template[24970]: Consul Template returned errors:
Jan 09 18:32:29 mesos-slave-02 consul-template[24970]: cli: extra argument(s): [">>" "/var/log/consul-te
Jan 09 18:32:29 mesos-slave-02 systemd[1]: consul-template.service: main process exited, code=exited, st
Jan 09 18:32:29 mesos-slave-02 systemd[1]: Unit consul-template.service entered failed state.
Jan 09 18:32:29 mesos-slave-02 systemd[1]: consul-template.service failed.

I would suggest relying on journalctl for logging and ditching the log file when systemd is being used. I'd be happy to submit a PR for this, just thought I'd open an issue first to get your blessing.

griggheo commented 8 years ago

Sure, please send me a PR!