How to set JAVA_HOME in ansible playbook

Solved2.46K viewsAnsibleansible ansible-playbook java

How to set JAVA_HOME in ansible playbook

How to set JAVA_HOME in ansible playbook

Share:
vito Selected answer as best September 21, 2021
1

You can make use of lineinfile parameter in ansible. For example, the code will look like below,

- name: Set JAVA_HOME
  lineinfile:
    dest: /etc/environment
    state: present
    regexp: '^JAVA_HOME'
    line: 'JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk'

Share:
vito Selected answer as best September 21, 2021
1