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

alternatives module should be able to use "command" to set the alternative #5060

Closed
1 task done
pglizniewicz opened this issue Aug 3, 2022 · 5 comments · Fixed by #9096
Closed
1 task done

alternatives module should be able to use "command" to set the alternative #5060

pglizniewicz opened this issue Aug 3, 2022 · 5 comments · Fixed by #9096
Labels
feature This issue/PR relates to a feature request module module plugins plugin (any type) system

Comments

@pglizniewicz
Copy link

Summary

The alternatives module's behavior should match what the alternatives command does.

Given:

$ sudo alternatives --config java

There are 2 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
   1           java-17-openjdk.x86_64 (/usr/lib/jvm/java-17-openjdk-17.0.3.0.7-1.el9_0.x86_64/bin/java)
*+ 2           java-11-openjdk.x86_64 (/usr/lib/jvm/java-11-openjdk-11.0.16.0.8-1.el9_0.x86_64/bin/java)

when I try to set an alternative for java to a specific command:

- name: configure default JDK
  become: true
  community.general.alternatives:
    name: java
    path: java-17-openjdk.x86_64

It will result in an error: Specified path java-17-openjdk.x86_64 does not exist

Running alternatives from the command line like sudo alternatives --set java java-17-openjdk.x86_64 works and sets the expected alternative

Issue Type

Feature Idea

Component Name

alternatives

Additional Information

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibullbot
Copy link
Collaborator

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibullbot
Copy link
Collaborator

cc @mulby
click here for bot help

@ansibullbot ansibullbot added feature This issue/PR relates to a feature request module module plugins plugin (any type) system labels Aug 3, 2022
@ansibullbot
Copy link
Collaborator

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@kirk444
Copy link

kirk444 commented Jun 21, 2023

I'd like to add my support for this issue. In the case of something like the rolling "java-latest-openjdk" package it's somewhat of a necessity:

# update-alternatives --config java

There are 2 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
*+ 1           java-1.8.0-openjdk.x86_64 (/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.372.b07-4.0.1.el8.x86_64/jre/bin/java)
   2           java-latest-openjdk.x86_64 (/usr/lib/jvm/java-20-openjdk-20.0.1.0.9-8.rolling.el8.x86_64/bin/java)

@whitehat237
Copy link

+1. I would like this functionality as well. Any status updates on this? I'd rather not resort to use of the command or shell module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This issue/PR relates to a feature request module module plugins plugin (any type) system
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants