Hi:
I’d like to do a nested loop over a sequence and a file glob. A simplified example of what I thought might work is:
- command: cp {{ item[1] }} {{ item[1] }}.{{ item[0] }}
with_nested: - with_sequence: start=0 end=10
- with_fileglob:
- /etc/*
However, this syntax doesn’t work. It reports:
failed: […] => (item=[‘with_sequence’, ‘with_fileglob’]) => {“changed”: true, “cmd”: [“cp”, “with_fileglob”, “/etc/”], “delta”: “0:00:00.017533”, “end”: “2014-03-10 21:32:51.381160”, “item”: [“with_sequence”, “with_fileglob”], “rc”: 1, “start”: “2014-03-10 21:32:51.363627”}
stderr: cp: cannot stat `with_fileglob’: No such file or directory
Is there a way to achieve what I want? I thought about replacing the with_fileglob with a register of “command: ls -1 /etc/*”, and with_sequence replaced by a register of seq. This seems hacky, though.
Thanks,
Rob