Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,37 @@
- name: Download the Java distribution
get_url:
url: "https://download.java.net/openjdk/jdk9/ri/jdk-9+181_windows-x64_ri.zip"
dest: /home/splunk/
dest: /opt/container_artifact/
timeout: 30
mode: 0666
register: download_result
until: download_result.status_code == 200
retries: "{{ retry_num }}"
delay: "{{ retry_delay }}"

- name: Unzip the Java distribution
unarchive:
src: "/home/splunk/jdk-9+181_windows-x64_ri.zip"
dest: /home/splunk/
src: "/opt/container_artifact/jdk-9+181_windows-x64_ri.zip"
dest: /opt/container_artifact/

- name: Write vars into .bash_profile
lineinfile:
path: /home/splunk/.bash_profile
line: "JAVA_HOME=/home/splunk/java-se-9-ri/jdk-9/"
create: yes
no_log: "{{ hide_password }}"
- name: Create symlinks for java/javac
file:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
state: link
with_items:
- { "src": "/opt/container_artifact/java-se-9-ri/jdk-9/bin/java.exe", "dest": "/usr/bin/java"}
- { "src": "/opt/container_artifact/java-se-9-ri/jdk-9/bin/javac.exe", "dest": "/usr/bin/javac"}
become: yes
become_user: root
ignore_errors: true

- name: Write path into .bash_profile
# TODO: will run into issues as it breaks Windows icacls permissions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we have a plan to address this issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I plan to address this part along with https://splunk.atlassian.net/browse/INFRA-43925, whoever takes that ticket, I can just copy the solution. Let me comment out this part for now

Did some quick search on it though, cygwin breaking windows file permissions seems to be a common issue. The ansible equivalent module for lineinfile is win_lineinfile , I gave it a try but got some errors, it's expecting to be executed in a Powershell environment (not cygwin). We might need to go as far as creating a powershell script, read icacls permissions, update the file, rewrite back the icacls permissions...

- name: Set JAVA_HOME in splunk-launch.conf
become: yes
become_user: "{{ privileged_user }}"
lineinfile:
path: /home/splunk/.bash_profile
line: "PATH=$PATH:$JAVA_HOME/bin"
path: "{{ splunk.home }}/etc/splunk-launch.conf"
regexp: '^JAVA_HOME'
line: "JAVA_HOME=/opt/container_artifact/java-se-9-ri/jdk-9"
owner: "SYSTEM"
group: "SYSTEM"
create: yes
no_log: "{{ hide_password }}"