If I try and upgrade a package that has already been started, ‘service’ module doesn’t seem to behave:
`
- name: Install Docker
yum: name=docker-io-1.3.1 state=installed
- name: Start Docker
service: name=docker state=started
`
If Docker has already been installed and started and we just upgraded, ‘service’ module blows up with:
`
/var/run/docker.pid still exists…
`
I have to manually issue a service state=restarted command to get hosts back in line. Is Docker misbehaving or should ‘service’ be smarter in this case?
Hi Matt, this appears to be an issue with the docker init script I’d say, which is only looking at the PID file and not the process it’s supposed to be referring to. I would continue to use state=restarted, and simply modify that to either be a handler (notified by the install) or to have it use a when: statement, which could check to see if the install actually changed something before trying to restart the service.
Hope that helps!
K, I will use restarted.
Handler wouldn’t work as handlers work only at the end of the play to my knowledge. That would be too later; subsequent tasks depend on docker being up.
You can also flush handlers in the middle of a play with the following task:
- meta: flush_handlers