hachyderm.io is one of the many independent Mastodon servers you can use to participate in the fediverse.
Hachyderm is a safe space, LGBTQIA+ and BLM, primarily comprised of tech industry professionals world wide. Note that many non-user account types have restrictions - please see our About page.

Administered by:

Server stats:

9.9K
active users

Days since the fact that Ansible runs handlers at the end of the play and not at the end of the role that triggered them broke shit for me: 0️⃣

@zhenech I don't get why the handler aren't forced by #Ansible at the end of the Role, logically that makes sense because the concept "encapsulated tasks in a Role" ends at the end of the Role.

And I have "meta: flush_handlers" at the end of every role ...

@badnetmask @zhenech You know, documented != useful.

When I create a role, the intention is to wrap a certain piece of action/state in this role. Once the role execution is finished, there's nothing which prevents #Ansible from running all notified handlers.

I get the argument about not running handlers multiple time, the counter argument is that a role which is executed later might find a situation where the service is not yet in the desired state.

Mauricio Teixeira 🇧🇷🇺🇲

@ascherbaum @zhenech
I personally prefer that I can choose when to run in the middle of a play, rather than not having that kind of control. But yeah, it's a matter of opinion at this point.

@badnetmask @zhenech You can control/force the "when" by using "meta: flush_handlers". Otherwise you don't really have any control, it runs at the end. That's it. Which is a problem when a later role or Play fails and no handler is run.

@ascherbaum @badnetmask
In my particular case it was:
- role from galaxy sets a service up (and schedules a restart of the service)
- my own role uses that happily
- service gets uselessly restarted by handler

Wouldn't have happened if
- you could cancel a handler (github.com/ansible/proposals/i) as a service start is sufficient to "reload" config
- handlers would run at the end of the role

And yes, I can sprinkle "flush_handlers" everywhere (at the start and end of my role!)…

GitHubSupport cancellation of pending handlers · Issue #105 · ansible/proposalsBy flowerysong