Ansible Module lineinfile: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 19: Line 19:
     line: "JAVA_VERSION={{ jdk.version }}"
     line: "JAVA_VERSION={{ jdk.version }}"
</syntaxhighlight>
</syntaxhighlight>
=Use Cases=
====Append Lines to a Text File in a Loop===

Revision as of 04:21, 5 July 2021

External

Internal

Overview

The module can be used to read and write lines from text files.

Example

- name: "Adjust Java version to {{ jdk.version }}"
  lineinfile:
    path: "{{ settings_path }}/settings.conf"
    regexp: '^JAVA_VERSION='
    line: "JAVA_VERSION={{ jdk.version }}"

Use Cases

=Append Lines to a Text File in a Loop