Ansible Module xml: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
Line 15: Line 15:
     attribute: "value"
     attribute: "value"
     value: "{{build.jvm.heap_max}}"
     value: "{{build.jvm.heap_max}}"
</syntaxhighlight>
<syntaxhighlight lang='yaml'>
- name: Set Eclipse as default compiler
  xml:
    path: "{{idea_path}}/.idea/compiler.xml"
    xpath: /project/component[@name='CompilerConfiguration']/option[@name='DEFAULT_COMPILER']
    attribute: "value"
    value: "Eclipse"
</syntaxhighlight>
</syntaxhighlight>

Revision as of 20:52, 4 July 2021

External

Internal

Overview

The plugin is named community.general.xml and it offers functionality aimed at interacting with XML files, using XPath.

Example

- name: Bump Java build heap size to {{build.jvm.heap_max}} MB
  xml:
    path: "{{ansible_env.PROJECT_ROOT}}/.idea/compiler.xml"
    xpath: /project/component[@name='CompilerConfiguration']/option[@name='BUILD_PROCESS_HEAP_SIZE']
    attribute: "value"
    value: "{{build.jvm.heap_max}}"
- name: Set Eclipse as default compiler
  xml:
    path: "{{idea_path}}/.idea/compiler.xml"
    xpath: /project/component[@name='CompilerConfiguration']/option[@name='DEFAULT_COMPILER']
    attribute: "value"
    value: "Eclipse"