# with\_nested combined with with\_sequence and with\_fileglob ?

**URL:** <https://forum.ansible.com/t/with-nested-combined-with-with-sequence-and-with-fileglob/14748>\
**Category:** Ansible Project\
**Created:** [March 10, 2014, 9:37pm UTC](https://forum.ansible.com/t/with-nested-combined-with-with-sequence-and-with-fileglob/14748 "2014-03-10T21:37:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![RobL](https://avatars.discourse-cdn.com/v4/letter/r/e9a140/32.png) [@RobL](https://forum.ansible.com/u/RobL)\
**Post date:** [March 10, 2014, 9:37pm UTC](https://forum.ansible.com/t/with-nested-combined-with-with-sequence-and-with-fileglob/14748/1 "2014-03-10T21:37:05Z")

</div>

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
