Hi,
This has been driving me mad :).
- Ansible 2.0.2
- Ubuntu 14.04
The following task ‘hangs’ whilst executing in a Docker container:
`
shell: >
echo $(cat /dev/urandom | tr -dc ‘a-zA-Z0-9’ | fold -w 16 | head -n 1)
{{ arbitrary_file_path }}
args:
executable: /bin/bash
`
If I get a shell in the same container (whilst it’s hung running the task), and either run the command directly or run:
`
ansible 127.0.0.1 -c local -m shell -a “echo $(cat /dev/urandom | tr -dc ‘a-zA-Z0-9’ | fold -w 16 | head -n 1) > foo_file executable=/bin/bash”
`
It works as expected!
If I take a look at the processes whilst it’s hung, I get (truncated on the right):
`
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 4448 800 ? Ss 10:18 0:00 /bin/sh -c /srv/provisioning/entrypoint.sh
root 7 0.0 0.0 17968 2868 ? S 10:18 0:00 /bin/bash /srv/provisioning/entrypoint.sh
root 8 8.9 0.1 82740 26568 ? R 10:18 0:14 python /usr/bin/ansible-playbook /srv/provisioning/playbook.yml -c local
root 11 8.8 0.1 155768 23084 ? Sl 10:18 0:13 python /usr/bin/ansible-playbook /srv/provisioning/playbook.yml -c local
root 735 0.0 0.1 97004 25064 ? S 10:20 0:00 python /usr/bin/ansible-playbook /srv/provisioning/playbook.yml -c local
root 742 0.0 0.0 4448 804 ? S 10:20 0:00 /bin/sh -c /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-
root 743 0.0 0.0 4448 688 ? S 10:20 0:00 /bin/sh -c LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/p
root 744 0.0 0.0 34820 11812 ? S 10:20 0:00 /usr/bin/python /home/tru/.ansible/tmp/ansible-tmp-1461234012.13-9745977883185/co
root 745 0.0 0.0 17964 2900 ? S 10:20 0:00 /bin/bash -c echo $(cat /dev/urandom | tr -dc ‘a-zA-Z0-9’ | fold -w 16 | head -n
root 746 0.0 0.0 17972 2184 ? S 10:20 0:00 /bin/bash -c echo $(cat /dev/urandom | tr -dc ‘a-zA-Z0-9’ | fold -w 16 | head -n
root 747 90.3 0.0 4368 668 ? R 10:20 1:07 cat /dev/urandom
root 748 5.8 0.0 4376 772 ? S 10:20 0:04 tr -dc a-zA-Z0-9
root 749 2.2 0.0 4360 708 ? S 10:20 0:01 fold -w 16
`
Which makes it look like the final ‘head’ in the piped chain isn’t terminating the cat like it typically would. Why that is, I don’t know.
Perhaps this makes sense to someone?
Thanks in advance,
JS