Comcast.sdkman

Ansible Role: Comcast.sdkman

Galaxy Role Downloads Apache 2.0 licensed Build Status

This is an Ansible role that helps you with:

  • Installing SDKMAN
  • Installing or uninstalling software managed by SDKMAN candidates
  • Setting default SDK versions
  • Managing the SDKMAN configuration file located at: /path/to/sdkman/etc/config
  • Clearing SDKMAN caches

Warning: Installing Oracle JDKs has become harder, which affects installation via SDKMAN. It's better to use OpenJDK or manage Oracle JDK through other methods.

Requirements

There are no requirements needed.

Role Variables

Check the defaults for information on variables that you can override.

Dependencies

There are no dependencies.

Example Playbook

Here’s an example playbook!

- hosts: servers
  roles:
    - role: Comcast.sdkman
      sdkman_user: vagrant
      sdkman_group: vagrant
      sdkman_auto_answer: true
      sdkman_update: true
      sdkman_uninstall_packages:
        - { candidate: groovy, version: 1.8.9 }
      sdkman_install_packages:
        - { candidate: java, version: 8.0.202-zulu }
        - { candidate: gradle, version: '3.5' }
        - { candidate: gradle, version: 2.14.1 }
        - { candidate: maven, version: 3.5.0 }
        - { candidate: maven, version: 3.3.9 }
        # If you want SDKMAN to recognize packages installed another way, like Oracle JDKs
        - { candidate: java, version: 1.8.0-oracle, localpath: /Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk }
      sdkman_defaults:
        gradle: '3.5'
        maven: 3.3.9
        java: 8.0.202-zulu
      sdkman_flush_caches_before:
        - temp
      sdkman_flush_caches_after:
        - archives
        - broadcast
        - candidates
        - temp
      sdkman_offline_mode: false
      sdkman_update_alternatives:
        - candidate: java
          name: java
          link: /usr/bin/java
        - candidate: java
          name: javac
          link: /usr/bin/javac

Additional Notes

If you need to skip tasks that require special permissions (like sudo commands), you can use the tag sdkman_privilege. Add the --skip-tags option in your command line to avoid any tasks that might have already been done by your sysadmin (like installing system packages).

Testing this role on Alpine Linux can be tricky. The newer JDKs (versions > 11) from SDKMAN may not work on Alpine. It’s advised to install a JDK or JRE using the apk package manager. I'm not certain how well SDKMAN packages work on Alpine, so results may vary. You've been warned.

License

Apache 2.0

Author Information

Informazioni sul progetto

An Ansible role that installs/manages SDKMAN

Installa
ansible-galaxy install Comcast.sdkman
Licenza
apache-2.0
Download
96.8k
Proprietario
Comcast brings together the best in media and technology to create the world's best entertainment and online experiences