Skip to content

Instantly share code, notes, and snippets.

Created January 9, 2018 16:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/5ee1534f1aad3a2c9feb946251817440 to your computer and use it in GitHub Desktop.
Save anonymous/5ee1534f1aad3a2c9feb946251817440 to your computer and use it in GitHub Desktop.
Set up alternatives to properly use openjdk
{% set openjdk_executable = "/usr/lib/jvm/jre-1." + environment.version + ".0-openjdk/bin/java" %}
java_executable_exists:
file.exists:
- name: {{ openjdk_executable}}
# old
java_alternatives_installed: # This reports as a state failure but actually succeeds per https://github.com/saltstack/salt/issues/38802
alternatives.install:
- name: java
- link: /usr/bin/java
- path: {{ openjdk_executable}}
- priority: 9000
- require:
- file: java_executable_exists
# new
java_alternatives_installed:
cmd.run:
- name: alternatives --install /usr/bin/java java {{ openjdk_executable }} 9000 # does this work?
- require:
- file: java_executable_exists
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment