Look at the ansible filters documentation. They provide examples.

Walter
--
Walter Rowe, Division Chief
Infrastructure Services, OISM
Mobile: 202.355.4123

On Feb 1, 2023, at 8:56 AM, Dick Visser <dnmvis...@gmail.com> wrote:

Hi

I am looking for a way to transform a list of strings into a list of dicts, 
where the string is a certain key's value - without using a loop. So from this:

my_list:
  - foo
  - bar
  - baz

to:


other_list:
  - somekey: foo
  - somekey: bar
  - somekey: baz

It looks too simple but I can't see how to do this.....


--
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-project+unsubscr...@googlegroups.com<mailto:ansible-project+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAF8BbLbtQHJu8zzJLOdv27uC%2BtU_DNnxOOmMbRCGqdgNRaGSLA%40mail.gmail.com<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fansible-project%2FCAF8BbLbtQHJu8zzJLOdv27uC%252BtU_DNnxOOmMbRCGqdgNRaGSLA%2540mail.gmail.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=05%7C01%7Cwalter.rowe%40nist.gov%7Cc1f80bb37c08491089e708db045c1ff3%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C638108565950300346%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=QHcoXubGTg67QBCgXBcB6gzhXXmtepgpC9TcLW1xK6k%3D&reserved=0>.

-- 
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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/71BD0AB4-4BCC-4329-BC6A-02CCBA5F3374%40nist.gov.

Reply via email to