I have multiple item elements like the following one inside a /path/to/content/ element:
<item>
<label>SOME_TEXT</label>
<other_elements/>
</item>
Using ansible's community.general.xml module as follows allows me to remove all existing item elements:
- name: "Remove all items"
become: true
community.general.xml:
path: "{{ path_to_my_xml_file }}"
xpath: /path/to/content/*
pretty_print: yes
state: absent
How can I use the community.general.xml module of ansible to only remove an item who's label's value (i.e. SOME_TEXT) matches a string label_of_item_to_remove ?
If it's not possible with community.general.xml what other module could be used to achieve this ?