ricbra / ansible-logentries

Ansible role for installing logentries agent and daemon
17 stars 12 forks source link

Ensure service is started if stopped? #25

Open seenickcode opened 6 years ago

seenickcode commented 6 years ago

Hey there. I noticed that is the service is stopped for some reason, there's no way to make sure it is indeed started. We have a "Restart logentries" handler but that's only triggered for things like config updates.

Am I missing something or can maybe someone help me figure out where to place a task to ensure the service is started after the step to "Follow logs"?

Maybe something like this, or?

- name: Ensure logentries service started if stopped
  service: name={{ logentries_service }} state=started

Thanks.

ricbra commented 6 years ago

This enables the service if it isn't enabled yet and also starts the service if it is somehow stopped:

- name: Ensure logentries service running
  service: name={{ logentries_service }} state=started enabled=yes

I see this is currently missing in the role, so it wasn't required in earlier versions of logentries I guess. Could you try this and open a PR for this if it works?

seenickcode commented 6 years ago

Will do thanks.