On Tue, 27 Aug 2019 07:44:24 -0700 (PDT) Spiro Mitsialis <spiro.mitsia...@mcgill.ca> wrote:
> I have the following that is not working. > > vars: > cmdb: xkjsdflkjsjdl4d > cisco_ios: > interfaces: > gigabit1/0/1: > name: Gigabit1/0/1 > status: up > gigabit1/0/2: > name: Gigabit1/0/2 > status: down > [...] > I want to end up with > > cisco_ios: > interfaces: > gigabit1/0/1: > name: Gigabit1/0/1 > status: up > cmdbId: xxxxxx > gigabit1/0/2: > name: Gigabit1/0/2 > status: down > cmdbId: xxxxxx Is this probably what are you looking for? - set_fact: interfaces: "{{ interfaces|default({})| combine({item.key: item.value| combine({'cmdbId': cmdb})}) }}" loop: "{{ cisco_ios.interfaces|dict2items }}" - set_fact: cisco_ios: "{{ cisco_ios.interfaces|combine(interfaces) }}" Cheers, -vlado -- 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/20190827172342.22b64016%40gmail.com.
pgpYDDl1OhuYV.pgp
Description: OpenPGP digital signature