gantsign.sdkman_init
Ansible Role: SDKMAN Init
This Ansible role sets up SDKMAN, a tool for managing software development kits (SDKs). You can use this role to install specific SDKs and decide which versions to use by default.
Important: This role needs SDKMAN to be installed first. You can use the gantsign.sdkman role for that.
Requirements
- Ansible version 2.9 or higher
- A Linux Distribution:
- Debian Family (like Debian Stretch (9), Buster (10), Bullseye (11) and Ubuntu Bionic (18.04) and Focal (20.04))
- RedHat Family (like Rocky Linux 8 and Fedora 35)
- SUSE Family (like openSUSE 15.3)
(Note: Other versions might work but haven't been tested.)
Role Variables
You can change how this role works with these variables:
# Specify at least one user for SDKMAN
users:
- username: # User to set up SDKMAN for
sdkman_install:
- candidate: # Name of the SDK (e.g., java)
version: # Version of the SDK to install
path: # Optional. To add an existing SDK install to SDKMAN.
# The `version` for the existing SDK must be unique.
sdkman_default:
_candidate_sdk_name_here_: # Optional. Default version to use
Example Playbooks
Here's how to configure this role (without the SDKMAN installation role):
- hosts: servers
roles:
- role: gantsign.sdkman_init
users:
- username: example_username
sdkman_install:
- candidate: java
version: '8.0.181-zulu'
- candidate: java
version: '10'
path: '/opt/java/jdk-10.0.2'
- candidate: maven
version: '3.5.4'
sdkman_default:
java: '10'
maven: '3.5.4'
Here's a complete example that includes using the gantsign.sdkman
role to install SDKMAN. Notice how the gantsign.sdkman_init
role can be used multiple times for different SDKs.
- hosts: servers
roles:
- role: gantsign.sdkman
sdkman_users:
- example_username
- role: gantsign.sdkman_init
tags:
- java
users:
- username: example_username
sdkman_install:
- candidate: java
version: '8.0.181-zulu'
- candidate: java
version: '10'
path: '/opt/java/jdk-10.0.2'
sdkman_default:
java: '10'
- role: gantsign.sdkman_init
tags:
- java
- maven
users:
- username: example_username
sdkman_install:
- candidate: maven
version: '3.5.4'
sdkman_default:
maven: '3.5.4'
More Roles from GantSign
You can find additional roles from GantSign on Ansible Galaxy.
Development & Testing
This project uses Molecule for development and testing. Unit tests are done with Testinfra and pytest.
To develop or test, you'll need:
To make things easier, this project includes Molecule Wrapper. It's a script that installs Molecule and its dependencies (excluding Linux) and runs Molecule with your command.
To test this role, use the following command from the project root:
./moleculew test
(Note: Some dependencies may need sudo
permission to install.)
License
Apache 2
Author Information
John Freeman
GantSign Ltd.
Company No. 06109112 (registered in England)
Ansible role for initializing the SDKMAN software development kit manager.
ansible-galaxy install gantsign.sdkman_init