Skip to content
This repository was archived by the owner on Feb 20, 2020. It is now read-only.

Conversation

boukeversteegh
Copy link
Contributor

No description provided.

Copy link
Member

Choose a reason for hiding this comment

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

I'm still an ansible noob here, but wouldn't this NOT install unzip and which if java version is already 1.7 and above?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes @ketan, that's correct. @boukeversteegh, can you extract the java installation to a separate task to ensure the other basic dependencies are still installed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good one, i'm testing out a patch now, will post today or tomorrow


- name: yum install Java 1.7 and some basic dependencies
- name: Fetch Java version
shell: java -version 2>&1 | grep version | awk '{print $3}' | sed 's/"//g' | grep '^.\..' -o || echo 0.0
Copy link

@jonwolski jonwolski Oct 19, 2016

Choose a reason for hiding this comment

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

For what it is worth, grep version | awk '{print $3}' is the same as awk '/version/ {print $3}'. However, you don't need to combine awk, sed, and grep for this. You can simplify this to one grep to get the line, and one grep to extract a number from that line.

shell: java -version 2>&1 | grep version | grep -o '[0-9][0-9]*\.[0-9][0-9]*' || echo 0

Alternatively, if you're confident that the first line with a number has the number you want:

shell: java -version 2>&1 | grep -o -m1 '[0-9][0-9]*\.[0-9][0-9]*' || 0.0

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okay, cool, thanks for those tips. i'm no longer actively using this playbook, so i can't test it, but if you are confident of course feel free to adapt and merge.

@ghost
Copy link

ghost commented Feb 20, 2020

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants