xml
!xml
Category: files
Edit explicitly selected XML settings without reserializing unrelated configuration. Install prepared edits atomically through the execution-target connection.
Notes
- Set or remove is required. Selectors support literal ASCII element paths and namespace prefixes, not general XPath. Ambiguous or overlapping selectors fail. Scalar values preserve whole-variable template types; explicit children lists control repeated elements in order while preserving unrelated children. All operations are prepared before any write. Plan never stages or writes; unchanged apply never replaces or notifies. All DTDs and external entity resolution are disabled. See usage/xml-settings for creation, namespace, preservation, and optimistic concurrency details.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
path | path | yes | Absolute execution-target UTF-8 XML file path; destination symlinks are rejected. |
set | map | no | Literal absolute element selectors mapped to typed scalar values or explicit children mappings of element names to scalar lists. |
remove | list | no | Literal absolute selectors to remove; absent elements are unchanged. Null is not deletion. |
create | bool | no | Explicitly permit missing files, ancestors, selected elements, and additional repeated children. Default false. |
namespaces | map | no | Explicit prefix-to-URI bindings for selectors and newly created elements. Unprefixed names select no namespace. |
attributes | map | no | Explicit owner/group/mode overrides; existing ownership and permissions otherwise remain intact. |
Examples
- !xml
path: /etc/example/network.xml
create: true
set:
/NetworkConfiguration/EnableHttps: false
/NetworkConfiguration/KnownProxies:
children:
string: '{{ trusted_proxy_addresses }}'
and:
notify: restart application