-
Notifications
You must be signed in to change notification settings - Fork 23.8k
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
Playbook skips to PLAY RECAP when installing specific package version with yum #16006
Comments
@kellenanker Hmm, there was a bug around arg squashing that was just fixed late in 2.1 (the original task shouldn't show up as skipped, just "ok")- I'm wondering if the behavior is triggered by that bug. Could you try your repro against 2.1 and see if it's still occurring? |
Same problem. Currently working with Ansible 2.1.0.0 |
Interesting- do you see "ok" on that task instead of "skipped" (followed by the bailout)? |
Yep, its now saying "ok," but it still gives that message "No Package matching 'influxdb-0.13.0.x86_64' found available, installed or updated" |
@kellenanker was influxdb installed from a yum repository or directly via an RPM downloaded? The yum module tries to query yum repositories for the data, so it will fail like this if it can't find the requested name somewhere in a yum repodata. |
@kellenanker there hasn't been any follow-up recently, is this still an issue per the previous comment I left above? |
We saw this same issue with ansible 2.1.0.0 when trying to install a package that doesn't exist using
Which is confusing since the task reports |
@jimi-c influxdb was installed via a repo. Running |
I'm running into this same problem on RHEL 6.8 with Ansible 2.1.0.0 from EPEL 6 repository. The task says "ok" and is written in green text. However, at the bottom of the output it says: NO MORE HOSTS LEFT ************************************************************* PLAY RECAP ********************************************************************* Relevant content when using "-vvvv": "msg": "No Package matching 'perl-Module-Build-0.42055' found available, installed or updated", "rc": 0, "results": ["perl-App-cpanminus-1.7042-1.el6.noarch providing perl-App-cpanminus is already installed"] In this case, perl-App-cpanminus was the first of about 30 items in the "with_items" list for yum. |
I suppose you could argue that it should be "ok" because yum was able to complete its task. If you register a variable for the yum task, you'll see that "command_result.msg" is "All items completed". To find "No Package matching 'perl-Module-Build-0.42055' found available, installed or updated", you have to go to loop through command_result.results and that will show you that "msg", "rc", and "results" I posted above. But even if we're ok with it being "ok", why does Ansible show the RECAP as having a failed task? Yum itself has an interesting behaviour in that if you tried "yum install perl-Module-Build-0.42055", it would have an exit code of 1, but if you tried "yum install perl-Module-Build-0.42055 perl-Module-Build-0.4205", it would have an exit code of 0 as the last module actually exists. However, I don't think the return code is having an effect here... Btw, this perl-Module-Build package is one I built myself, so you won't find it in RHEL6 or EPEL6. It's just an example though. You could use any package. |
Note that we're all using loops as well... If you don't use a loop and you just specify a single name, the task has a fatal error and shows up as failed in the RECAP: TASK [application : yum] ******************************************************* NO MORE HOSTS LEFT ************************************************************* PLAY RECAP ********************************************************************* |
Interesting that the rc is 0... as that would be 1 on the command line, but good that it shows as failed. I don't know anything about writing Ansible modules, but maybe the real rc is 1 and that's what's triggering the failure? I wonder why it doesn't work with a loop. I know the yum module is optimized to run once when using a loop... so maybe the problematic yum behaviour I noted above is involved... |
I reckon this is the line that causes the module to fail and the PLAY RECAP to note a failed task: https://github.com/ansible/ansible-modules-core/blob/b3c606047d111d64d30a7e20690a081414ceae52/packaging/os/yum.py#L851 However, why is it showing up as "ok" in the task output... |
The implementation is fairly simple, we force the rc= parameter to not be zero so that the check in _executor/task_result.py_ correctly determines that it failed. Without this change Ansible would report the task to be ok (despite failed=True and msg=Some_error_message) although Ansible stops and the summary output reports a failed task. This fixes ansible#4214, ansible#4384 and also relates to ansible/ansible#12070, ansible/ansible#16006, ansible/ansible##16597, ansible/ansible#17208 and ansible/ansible#17252
The implementation is fairly simple, we force the rc= parameter to not be zero so that the check in _executor/task_result.py_ correctly determines that it failed. Without this change Ansible would report the task to be ok (despite failed=True and msg=Some_error_message) although Ansible stops and the summary output reports a failed task. This fixes ansible#4214, ansible#4384 and also relates to ansible/ansible#12070, ansible/ansible#16006, ansible/ansible##16597, ansible/ansible#17208 and ansible/ansible#17252
I've hit this recently too, on CentOS 7 on a
And in the console during a playbook run:
Same thing if I use the Using Ansible 2.1.1.0 from pip. |
@minusdavid perhaps we should add an option there to allow that case to be ignored rather than raise an error? |
@kellenanker ping, this issue is still waiting on your feedback. We will close the issue if you do not respond. |
@jimi-c how do you mean? Could yoi elaborate on your idea? |
Just to follow up on this matter (and so the ticket isn't closed while everyone is still discussing it): rolling back to Ansible 2.0.1.0 fixed the issue. I have yet to attempt to reproduce it on a more recent version since rolling back. |
The implementation is fairly simple, we force the rc= parameter to not be zero so that the check in _executor/task_result.py_ correctly determines that it failed. Without this change Ansible would report the task to be ok (despite failed=True and msg=Some_error_message) although Ansible stops and the summary output reports a failed task. This fixes #4214, #4384 and also relates to ansible/ansible#12070, ansible/ansible#16006, ansible/ansible##16597, ansible/ansible#17208 and ansible/ansible#17252
The implementation is fairly simple, we force the rc= parameter to not be zero so that the check in _executor/task_result.py_ correctly determines that it failed. Without this change Ansible would report the task to be ok (despite failed=True and msg=Some_error_message) although Ansible stops and the summary output reports a failed task. This fixes #4214, #4384 and also relates to ansible/ansible#12070, ansible/ansible#16006, ansible/ansible##16597, ansible/ansible#17208 and ansible/ansible#17252 (cherry picked from commit 20726b9)
can someone verify whether this is fixed by ansible/ansible-modules-core#4617 ? That change has been merged to devel and stable-2.2 and will be in 2.2.0 when released. needs_info |
The implementation is fairly simple, we force the rc= parameter to not be zero so that the check in _executor/task_result.py_ correctly determines that it failed. Without this change Ansible would report the task to be ok (despite failed=True and msg=Some_error_message) although Ansible stops and the summary output reports a failed task. This fixes ansible#4214, ansible#4384 and also relates to ansible/ansible#12070, ansible/ansible#16006, ansible/ansible##16597, ansible/ansible#17208 and ansible/ansible#17252
@kellenanker ping, this issue is still waiting on your feedback. We will close the issue if you do not respond. |
This appears to be fixed in |
Based on the above reply from @jszwedko and no further follow-ups, we'll go ahead and consider this fixed and close it now. If you continue seeing any problems related to this issue, or if you have any further questions, please let us know by stopping by one of the two mailing lists, as appropriate:
Because this project is very active, we're unlikely to see comments made on closed tickets, but the mailing list is a great way to ask questions, or post if you don't think this particular issue is resolved. Thank you! |
I'm not certain that it's fixed in 2.1.2.0. I think possibly the underlaying problem was fixed coincidentally when upgrading. I have this version:
I see this as the complete output:
When, normally, the output would be this:
However, my particular problem is related to my custom So, I know that this is actually my problem. But, we still get similar behavior as above. I have to keep digging what is different in this Update: I was debugging and forgot to take out my pretty print. So, the hosts file probably did not return actual JSON. So, I found my answer -- but there wasn't really good debugging to only see the
|
ISSUE TYPE
ANSIBLE VERSION
CONFIGURATION
Default; no changes
OS / ENVIRONMENT
CentOS 6.7
SUMMARY
I have a playbook, the logic behind which is simple: install some packages, then include other tasks that either configure said packages or start them up. See the example below for exact syntax.
Note that I have included the entire version details of each package, including the system architecture for which they are designed. In my experience, this hasn't generated any issues. However, in this case, when including the architecture (x86_64) after the version details, Ansible reports the following:
"msg": "No Package matching 'influxdb-0.13.0.x86_64' found available, installed or updated"
. However, runningyum search influxdb-0.13.0.x86_64 --showduplicates
shows that this package does indeed exist in the repository from which I am pulling. More specifically, one line of output from this command readsinfluxdb-0.13.0-1.x86_64 : Distributed time-series database.
. For completeness of this report, I will note that the repository is correctly referenced in /etc/yum.repos.d/.Not only does this bizarre message appear when it seemingly shouldn't, it also terminates the entire playbook. Following this step, Ansible immediately jumps to
NO MORE HOSTS LEFT
, bypassing (not skipping!) the remaining steps in the role. Nothing fails explicitly, but the play recap shows that there was one failure (failed=1).This issue is remedied when the architecture is removed from the version details. But again, I did not expect that being as specific as possible could lead to a bizarre bug that breaks my code!
STEPS TO REPRODUCE
EXPECTED RESULTS
Influxdb, Telegraf, and Kapacitor are already installed on the box I am deploying. As such, I expect this installation step to be skipped. However, I do NOT expect it to skip to the very end of the role!
ACTUAL RESULTS
The text was updated successfully, but these errors were encountered: