Service Module on Package Upgrade

49 views
Skip to first unread message

Matt Hughes

unread,
Dec 11, 2014, 10:50:08 AM12/11/14
to ansible...@googlegroups.com
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?

James Cammarata

unread,
Dec 11, 2014, 10:59:32 AM12/11/14
to ansible...@googlegroups.com
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!


--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/1f46ebe4-2972-419a-b00d-f214d1ef0ba5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Matt Hughes

unread,
Dec 11, 2014, 11:52:08 AM12/11/14
to James Cammarata, ansible...@googlegroups.com

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 received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/N6jYWgvRgeM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.

To post to this group, send email to ansible...@googlegroups.com.

James Cammarata

unread,
Dec 11, 2014, 12:21:29 PM12/11/14
to Matt Hughes, ansible...@googlegroups.com
You can also flush handlers in the middle of a play with the following task:
   - meta: flush_handlers

Reply all
Reply to author
Forward
0 new messages