On Fri, 25 Aug 2023 06:19:39 -0700 (PDT)
jean-christophe manciot <
actionm...@gmail.com> wrote:
> We need to remove the item ''4444444444 from the list <nic_ids> located
> inside the dictionary matched by the key/value net_id=='1'.
Put the items you want to update into a dictionary. For example,
diff:
'1': [4444444444]
Use Jinja to update the list
update: |
{% filter from_yaml %}
{% for i in vpc.provider %}
{% if i.net_id in diff %}
{% set nic_ids=i.nic_ids|difference(diff[i.net_id]) %}
- {{ i|combine({'nic_ids': nic_ids}) }}
{% else %}
- {{ i }}
{% endif %}
{% endfor %}
{% endfilter %}
Then, create the dictionary
new_vpc:
provider: "{{ update }}"
--
Vladimir Botka