Playbook randomly dies after async/poll

35 views
Skip to first unread message

Greg Gilbert

unread,
Feb 19, 2016, 9:05:07 AM2/19/16
to Ansible Project
Hey. I'm having an issue in Ansible 1.9.4 where a playbook just stops running. No errors or anything, the process just dies. It seems to happen at random places when running the playbook, but it all seems to happen after these two steps:

- name: Fire async to watch build
  shell: "CONTAINER=my_{{ timestamp }} /app/deploy/watch-docker.sh"
  async: 1200
  poll: 15
  register: watch_docker
  ignore_errors: true

- name: Wait until built
  async_status:
    jid: "{{ watch_docker.ansible_job_id }}"
  register: job_result
  until: job_result.finished
  retries: 100
  delay: 15
  ignore_errors: true


Is it possible that after the async shell call, the process dies on the next poll? Turning on verbose didn't seem to help. I also tried raising the timeout to 30 in ansible.cfg, but that also did nothing. If I take out these two actions and replace them with a pause action, the playbook completes. Any ideas? I'm pretty stuck on this one...

For reference, here's the watch-docker script:

// watch-docker.sh
#!/bin/bash
if [ ! -z $CONTAINER ]; then
  while true; do
      docker exec $CONTAINER pgrep php5-fpm
      catch=$?
      if [ $catch -eq 0 ]; then
          break
      fi
      sleep 5
  done
fi
exit 0


Greg Gilbert

unread,
Feb 19, 2016, 12:04:36 PM2/19/16
to Ansible Project
Update: I think it has to do with the poll: 15 in the first task. Setting that to 0 seems to make it work. Why is the polling there causing an issue?

Jakov Sosic

unread,
Aug 12, 2016, 9:43:13 AM8/12/16
to ansible...@googlegroups.com
On 02/19/2016 06:04 PM, Greg Gilbert wrote:
> Update: I think it has to do with the poll: 15 in the first task.
> Setting that to *0* seems to make it work. Why is the polling there
> causing an issue?
>

Because if you use poll > 0 then job finishes before the next task
starts so I guess `watch_docker` register doesn't contain
`ansible_job_id` property?

If you set it to 0, then job runs in background.

Reply all
Reply to author
Forward
0 new messages