Hi,

you can have a list of dicts:

patches:
- name: patch1
  patch_name:
  patch_md5:
  engine:
  Services:
- name: patch2
  patch_name:
  patch_md5:
  engine:
  Services:

Then instead of item.key and item.value.xxx, use item.name and item.xxx
when using "with_items: {{patches}}".

Cheers,
Felix



On Mon, 12 Dec 2016 22:27:54 -0800 (PST)
Deepa Yr <[email protected]> wrote:

> Thanks. I have many more fields defined for patch other than
> patch_name. In that case, it would be difficult to use with_items
> right.. or Is there a solution with list and with_items ?
> patches:
>     patch1:
>         patch_name:
>         patch_md5:
>         engine:
>         Services:
>    patch2:
>         patch_name:
>         patch_md5:
>         engine:
>         services:
>    patch3:
>         patch_name:
>         patch_md5:
>         engine:
>         services:
> 
> 
> 
> On Tuesday, December 13, 2016 at 12:28:51 AM UTC+5:30, Anand Buddhdev
> wrote:
> >
> > Hello Deepa,
> >
> > Dictionaries are *not* ordered collections. You should never rely
> > on items in a dictionary to be returned in order. You'd be better
> > off using a list.
> >
> > patches:
> > - patchdata1
> > - patchdata2
> >
> > A list preserves order.
> >
> > On Monday, 12 December 2016 15:37:22 UTC+1, Deepa Yr wrote:  
> >>
> >> Hi
> >>
> >>           I have a dict where I need to install patches in the
> >> order
> >>
> >> patches:
> >>     patch1:
> >>         patch_name:
> >>    patch2:
> >>         patch_name:
> >>    patch3:
> >>         patch_name:
> >>   and so on
> >>    patch8:
> >>         patch_name:
> >>
> >>
> >> - name: install patches
> >>   include: install_patch.yml
> >>   with_dict: {{patches}}
> >>
> >> When I run above playbook, the order is not as I have defined. It
> >> is taking patch8,patch1,patch2.. patch7.
> >>
> >> Can you please suggest how I can run in the order.
> >>
> >> Thanks
> >> Deepa
> >>  
> >  
> 


-- 
Felix Fontein -- [email protected] -- https://felix.fontein.de/

-- 
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/20161213073655.35e70415%40fontein.de.
For more options, visit https://groups.google.com/d/optout.

Reply via email to