项目作者: gantsign

项目描述 :
Ansible role for initializing SDKMAN
高级语言: Shell
项目地址: git://github.com/gantsign/ansible_role_sdkman_init.git
创建时间: 2018-08-18T09:01:20Z
项目社区:https://github.com/gantsign/ansible_role_sdkman_init

开源协议:Apache License 2.0

下载


Ansible Role: SDKMAN init

Tests
Ansible Galaxy
License

Role to initialize SDKMAN the software development kit
manager. This role allows you to install particular SDKs as part of your Ansible
provisioning and set which versions should be use by default.

Important: this role requires SDKMAN to be already installed. You can use
our gantsign.sdkman role to
install SDKMAN.

Requirements

  • Ansible >= 2.9

  • Linux Distribution

    • Debian Family

      • Debian

        • Stretch (9)
        • Buster (10)
        • Bullseye (11)
      • Ubuntu

        • Bionic (18.04)
        • Focal (20.04)
    • RedHat Family

      • Rocky Linux

        • 8
      • Fedora

        • 35
    • SUSE Family

      • openSUSE

        • 15.3
    • Note: other versions are likely to work but have not been tested.

Role Variables

The following variables will change the behavior of this role:

  1. # SDKMAN is initialized per user so you must specify at least one user
  2. users:
  3. - username: # User to initialize SDKMAN for
  4. sdkman_install:
  5. - candidate: # Candidate SDK name e.g. java
  6. version: # Candidate version to install
  7. path: # Optional. To add an existing SDK install to SDKMAN.
  8. # The `version` for the existing SDK can't be the same any of
  9. # those provided by SDKMAN. The version string is just an
  10. # identifier so you can give it any value you like (as long as it
  11. # doesn't clash with any other versions for this candidate).
  12. sdkman_default:
  13. _candidate_sdk_name_here_: # Optional. Default version

Example Playbooks

This is an example configuration for this role by itself (without the necessary
role for installing SDKMAN).

  1. - hosts: servers
  2. roles:
  3. - role: gantsign.sdkman_init
  4. users:
  5. - username: example_username
  6. sdkman_install:
  7. - candidate: java
  8. version: '8.0.181-zulu'
  9. - candidate: java
  10. version: '10'
  11. path: '/opt/java/jdk-10.0.2'
  12. - candidate: maven
  13. version: '3.5.4'
  14. sdkman_default:
  15. java: '10'
  16. maven: '3.5.4'

This is a complete example that uses the gantsign.sdkman role to install
SDKMAN. Notice how the gantsign.sdkman_init role can be used more than once
with Ansible tags to conditionally install particular SDKs.

  1. - hosts: servers
  2. roles:
  3. - role: gantsign.sdkman
  4. sdkman_users:
  5. - example_username
  6. - role: gantsign.sdkman_init
  7. tags:
  8. - java
  9. users:
  10. - username: example_username
  11. sdkman_install:
  12. - candidate: java
  13. version: '8.0.181-zulu'
  14. - candidate: java
  15. version: '10'
  16. path: '/opt/java/jdk-10.0.2'
  17. sdkman_default:
  18. java: '10'
  19. - role: gantsign.sdkman_init
  20. tags:
  21. - java
  22. - maven
  23. users:
  24. - username: example_username
  25. sdkman_install:
  26. - candidate: maven
  27. version: '3.5.4'
  28. sdkman_default:
  29. maven: '3.5.4'

More Roles From GantSign

You can find more roles from GantSign on
Ansible Galaxy.

Development & Testing

This project uses Molecule to aid in the
development and testing; the role is unit tested using
Testinfra and
pytest.

To develop or test you’ll need to have installed the following:

Because the above can be tricky to install, this project includes
Molecule Wrapper. Molecule
Wrapper is a shell script that installs Molecule and it’s dependencies (apart
from Linux) and then executes Molecule with the command you pass it.

To test this role using Molecule Wrapper run the following command from the
project root:

  1. ./moleculew test

Note: some of the dependencies need sudo permission to install.

License

Apache 2

Author Information

John Freeman

GantSign Ltd.
Company No. 06109112 (registered in England)