nested with_fileglob and with_sequence

327 views
Skip to first unread message

RobL

unread,
Mar 10, 2014, 7:57:57 PM3/10/14
to ansible...@googlegroups.com
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

Michael DeHaan

unread,
Mar 10, 2014, 9:36:33 PM3/10/14
to ansible...@googlegroups.com
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!


--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/f64b292f-4557-4f56-9cd7-0f2bee432cff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

RobL

unread,
Mar 11, 2014, 11:57:06 AM3/11/14
to ansible...@googlegroups.com
For each file in /etc, it should create additional copies with .1, .2, .3, ..., .10 extensions.

Rob
Reply all
Reply to author
Forward
0 new messages