As far as I can tell, it's currently impossible to loop over two sets of values in any fashion.
AHA! YOU HAVE FALLEN INTO MY TRAP!!!!111
If you mean that with_items and first_available_file don't work together, this is true, because they both use the variable $item.
This should probably have raised an error message or something, I didn't expect anyone to want to do it, though perfectly fine that you have tried.
(Sidenote, first_available_file is not a loop per se -- it selects the first file that exists on the local system, and passes that in for $item)
For each user I'm creating in a play, I'd like to install customizations to the user's remote environment or fallback to a default. The way I've done this is by allowing a user to provide a file named as his or her username is a particular directory in source control. Essentialy:
- name: install customizations
action: copy src=$available_file dest=/home/$item/custom
with_items: $users
first_available_file:
- res/users/$item
- res/users/default
Obviously, with this use case and probably most any other one one could work around the issue outside of ansible -- and perhaps this goes too far in compromising the simplicity of the play syntax.
The variable used by $first_available_file could be changed to be "$file", perhaps.
Though this change would be incompatible with past play books, it wouldn't be catastrophic.
I would like to keep things simple enough where I don't have to say:
with_items_as_foo: $splat
first_available_file_as_bar: $glorp
It's hideous to explain and hard to read, so I think multiple "with_items" loops are probably not going to happen.
Patches to change the "first_available_file" variable to "file", with updated tests, would definitely be accepted. We'd just have to make clear note of it in the release notes.