Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add java role #59

Merged
merged 19 commits into from
Mar 14, 2024
Merged

Add java role #59

merged 19 commits into from
Mar 14, 2024

Conversation

drmatthews
Copy link
Contributor

@drmatthews drmatthews commented Jan 16, 2024

Adds a role to install java. The functionality is included in the mirsg.infrastructure.tomcat role but is needed as a standalone as a prerequisite to installing OMERO.

  • also added molecule test for the role, and a workflow for running the tests

@drmatthews drmatthews self-assigned this Feb 10, 2024
@p-j-smith p-j-smith marked this pull request as ready for review March 13, 2024 16:23
@@ -0,0 +1 @@
---
Copy link
Contributor

Choose a reason for hiding this comment

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

this empty file is required otherwise molecule complains that the inventory doesn't exist

Comment on lines +7 to +9
cmd: |
set -o pipefail
java -version 2>&1 | grep version | awk '{print $3}' | sed 's/"//g'
Copy link
Contributor

Choose a reason for hiding this comment

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

the output from java -version is:

openjdk version "1.8.0_402"
OpenJDK Runtime Environment (build 1.8.0_402-b06)
OpenJDK 64-Bit Server VM (build 25.402-b06, mixed mode)

The output from the command on line 9 is:

1.8.0_402

- name: Check the java version is correct
ansible.builtin.assert:
that:
- java_version.stdout | split("_") | first is version('1.8.0')
Copy link
Contributor

Choose a reason for hiding this comment

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

remove the _402 from 1.8.0_402 (as we only specify that 1.8.0 should be installed, not 1.8.0_402)


- name: Get info for java package directory
ansible.builtin.stat:
path: "/usr/lib/jvm/{{ java_package }}"
Copy link
Contributor

Choose a reason for hiding this comment

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

/usr/lib/jvm/{{ java_package }} is a symlink. We need to use the full path to the target when selecting the version to use with alternatives

@p-j-smith p-j-smith requested a review from a team March 13, 2024 16:34
Comment on lines 11 to 14
- name: Install latest version of Java
ansible.builtin.package:
name: java-21-openjdk-devel
state: present
Copy link
Contributor

Choose a reason for hiding this comment

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

install Java 21 here so that after running the role (which install Java 8) we can test whether Java 8 has been set as the default version instead of 21

Copy link
Contributor

Choose a reason for hiding this comment

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

install Java 11 instead of 21 as 21 doesn't seem to be available on CentOS 7

@p-j-smith p-j-smith self-requested a review March 14, 2024 10:20
@p-j-smith p-j-smith merged commit 932caf8 into main Mar 14, 2024
3 checks passed
@p-j-smith p-j-smith deleted the drmatthews-add-java-role branch March 14, 2024 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants