I am trying to create a task in Ansible which makes my GraalVM Java JDK as the default installation. I do the following:
- name: Make GraalVM Java as the selected version
community.general.alternatives:
name: java
path: '{{ graalvm_home }}/bin/java'
Unfortunately I get the following permission error. In the community.general.alternatives I did not see any option on running the command as sudo (the device I am doing my operations is running on Linux 18). How can I remove this permission error ?
Make GraalVM Java as the selected version] ***
fatal: [default]: FAILED! => {"changed": false, "cmd": "/usr/bin/update-alternatives --install /usr/bin/java java /opt/graalvm/graalvm-22.1.0-java17/bin/java 50", "msg": "update-alternatives:
error: unable to create file '/var/lib/dpkg/alternatives/java.dpkg-tmp': Permission denied", "rc": 2, "stderr": "update-alternatives:
error: unable to create file '/var/lib/dpkg/alternatives/java.dpkg-tmp': Permission denied\n", "stderr_lines": ["update-alternatives:
error: unable to create file '/var/lib/dpkg/alternatives/java.dpkg-tmp': Permission denied"], "stdout": "", "stdout_lines": []}