Parameter |
Choices/Defaults |
Comments |
add_children
|
|
Add additional child-element(s) to a selected element for a given xpath .
Child elements must be given in a list and each item may be either a string (eg. children=ansible to add an empty <ansible/> child element), or a hash where the key is an element name and the value is the element value.
This parameter requires xpath to be set.
|
attribute
|
|
The attribute to select when using parameter value .
This is a string, not prepended with @ .
|
backup
bool |
|
Create a backup file including the timestamp information so you can get the original file back if you somehow clobbered it incorrectly.
|
content
|
|
Search for a given xpath and get content.
This parameter requires xpath to be set.
|
count
bool |
|
Search for a given xpath and provide the count of any matches.
This parameter requires xpath to be set.
|
input_type
|
|
Type of input for add_children and set_children .
|
namespaces
|
|
The namespace prefix:uri mapping for the XPath expression.
Needs to be a dict , not a list of items.
|
path
required |
|
Path to the file to operate on. File must exist ahead of time.
This parameter is required, unless xmlstring is given.
aliases: dest, file
|
pretty_print
bool |
|
Pretty print XML output.
|
print_match
bool |
|
Search for a given xpath and print out any matches.
This parameter requires xpath to be set.
|
set_children
|
|
Set the child-element(s) of a selected element for a given xpath .
Removes any existing children.
Child elements must be specified as in add_children .
This parameter requires xpath to be set.
|
state
|
Choices:
- absent
present ←
|
Set or remove an xpath selection (node(s), attribute(s)).
aliases: ensure
|
strip_cdata_tags
bool
(added in 2.7) |
|
Remove CDATA tags surrounding text values.
Note that this might break your XML file if text values contain characters that could be interpreted as XML.
|
value
|
|
Desired state of the selected attribute.
Either a string, or to unset a value, the Python None keyword (YAML Equivalent, null ).
Elements default to no value (but present).
Attributes default to an empty string.
|
xmlstring
required |
|
A string containing XML on which to operate.
This parameter is required, unless path is given.
|
xpath
|
|
A valid XPath expression describing the item(s) you want to manipulate.
Operates on the document root, / , by default.
|