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

Innacurate Behavior of Until Loops #1122

Open
sjswerdlow opened this issue Feb 12, 2024 · 3 comments
Open

Innacurate Behavior of Until Loops #1122

sjswerdlow opened this issue Feb 12, 2024 · 3 comments
Labels
needs_info requesting more detail from OP new_contributor This PR is the first contribution by a new community member.

Comments

@sjswerdlow
Copy link

While referring to: https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_loops.html#retrying-a-task-until-a-condition-is-met we found that this specific line is not accurate:

"If until is not specified, the task will retry until the task succeeds but at most retries times."

Instead no retries were done.

Relevant Run Time Env:

ansible [core 2.15.4]
  config file = None
  ...
  python version = 3.9.16 (main, May 29 2023, 00:00:00) [GCC 11.3.1 20221121 (Red Hat 11.3.1-4)] (/usr/bin/python3)
  jinja version = 3.1.3

I'm not sure how to submit issues to Ansible directly. But in my opinion, this line should be removed while the bug is fixed, then added back in.

@ansible-documentation-bot ansible-documentation-bot bot added needs_triage Needs a first human triage before being processed. new_contributor This PR is the first contribution by a new community member. labels Feb 12, 2024
@ansible-documentation-bot
Copy link
Contributor

Thanks for your Ansible docs contribution! We talk about Ansible documentation on matrix at #docs:ansible.im and on libera IRC at #ansible-docs if you ever want to join us and chat about the docs! We meet there on Tuesdays (see the Ansible calendar) and welcome additions to our weekly agenda items - scroll down to find the upcoming agenda and add a comment to put something new on that agenda.

@oraNod
Copy link
Contributor

oraNod commented Feb 12, 2024

Thanks for the issue @sjswerdlow

As a hint for submitting a fix directly, you can fork this repo and make the change to this file: https://github.com/ansible/ansible-documentation/blob/devel/docs/docsite/rst/playbook_guide/playbooks_loops.rst

Then commit the change and open a PR. Alternatively you can edit that one directly on GitHub and create a PR. Feel free to ask if you have any more questions.

@flowerysong
Copy link
Contributor

Works for me. If I copy the example task and remove the until, it retries five times and then gives up.

- hosts: localhost
  gather_facts: false
  tasks:
    - name: Retry a task until a certain condition is met
      ansible.builtin.shell: /usr/bin/foo
      register: result
      retries: 5
      delay: 10

Output:

PLAY [localhost] ***************************************************************

TASK [Retry a task until a certain condition is met] ***************************
FAILED - RETRYING: [localhost]: Retry a task until a certain condition is met (5 retries left).
FAILED - RETRYING: [localhost]: Retry a task until a certain condition is met (4 retries left).
FAILED - RETRYING: [localhost]: Retry a task until a certain condition is met (3 retries left).
FAILED - RETRYING: [localhost]: Retry a task until a certain condition is met (2 retries left).
FAILED - RETRYING: [localhost]: Retry a task until a certain condition is met (1 retries left).
fatal: [localhost]: FAILED! => {"attempts": 5, "changed": true, "cmd": "/usr/bin/foo", "delta": "0:00:00.017695", "end": "2024-02-12 14:25:00.204733", "msg": "non-zero return code", "rc": 127, "start": "2024-02-12 14:25:00.187038", "stderr": "/bin/sh: line 1: /usr/bin/foo: No such file or directory", "stderr_lines": ["/bin/sh: line 1: /usr/bin/foo: No such file or directory"], "stdout": "", "stdout_lines": []}

What did you actually try to do, and what was the output?

@samccann samccann added needs_info requesting more detail from OP and removed needs_triage Needs a first human triage before being processed. labels Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs_info requesting more detail from OP new_contributor This PR is the first contribution by a new community member.
Projects
Status: 🆕 Triage
Development

No branches or pull requests

4 participants