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

Getting around Ansible order of ops for when/with_items (hopefully) #65

Closed
wants to merge 1 commit into from

Conversation

clwells
Copy link
Contributor

@clwells clwells commented Dec 7, 2016

If haproxy_global[frontends, backends, etc] aren't defined then 'when' portion won't catch this case before with_items tries to eval the var so you'll get:

TASK [ansible-haproxy : Build up the frontends] ********************************
fatal: [ifx-lb01]: FAILED! => {"failed": true, "msg": "'haproxy_frontends' is undefined"}

Even though the module is defined to avoid this. Providing a default empty array gets around this (and probably makes the 'when' unneeded).

@benwebber benwebber closed this in 86a7d82 Dec 8, 2016
@benwebber
Copy link
Collaborator

benwebber commented Dec 8, 2016

Good catch. Ansible indeed evaluates with_items before when.

It's a bit tidier to keep the defaults in defaults/main.yml, which I've done in 86a7d82.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants