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

UnixPB: Ansible request for JDK install role #2705

Open
sxa opened this issue Aug 23, 2022 · 8 comments
Open

UnixPB: Ansible request for JDK install role #2705

sxa opened this issue Aug 23, 2022 · 8 comments

Comments

@sxa
Copy link
Member

sxa commented Aug 23, 2022

Please put the name of the software product (and affected platforms if relevant) in the title of this issue

Delete as appropriate from this list:

  • Bug in ansible playbook

Details:
If there are multiple matches in /usr/lib/jvm then ansible fails to create the appropriate symbolic link e.g.

root@test-marist-ubuntu1804-s390x-3:/usr/lib/jvm# ls -ld /usr/lib/jvm/jdk-11*
drwxr-xr-x 9 root root 4096 Aug 16 07:53 /usr/lib/jvm/jdk-11.0.16.1+1
drwxr-xr-x 9 root root 4096 Jul 19 20:30 /usr/lib/jvm/jdk-11.0.16+8
drwxr-xr-x 9 root root 4096 Jul 15  2020 /usr/lib/jvm/jdk-11.0.8+10

Results in fatal: [test-marist-ubuntu1804-s390x-3]: FAILED! => {"changed": false, "msg": "src file does not exist, use \"force=yes\" if you really want to create the link: /usr/lib/jvm/jdk-11.0.16.1+1\n/usr/lib/jvm/jdk-11.0.16+8\n/usr/lib/jvm/jdk-11.0.8+10", "path": "/usr/lib/jvm/jdk-11", "src": "/usr/lib/jvm/jdk-11.0.16.1+1\n/usr/lib/jvm/jdk-11.0.16+8\n/usr/lib/jvm/jdk-11.0.8+10"}

@Haroon-Khel
Copy link
Contributor

related #2624

@lumuchris256
Copy link
Contributor

hi @Haroon-Khel @smlambert i would like to take up this issue

@Haroon-Khel
Copy link
Contributor

Hi @lumuchris256 I have assigned it to you

@lumuchris256
Copy link
Contributor

lumuchris256 commented Oct 11, 2022

@Haroon-Khel according to issue #2624 , what is the expected outcome of the issue?

@Haroon-Khel
Copy link
Contributor

Conversation continued in slack

@Haroon-Khel
Copy link
Contributor

At

(between the two tasks) there should be a task which checks for a jdk without a symlink (perhaps the task can search for {{ path }}.*) and removes it if present then installs the jdk completely

Another solution would be to check if a non symlinked jdk exists and then tries to symlink it, but this might get long. And it would be better to install a newer jdk anyway

@Haroon-Khel
Copy link
Contributor

So something along the lines of

- name: Check if jdk-{{ jdk_version }} binary is present but not symlinked
  shell: ls -ld {{ path }}.* >/dev/null 2>&1
  failed_when: false
  register: adoptopenjdk_installed_not_symlinked
  changed_when: false
  when: adoptopenjdk_installed.rc != 0
  tags:
    - adoptopenjdk_install
    - skip_ansible_lint

- name: Remove non symlinked jdk-{{ jdk_version }} binary
   file:
       path: {{ path }}.*
       state: absent
    when: 
         - adoptopenjdk_installed_not_symlinked.rc == 0
         - adoptopenjdk_installed.rc != 0
  tags:
    - adoptopenjdk_install
    - skip_ansible_lint

It should only remove the non linked binary if it doesnt detect a symlink. If it does detect a symlink then this task should not run (it will delete the binary that is linked which we dont want)

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

No branches or pull requests

3 participants