Skip to content

0.8 -- make it possible to use with_items with the new $PIPE(cmd) syntax #983

mpdehaan opened this Issue Aug 31, 2012 · 7 comments

3 participants


It would be nice to iterate over local files.

This seems to be done best with a with_items like construct.


with_items_from_filesystem: /path/*.foo

and maybe

with_items_from_filesystem_recursive: /path/*.foo

syntax TBD

@mpdehaan mpdehaan was assigned Aug 31, 2012

better: with_items_from_cmd: find . -name *.txt

jpmens commented Aug 31, 2012

with_items_from_pipe ? :)


probably better than arbitrarily dropping vowels :)

tima commented Sep 6, 2012

Why not just with_items_from?

I could see the need to have both files and commands/pipes. Try and execute the value. If that fails try and read it as a file.


new things available already are

$FILE($var) -- returns the contents of the file inline
$PIPE($cmd) -- runs a command -- may need some work

We can't use $PIPE(cmd) with with_items too well yet... I think what we want to do is detect that $PIPE is used in the with_items clause and if so, and if the stdout of the command includes a newline, convert the command results into a list.


I'm going to solve this a little differently and bring pluggable data sources forward a bit, and allow

with_items_glob: foo

where with_items_foo will look for a data module of type foo. Stay tuned, doing this now for 0.8.

$PIPE and $FILE will prob stay around for template usage, though this will be cleaner/easier.


called it with_fileglob instead, see examples/playbooks/loop_plugins.yml

@mpdehaan mpdehaan closed this Oct 13, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.