updated logic
diff --git a/tasks/main.yml b/tasks/main.yml index 187442c..79c8921 100644 --- a/tasks/main.yml +++ b/tasks/main.yml
@@ -5,33 +5,28 @@ msg: "Please provide java_home" when: java_home is not defined -- name: Remove old JAVA_HOME - lineinfile: - create: yes - dest: "{{ apigee_installation_home }}/etc/defaults.sh" - regexp: "{{ item }}" - state: absent - backup: yes - with_items: - - "^JAVA_HOME=" - - "^export JAVA_HOME" - - "^PATH=\\$JAVA_HOME/bin" +#- name: Remove old JAVA_HOME +# lineinfile: +# create: yes +# dest: "{{ apigee_installation_home }}/etc/defaults.sh" +# regexp: "{{ item }}" +# state: absent +# backup: yes +# with_items: +# - "^JAVA_HOME=" +# - "^export JAVA_HOME" +# - "^PATH=\\$JAVA_HOME/bin" -- name: Update environment with JAVA_HOME +- name: Update default.sh with JAVA_HOME lineinfile: create: yes dest: "{{ apigee_installation_home }}/etc/defaults.sh" regexp: "{{ item.regexp }}" line: '{{ item.line }}' backup: yes + state: present with_items: - { regexp: "^JAVA_HOME=", line: "JAVA_HOME={{ java_home }}" } - { regexp: "^PATH=\\$JAVA_HOME/bin:\\$PATH", line: "PATH=$JAVA_HOME/bin:$PATH"} - { regexp: "^export JAVA_HOME", line: "export JAVA_HOME"} - -- name: Update environment with path JAVA_HOME - lineinfile: - dest: "{{ apigee_installation_home }}/etc/defaults.sh" - line: 'PATH=$JAVA_HOME/bin:$PATH' - backup: yes