xml

Collection: community.general

Full Name: parallax.community.general.xml

Aliases: community.general.xml, xml

Synopsis

Read and modify XML documents with XPath expressions

Parameters

NameTypeRequiredDefaultDescription
pathstringyesPath to the XML file to manage
xpathstringyesXPath expression to select elements
valuestringThe value to set for the selected element
attributestringThe attribute to set on the selected element
statestringpresentWhether the element should be present or absent Choices: present, absent
contentstringtextType of content to set: text or attribute Choices: text, attribute
namespacesstringNamespace mappings as comma-separated prefix=uri pairs
pretty_printbooltruePretty print the XML output
backupboolfalseCreate a backup file before modifying

Example

- name: Set the context path in the Tomcat config
  xml:
    path: /etc/tomcat/server.xml
    xpath: /Server/Service/Engine/Host/Context
    attribute: path
    value: /app
    state: present