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
run_once in a role combined with when in a playbook is erratic #13226
Comments
To ensure that it runs on a valid host, you could use 'delegate_to` |
Well, I get "what it does" to achieve what it promises, but for me it seems that the solution is not working. From a role's point of view I can not know from what kind of playbook I am run. I can certainly not use |
what you are asking is for a 'run_once_successfully' which is not a current feature. |
@nneubauer Greetings! Thanks for taking the time to open this issue. In order for the community to handle your issue effectively, we need a bit more information. Here are the items we could not find in your description:
Please set the description of this issue with this template: |
@nneubauer You have not responded to information requests in this issue so we will assume it no longer affects you. If you are still interested in this, please create a new issue with the requested information. |
this issue affects me too. |
For anyone finding this from google, here's one that's still open for this ticket. #23594 |
I solve this by putting the 'when' before the 'run_once' |
This does not work. |
Issue Type: Bug Report
Ansible Version: 1.9.3
Ansible Configuration: Nothing special
Environment: Mac OS X 10.11
Summary:
A playbook that does apply a role under certain circumstances (using
when
) is created. Within the role a task is tagged withrun_once
. Now, it seems that run_once just selects the first host that was matched from the playbook. If that host however actually fails thewhen
validation from the roles definition. The task is never run (skipped).Steps To Reproduce:
Basically look at the above example. Make sure your
hosts:
definition matches at least two hosts and your when definition matches only a subset.Expected Results:
I expect the task in the playbook to
run_once
on one of the hosts that actually are covered by thewhen
statement from the playbook.Actual Results:
Sometimes (depending on the order of your matched hosts), the task is not run at all but marked as skipped for one host that
when
does not match on.The text was updated successfully, but these errors were encountered: