# nested with\_fileglob and with\_sequence

**URL:** <https://forum.ansible.com/t/nested-with-fileglob-and-with-sequence/14752>\
**Category:** Ansible Project\
**Created:** [March 10, 2014, 11:57pm UTC](https://forum.ansible.com/t/nested-with-fileglob-and-with-sequence/14752 "2014-03-10T23:57:57Z")\
**Posts on this page:** 3\
**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, 11:57pm UTC](https://forum.ansible.com/t/nested-with-fileglob-and-with-sequence/14752/1 "2014-03-10T23:57:57Z")

</div>

Hi:

I’m trying to act on the cartesian product of a fileglob and a sequence.

Is there a way to do this with with\_nested?

I tried this:

- cmd: cp {{ item[0] }} {{ item[0] }}.{{ item[1] }}  
with\_nested:
- with\_fileglob:
- /etc/\*
- with\_sequence: start=0 end=10

But this produced an error.

I thought about creating lists, but registering for the results of “ls -1 /etc/\*” and “seq 0 10”, then using these lists with with\_nested, but that seems hacky.

Any suggestions?

Thanks,

Rob

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [March 11, 2014, 1:36am UTC](https://forum.ansible.com/t/nested-with-fileglob-and-with-sequence/14752/2 "2014-03-11T01:36:33Z")

</div>

So “with\_fileglob” works locally.

The “sequence” idea would generate a range of 1-10, but I’m having a bit trouble modelling your end to end use case and may be able to suggest something better.

Can you explain what the above sytntax would do and return?

Thanks!

---

<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 11, 2014, 3:57pm UTC](https://forum.ansible.com/t/nested-with-fileglob-and-with-sequence/14752/3 "2014-03-11T15:57:06Z")

</div>

For each file in /etc, it should create additional copies with .1, .2, .3, …, .10 extensions.

Rob
