Is the current strategy visible to tasks?

Is a playbook’s current strategy exposed to tasks, perhaps through some unlisted special variable?

I’m running into ansible-lint’s admonition, “run-once[task]: Using run_once may behave differently if strategy is set to free.” I see no rational way around the issue except to “noqa” it away, but I’d like to implement some active defense in case someone ever tries to run with “strategy: free”, like maybe halting the play with a “Don’t do that!” message.

But if there’s no way for a task to see the current strategy, and the only way around the message is a “noqa”, I sort of have to wonder whether it’s actually accomplishing any good.

2 Likes

No. It is not. [sigh]
Here’s a pull request to remedy that.

Edit: I meant that “No. It is not” as a response to the initial question: Is a playbook’s current strategy exposed to tasks? Upon reading the two posts back-to-back though, it reads like a response to the first post’s closing statement: “I have to wonder whether [ansible-lint is] actually accomplishing any good.” This is not at all what I meant! ansible-lint is a wonderful tool which we use all the time. In fact, it’s precisely because we rely on it so much that even slight irritations with it affect us to exaggerated degrees. Much praise and thanks to everyone making ansible-lint so valuable.

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.