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

Add a way to force handler execution #4777

Closed
mpdehaan opened this issue Nov 1, 2013 · 6 comments
Closed

Add a way to force handler execution #4777

mpdehaan opened this issue Nov 1, 2013 · 6 comments
Labels
feature This issue/PR relates to a feature request. P1 Priority 1 - Immediate Attention Required; Release Immediately After Fixed

Comments

@mpdehaan
Copy link
Contributor

mpdehaan commented Nov 1, 2013

If a playbook fails not all handlers may be run.

In this case it would be nice to have a --force-handlers that runs all handlers on a retry.

The line that prints the retry command should also indicate that this flag should be used.

@alanfairless
Copy link

Conceptually related to #4443.

@kustodian
Copy link
Contributor

This would be the number one feature I would vote at this moment. It would also be nice if this flag could be configured as an option in ansible.cfg if you want it to be enabled all the time (it can be off by default).

Would this flag also mean that the handlers would be executed if the playbook fails the first time, or only on retry? I don't see why it shouldn't be possible to run handlers even if the playbook fails the first time.

@mpdehaan
Copy link
Contributor Author

This will not be a ansible.cfg setting because we don't want it to run all the time, this would defeat the point of "notify" only running things on change.

In those cases, just make something a task.

Anyway, look for this to come very soon.

The retry command will suggest adding --force-handlers, and --force-handlers is also a CLI switch you can select. Nothing will be adding this flag automatically.

@jctanner
Copy link
Contributor

@alanfairless and @kustodian this is now implemented via the "--force-handlers" parameter in ansible-playbook.

@voidzero
Copy link

I would like a --skip-handlers, for provisioning reasons (My handlers, for example, reload services. Sometimes those services are not running yet.)

@kustodian
Copy link
Contributor

If you need to use --skip-handlers, than you are probably not using handlers the right way. Handlers are run at the end of the play, so just make sure to start the service before it reaches the end and you shouldn't have any problems.

Also handlers support when: condition, so you could set a condition for those cases when the service is still not running, even though I wouldn't recommend this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature This issue/PR relates to a feature request. P1 Priority 1 - Immediate Attention Required; Release Immediately After Fixed
Projects
None yet
Development

No branches or pull requests

6 participants