So with_items does loop over *lists* in order.

It looks like you have a hash/dictionary above - these do *not* preserve
order (because they seldom do, it is their nature...)



On Fri, Oct 3, 2014 at 1:52 PM, Guy Matz <[email protected]> wrote:

> Yeah, I can't use sort because I don't want them sorted, I just want them
> in the order they came in in the original data.  thanks, though!!
>
> On Fri, Oct 3, 2014 at 1:44 PM, Adam Heath <[email protected]> wrote:
>
>> Untested, but maybe this:
>>
>> ==
>> - shell: {{ base_dir }} {{ item }}
>>   with_items: deploy_env.keys() | sort
>> ==
>>
>> And then be sure to name your keys so they sort the way you need.
>>
>> On 10/03/2014 12:39 PM, Guy Matz wrote:
>>
>>> not sure what you mean . . .  my data comes from json that looks like
>>> this:
>>> deploy_env =
>>> {
>>>     "cmd_build": [
>>>         "gem install rake bundler",
>>>         "bundle install --deployment --without development test --path
>>> $BUNDLE_DIR"
>>>     ],
>>>     "cmd_release": [
>>>         "bundle exec rake deploy:release",
>>>         "bundle exec rake db:migrate"
>>>     ]
>>> }
>>>
>>> and I loop through the cmd_* hashes with my custom iterator like:
>>> - shell: {{ base_dir }}{{ item.key }}
>>>   with_12fcmds: deploy_env
>>>
>>> I need the cmd_build to come before cmd_release as defined in the json,
>>> bu it seems that somewhere along the line the json is getting turned into a
>>> dict and losing its order . . .
>>>
>>> On Fri, Oct 3, 2014 at 11:57 AM, Brian Coca <[email protected]
>>> <mailto:[email protected]>> wrote:
>>>
>>>     have you tried |sort?
>>>
>>>     --
>>>     Brian Coca
>>>     Stultorum infinitus est numerus
>>>     011000010111001001100101011011100010011101110100001000000111
>>> 100101101111011101010010000001110011011011010110000101110010
>>> 0111010000100001
>>>     Pedo mellon a minno
>>>
>>>     --
>>>     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 [email protected]
>>>     <mailto:ansible-project%[email protected]>.
>>>     To post to this group, send email to
>>>     [email protected]
>>>     <mailto:[email protected]>.
>>>     To view this discussion on the web visit
>>>     https://groups.google.com/d/msgid/ansible-project/CADn%2BHswakpYOn%
>>> 2BepvVKsTLYPCxzTpJzCH5bG_7phOYttNQrwyQ%40mail.gmail.com.
>>>     For more options, visit https://groups.google.com/d/optout.
>>>
>>>
>>> --
>>> 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 [email protected] <mailto:
>>> [email protected]>.
>>> To post to this group, send email to [email protected]
>>> <mailto:[email protected]>.
>>> To view this discussion on the web visit https://groups.google.com/d/
>>> msgid/ansible-project/CABnTgtU-zS6Hr9_WE6w09k%
>>> 3DtpgwPme1k6MwgaAWe4t2J7CugEQ%40mail.gmail.com <
>>> https://groups.google.com/d/msgid/ansible-project/
>>> CABnTgtU-zS6Hr9_WE6w09k%3DtpgwPme1k6MwgaAWe4t2J7CugEQ%
>>> 40mail.gmail.com?utm_medium=email&utm_source=footer>.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
>> 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 [email protected].
>> To post to this group, send email to [email protected].
>> To view this discussion on the web visit https://groups.google.com/d/
>> msgid/ansible-project/542EE087.70904%40brainfood.com.
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> 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 [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CABnTgtXXsdqvVFaUu4ZfOQn-Rmp6M2%2BhMoAzy5bmsoc%2Bnnq_wA%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CABnTgtXXsdqvVFaUu4ZfOQn-Rmp6M2%2BhMoAzy5bmsoc%2Bnnq_wA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgy%3DUymbVKO%2Bscje2C8GJBrV8FySyK-ncq0q4KgwFgdjdw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to