Docker container fails to reload

144 views
Skip to first unread message

Guy Knights

unread,
May 31, 2016, 3:23:26 PM5/31/16
to ansible...@googlegroups.com
I keep getting this error when I run a playbook with a docker task whose state is set to 'reloaded':

fatal: [10.0.3.22]: FAILED! => {"changed": false, "failed": true, "module_stderr": "", "module_stdout": "Traceback (most recent call last):\r\n  File \"/tmp/ansible_T257mO/ansible_module_docker.py\", line 1972, in <module>\r\n    main()\r\n  File \"/tmp/ansible_T257mO/ansible_module_docker.py\", line 1942, in main\r\n    reloaded(manager, containers, count, name)\r\n  File \"/tmp/ansible_T257mO/ansible_module_docker.py\", line 1792, in reloaded\r\n    for container in manager.get_differing_containers():\r\n  File \"/tmp/ansible_T257mO/ansible_module_docker.py\", line 1305, in get_differing_containers\r\n    name, value = container_label.split('=', 1)\r\nValueError: need more than 1 value to unpack\r\n", "msg": "MODULE FAILURE", "parsed": false}

I only started getting this recently after I started using ansible 2.1. The docker task in question hasn't been modified in a long time, and if I manually remove the container from the host and re-run the playbook, it starts the container ok.

Does anyone know why it's doing this suddenly?

Thanks,
Guy

Johannes Kastl

unread,
Jun 2, 2016, 4:31:56 AM6/2/16
to ansible...@googlegroups.com
On 31.05.16 21:23 Guy Knights wrote:

> I only started getting this recently after I started using ansible 2.1. The
> docker task in question hasn't been modified in a long time, and if I
> manually remove the container from the host and re-run the playbook, it
> starts the container ok.

How did you install ansible 2.1? Recently there was an error because
some git submodules were not up to date and caused problems...

Johannes


signature.asc

Guy Knights

unread,
Jun 21, 2016, 8:20:40 PM6/21/16
to Ansible Project
Hi Johannes,

It's a git clone of the stable-2.1 branch. I recently (like, today) did a 'git pull' in addition to 'git submodule update --recursive' and tried again, still got the same error.

I just tried switching back to the stable-2.0.0.1 branch and it seems to be working fine, so it appears to be a specific 2.1 issue.

Thanks,
Guy

Henrique Santos Fernandes

unread,
Jun 22, 2016, 4:30:42 PM6/22/16
to Ansible Project
Hello Guy,

Have you updated you docker server?
I am not sure, but i had the same problem now! and I just updated some one else pull requets that should solve it: https://github.com/ansible/ansible-modules-core/pull/4015

But with older ansible, it did not showed an error, it just reloaded the container, i havent looked into it. I know it reloads when it should not, like it is reloading for a container that did not change, eitherway, the PR make it run again. 
If you have Labels at the Dockerfile, the container will restart if you did not add them to the ansible task. Not sure if this should be the behavior, but it is.

Also i think ansible 2.2 will not have this issue, as it is deprecating the docker module and using a newer one.

Hope that helps! 

Guy Knights

unread,
Jun 28, 2016, 7:32:51 PM6/28/16
to ansible...@googlegroups.com
Hmm, no that didn't fix it for me unfortunately. I updated the docker-engine package to the latest and also pulled the latest ansible stable-2.1 commits, but it still fails with the same error. I'll try changing over to the new docker_container module instead and see if that fixes it for me.

Thanks anyway!
Guy

--
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/1UTB7O5ZvpE/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.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/35c5b979-55e5-497f-8ec2-188890a2346a%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Guy Knights

unread,
Jun 29, 2016, 1:01:08 PM6/29/16
to ansible...@googlegroups.com
Ok, I changed this to use docker_container and it seems to be working ok now.

One thing I am curious about though, is that every time this task runs it registers as 'changed' even though the restart policy is explicitly set to 'no'. None of the module arguments have changed between runs, so is there a valid reason why this is happening?

Thanks,
Guy

Guy Knights

unread,
Sep 12, 2016, 8:25:00 PM9/12/16
to Ansible Project
It's been a while but I figured I'd bump this to see if anyone has any insight into my question above about why ansible insists on restarting containers even though the task config hasn't changed.
To unsubscribe from this group and all its topics, send an email to ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.

Bryan Hiestand

unread,
Sep 14, 2016, 1:53:00 PM9/14/16
to Ansible Project
I have also been having this issue, but haven't dug deeper at this point.
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.

Guy Knights

unread,
Sep 14, 2016, 2:02:13 PM9/14/16
to ansible...@googlegroups.com
I pulled the latest stable-2.1 commits and after some more testing I've discovered that Ansible isn't actually restarting the containers, but was reporting that the task changed even though nothing changed. There was a small period of time I was running and re-running it where it seemed to settle down and stop reporting that the task changed, but I just tried it a couple of times and it's started doing it again.

To unsubscribe from this group and all its topics, send an email to ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/0c1f8926-9323-4dd5-ab43-c6c0ea92e3a2%40googlegroups.com.

Henrique Santos Fernandes

unread,
Sep 14, 2016, 11:41:43 PM9/14/16
to ansible...@googlegroups.com

Well, for me a while ago I was sure it was restarting

What I found at the code at the time is, when pull was set to true or always ( can't remember, at my phone) it set the task to changed.

This behavior is different from the old module, that only changed when a new image was downloaded.


--
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/1UTB7O5ZvpE/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.
Reply all
Reply to author
Forward
0 new messages