Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ANSIBLE_VERBOSITY>=3 does not work with ansible 2.14 and ansible-runner #1164

Closed
rabi opened this issue Nov 17, 2022 · 7 comments
Closed

ANSIBLE_VERBOSITY>=3 does not work with ansible 2.14 and ansible-runner #1164

rabi opened this issue Nov 17, 2022 · 7 comments
Labels

Comments

@rabi
Copy link
Contributor

rabi commented Nov 17, 2022

Playbook run gets stuck when running with ansible 2.14 and ansible-runner 2.3.1 with verbosity>=3. This seems to be due to a regression in awx_display.py after ansible PR ansible/ansible#77056.

$cat test.yaml 
- hosts: all
  connection: local
  tasks:
    - name: check file
      ansible.builtin.file:
        path: /etc/foo.conf
        state: absent

$ cat inventory.yaml
[all]
test-[1:48].example.com

$export ANSIBLE_INVENTORY=inventory.yaml
$export ANSIBLE_VERBOSITY="3"
$ansible-runner run -p test.yaml $HOME
traceback:
.....
<test-19.example.com> EXEC /bin/sh -c 'echo ~ramishra && sleep 0'
Using module file /home/ramishra/.local/lib/python3.10/site-packages/ansible/modules/file.py
<test-19.example.com> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/ramishra/.ansible/tmp `"&& mkdir "` echo /home/ramishra/.ansible/tmp/ansible-tmp-1668673584.1542976-1435398-231198689550583 `" && echo ansible-tmp-1668673584.1542976-1435398-231198689550583="` echo /home/ramishra/.ansible/tmp/ansible-tmp-1668673584.1542976-1435398-231198689550583 `" ) && sleep 0'
<test-17.example.com> PUT /home/ramishra/.ansible/tmp/ansible-local-14328044ytahafl/tmpawosdm87 TO /home/ramishra/.ansible/tmp/ansible-tmp-1668673584.0746303-1435377-8803172912834/AnsiballZ_file.py
<test-17.example.com> EXEC /bin/sh -c 'chmod u+x /home/ramishra/.ansible/tmp/ansible-tmp-1668673584.0746303-1435377-8803172912834/ /home/ramishra/.ansible/tmp/ansible-tmp-1668673584.0746303-1435377-8803172912834/AnsiballZ_file.py && sleep 0'
<test-16.example.com> EXEC /bin/sh -c '/usr/bin/python3 /home/ramishra/.ansible/tmp/ansible-tmp-1668673584.0498953-1435368-188608545559309/AnsiballZ_file.py && sleep 0'
<test-20.example.com> ESTABLISH LOCAL CONNECTION FOR USER: ramishra
<test-20.example.com> EXEC /bin/sh -c 'echo ~ramishra && sleep 0'
Using module file /home/ramishra/.local/lib/python3.10/site-packages/ansible/modules/file.py
<test-21.example.com> ESTABLISH LOCAL CONNECTION FOR USER: ramishra
<test-21.example.com> EXEC /bin/sh -c 'echo ~ramishra && sleep 0'
<test-17.example.com> EXEC /bin/sh -c '/usr/bin/python3 /home/ramishra/.ansible/tmp/ansible-tmp-1668673584.0746303-1435377-8803172912834/AnsiballZ_file.py && sleep 0'
<test-18.example.com> PUT /home/ramishra/.ansible/tmp/ansible-local-14328044ytahafl/tmpl2xxribm TO /home/ramishra/.ansible/tmp/ansible-tmp-1668673584.1266525-1435390-274928110267104/AnsiballZ_file.py
...
@github-actions github-actions bot added the needs_triage New item that needs to be triaged label Nov 17, 2022
@rabi
Copy link
Contributor Author

rabi commented Nov 17, 2022

Related tripleo bug: https://bugs.launchpad.net/tripleo/+bug/1996612

rabi added a commit to rabi/ansible-runner that referenced this issue Nov 17, 2022
Let the system flush it as expected with PR[1].

[1] ansible/ansible#77056

Fixes: ansible#1164
openstack-mirroring pushed a commit to openstack-archive/tripleo-quickstart-extras that referenced this issue Nov 18, 2022
Since Ansible was bumped to 2.14, we've observed the container image
build process gets stuck in the middle of ansible tasks to generate
Docker/Buildah files, because of a bug[1] with ansible-runner.

This removes --debug option from the build command to avoid -vvv option
in the ansible command, to workaround the above bug.

[1] ansible/ansible-runner#1164

Related-Bug: #1996612
Change-Id: I53c688077c65da03d8c3cf104862e02cefc2c615
openstack-mirroring pushed a commit to openstack/openstack that referenced this issue Nov 18, 2022
* Update tripleo-quickstart-extras from branch 'master'
  to 9f3411506b912f73235d90c7fb8423022efdc6e2
  - Merge "Do not use --debug for image build"
  - Do not use --debug for image build
    
    Since Ansible was bumped to 2.14, we've observed the container image
    build process gets stuck in the middle of ansible tasks to generate
    Docker/Buildah files, because of a bug[1] with ansible-runner.
    
    This removes --debug option from the build command to avoid -vvv option
    in the ansible command, to workaround the above bug.
    
    [1] ansible/ansible-runner#1164
    
    Related-Bug: #1996612
    Change-Id: I53c688077c65da03d8c3cf104862e02cefc2c615
openstack-mirroring pushed a commit to openstack/tripleo-ci that referenced this issue Nov 24, 2022
Since Ansible was bumped to 2.14, we've observed the container image
build process gets stuck in the middle of ansible tasks to generate
Docker/Buildah files, because of a bug[1] with ansible-runner.

This removes --debug option from the build command to avoid -vvv option
in the ansible command, to workaround the above bug.

Same workaround is added for content-provider already[2], adding same
workaround for build-containers role.

[1] ansible/ansible-runner#1164
[2] https://review.opendev.org/c/openstack/tripleo-quickstart-extras/+/864838

Related-Bug: #1996612
Change-Id: I498c9cac7815d3d0682835d2bf943594dad2203c
openstack-mirroring pushed a commit to openstack/openstack that referenced this issue Nov 24, 2022
* Update tripleo-ci from branch 'master'
  to 909c83bc625fac1479b281d325e29bb7b2388c3f
  - Do not use --debug for image build
    
    Since Ansible was bumped to 2.14, we've observed the container image
    build process gets stuck in the middle of ansible tasks to generate
    Docker/Buildah files, because of a bug[1] with ansible-runner.
    
    This removes --debug option from the build command to avoid -vvv option
    in the ansible command, to workaround the above bug.
    
    Same workaround is added for content-provider already[2], adding same
    workaround for build-containers role.
    
    [1] ansible/ansible-runner#1164
    [2] https://review.opendev.org/c/openstack/tripleo-quickstart-extras/+/864838
    
    Related-Bug: #1996612
    Change-Id: I498c9cac7815d3d0682835d2bf943594dad2203c
@Akasurde Akasurde added has_pr and removed needs_triage New item that needs to be triaged labels Nov 29, 2022
@Akasurde
Copy link
Member

resolved_by_pr #1165

nitzmahone added a commit to nitzmahone/ansible that referenced this issue Dec 2, 2022
* demonstrates the underlying issue behind ansible/ansible-runner#1164
@nitzmahone
Copy link
Member

nitzmahone commented Dec 2, 2022

This one is nasty- took several iterations to get to the true root cause. It's looking like we're going to fix it directly in core, at least for the short-term. The underlying problem is really around core's usage of fork- it's just exacerbated by the way runner does its context capture and what I dubbed "event steganography" in stdout, in combination with core 2.14 issuing most of its stdout writes from a non-main thread.

Watch ansible/ansible#79522 for updates- I'm first posting a new integration test that triggers this behavior extremely reliably, then once we're sure it's failing properly in CI, I'll add the fix.

nitzmahone added a commit to nitzmahone/ansible that referenced this issue Dec 3, 2022
* demonstrates the underlying issue behind ansible/ansible-runner#1164
@rabi
Copy link
Contributor Author

rabi commented Dec 3, 2022

Unfortunately I'm still not clear why we can't merge the the current proposed PR to provide a short term fix with ansible-runner which actually works fine in all my testing.

Sorry to say this, but the PR has been there since 3 weeks. We all know the issue happens when using Display and stdout flush with threading which happens to be the case with ansible-runner and what this test patch is also doing. Would not it be appropriate to merge the PR and then revert in the future if and when there is a permanent fix to ansible-core is available. I still don't understand the little alacrity shown to fix such critical bugs and provide ansible-runner consumers a better experience.

nitzmahone added a commit to nitzmahone/ansible that referenced this issue Dec 4, 2022
* demonstrates the underlying issue behind ansible/ansible-runner#1164
@nitzmahone
Copy link
Member

The final fix is available at ansible/ansible#79522 are you able to verify that it works for you? We'll probably be releasing this in 2.14.1 within the next couple of days...

nitzmahone added a commit to nitzmahone/ansible that referenced this issue Dec 6, 2022
* demonstrates the underlying issue behind ansible/ansible-runner#1164
@Akasurde
Copy link
Member

Akasurde commented Dec 7, 2022

I am going ahead and closing this issue since the fix is applied in the Ansible repo using ansible/ansible#79522. Please feel free to reopen if the problem persists. Thanks

@Akasurde Akasurde closed this as completed Dec 7, 2022
@Akasurde
Copy link
Member

Akasurde commented Dec 7, 2022

resolved_by_pr ansible/ansible#79522

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants