Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/professormanhattan/ansible-sdkman
Installs SDKMAN on Linux or macOS
https://github.com/professormanhattan/ansible-sdkman
ansible debian doctor environment fedora install installdoc installdoctor macos manager mblabs megabytelabs molecule professormanhattan role sdk ubuntu version washingtondc windows
Last synced: 20 days ago
JSON representation
Installs SDKMAN on Linux or macOS
- Host: GitHub
- URL: https://github.com/professormanhattan/ansible-sdkman
- Owner: ProfessorManhattan
- License: other
- Created: 2022-01-15T23:50:44.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2023-03-23T13:06:34.000Z (almost 2 years ago)
- Last Synced: 2024-05-02T03:24:14.776Z (8 months ago)
- Topics: ansible, debian, doctor, environment, fedora, install, installdoc, installdoctor, macos, manager, mblabs, megabytelabs, molecule, professormanhattan, role, sdk, ubuntu, version, washingtondc, windows
- Language: Shell
- Homepage: https://megabyte.space
- Size: 5.65 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: docs/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: docs/CODE_OF_CONDUCT.md
- Codeowners: docs/CODEOWNERS
Awesome Lists containing this project
README
>
**An Ansible role that installs SDKMAN on Linux or macOS**
## Table of Contents
- [Overview](#overview)
- [Features](#features)
- [Quick Start](#quick-start)
- [Variables](#variables)
- [Variable Examples](#variable-examples)
- [`sdk_installs`](#sdk_installs)
- [`user_configs`](#user_configs)
- [Supported Operating Systems](#supported-operating-systems)
- [Dependencies](#dependencies)
- [Python](#python)
- [Galaxy Roles](#galaxy-roles)
- [Galaxy Collections](#galaxy-collections)
- [Example Playbook](#example-playbook)
- [Real World Example](#real-world-example)
- [Contributing](#contributing)
- [Affiliates](#affiliates)
- [License](#license)## Overview
This repository is the home of an [Ansible](https://www.ansible.com/) role that installs SDKMAN on Linux or macOS. [SDKMAN](https://sdkman.io/) is a tool for managing multiple versions of various Software Development Kits (SDKs) for the JVM on any UNIX-based system. It provides a convenient command line interface for installing, switching, removing and listing candidates. With SDKMAN, you can install and manage dependencies like Java, Groovy, Scala, Kotlin, and Ceylon. You can also use it to manage Ant, Gradle, Grails, Maven, SBT, Spark, Spring Boot, Vert.x, and many [other SDKs](https://sdkman.io/sdks).
## Features
**Installs SDKMAN:**
- Removes older version of SDKMAN if it is already present
- Installs SDKMAN by running `curl -s "https://get.sdkman.io" | bash`
- Ensures SDKMAN is installed on macOS and Linux systems**Configures SDKMAN:**
- Sets `sdkman_auto_answer` to true in the SDKMAN configuration
- Ensures user-specified SDKs are installed## Quick Start
Looking to install SDKMAN without having to deal with [Ansible](https://www.ansible.com/)? Simply run the following command that correlates to your operating system:
**Linux/macOS:**
```shell
curl -sS https://install.doctor/sdkman | bash
```**Windows:**
```powershell
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://install.doctor/sdkman?os=win'))
```**Important Note:** _Before running the commands above you should probably directly access the URL to make sure the code is legit. We already know it is safe but, before running any script on your computer, you should inspect it._
You can also check out **[Install Doctor](https://install.doctor)**. It is an app we created that can install any Ansible role with a one-liner. It has some other nifty features too like the ability to install binaries on-the-fly without requiring a password. However, if you would like to incorporate this role into an Ansible playbook (and customize settings) then please continue reading below.
## Variables
This role contains variables that you can customize. The variables you can customize are located in `defaults/main.yml`. By default, the variables use sensible defaults but you may want to customize the role depending on your use case. The variables, along with descriptions, are listed below:
| Name | Default Value | Description |
| ------------------------------- | ------------- | ---------------------------------------------- |
| [`sdk_installs`](#sdk_installs) | `[]` | List of one or more versions of SDK to install |
| [`user_configs`](#user_configs) | `[]` | List of users to run the setup for |### Variable Examples
#### `sdk_installs`
```yaml
#💬 Example implementation of the sdk_installs variable
sdk_installs:
- java 8u11
- scala 2.11.6
```#### `user_configs`
```yaml
#💬 Example implementation of the user_configs variable
user_configs:
- username: developer1
```## Supported Operating Systems
The chart below shows the operating systems that we have tested this role on. It is automatically generated using the Ansible Molecule tests located in the `molecule/` folder. There is CI logic in place to automatically handle the testing of Windows, macOS, Ubuntu, Fedora, CentOS, Debian, and Archlinux. If your operating system is not listed but is a variant of one of the systems we test (i.e. a Debian-flavored system or a RedHat-flavored system) then it is possible that the role will still work.
| OS Family | OS Version | Status | Idempotent | Tested On |
| ------------- | --------------------- | ---------------------------- | ---------------------------- | ----------------- |
| ArchLinux | Latest |✅|✅| January 6th, 2022 |
| CentOS | 7 |✅|✅| January 6th, 2022 |
| CentOS | 8 |✅|✅| January 6th, 2022 |
| CentOS Stream | 8 |✅|✅| January 6th, 2022 |
| Debian | 10 (Buster) |✅|✅| January 6th, 2022 |
| Debian | 11 (Bullseye) |✅|✅| January 6th, 2022 |
| Debian | 9 (Stretch) |✅|✅| January 6th, 2022 |
| Fedora | 33 |✅|✅| January 6th, 2022 |
| Fedora | 34 |✅|✅| January 6th, 2022 |
| Fedora | 35 |✅|✅| January 6th, 2022 |
| Ubuntu | 18.04 (Bionic Beaver) |✅|✅| January 6th, 2022 |
| Ubuntu | 20.04 (Focal Fossa) |✅|✅| January 6th, 2022 |
| Ubuntu | 21.04 (Hirsute Hippo) |✅|✅| January 6th, 2022 |
| Ubuntu | 21.10 (Impish Indri) |✅|✅| January 6th, 2022 |
| Windows | 10 |✅|✅| January 6th, 2022 |**_What does idempotent mean?_** Idempotent means that if you run this role twice in row then there will be no changes to the system the second time around.
We spent a lot of time perfecting our CI configurations and build tools. If you are interested in learning more about how we perfected our process then you might find our [Ansible common files](https://gitlab.com/megabyte-labs/common/ansible) and [Ansible documentation](https://gitlab.com/megabyte-labs/documentation/ansible) repositories interesting. See the [CONTRIBUTING.md](docs/CONTRIBUTING.md) guide for more details.
## Dependencies
Most of our roles rely on [Ansible Galaxy](https://galaxy.ansible.com) collections. Some of our projects are also dependent on other roles and collections that are published on Ansible Galaxy. Before you run this role, you will need to install the collection and role dependencies, as well as the Python requirements, by running:
```yaml
if type poetry &> /dev/null; then poetry install --no-root; else pip3 install -r .config/assets/requirements.txt; fi
ansible-galaxy install -r requirements.yml
```Alternatively, you can simply run `bash .config/scripts/start.sh` if you are new to Ansible and do not mind the development requirements also being installed. This is the easy way of making sure that everything works properly.
### Python
Although the only tool necessary to run this play on a standard machine is Ansible (a Python package), we include several other Python dependencies that are required for specialized use cases and development. The table below details these packages:
| Package | Description | Required |
| ---------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------- |
| ansible | A configuration management system that can remotely configure computers |✔️|
| docker | Enables the capability of provisioning Docker containers with Ansible |✔️|
| python-vagrant | Required for provisioning Vagrant VMs |✔️|
| pywinrm | Required for provisioning Windows machines that are using WinRM |✔️|
| ansible-lint | Linting tool for Ansible files | |
| ansibler | Custom tool used to generate advanced documentation (e.g. it generates the compatibility chart and some other charts) | |
| black | Python file auto-formatter included in case project utilizes Python test scripts | |
| blocklint | Linting tool that prevents certain words from entering the code base | |
| flake8 | Python linter that reports Python syntax and style errors | |
| mod-ansible-autodoc | Custom fork of [ansible-autodoc](https://pypi.org/project/ansible-autodoc/0.5.1.1/) which allows us to auto-generate documentation based on comments in the role's YAML files | |
| molecule | Test framework for Ansible | |
| molecule-docker | Molecule plugin for provisioning Docker containers | |
| molecule-vagrant | Molecule plugin for provisioning Vagrant VMs | |
| pre-commit-hooks | Suite of tools useful for linting | |
| proselint | Linter used to generate English-language improvements (used to improve documentation) | |
| yamllint | Linter for YAML files that ensures proper syntax and styling is used | |### Galaxy Roles
Although most of our roles do not have dependencies, there are some cases where another role has to be installed before the logic can continue. At the beginning of the play, the Ansible Galaxy role dependencies listed in `meta/main.yml` will run. These dependencies are configured to only run once per playbook. If you include more than one of our roles in your playbook that have dependencies in common then the dependency installation will be skipped after the first run. Some of our roles also utilize helper roles directly from the task files which helps keep our [main playbook (Gas Station)](repository.playbooks) DRY.
The `requirements.yml` file contains a full list of the Ansible Galaxy dependencies required by this role (i.e. `meta/main.yml` role dependencies, helper roles, collections, etc.). For your convenience, a list of the role dependencies along with quick descriptions is below:
role_dependencies
### Galaxy Collections
This role is dependent on multiple Ansible Galaxy collections. The collections along with a links to their source are listed below.
## Example Playbook
With the dependencies installed, all you have to do is add the role to your main playbook. The role handles the `become` behavior so you can simply add the role to your playbook without having to worry about commands that should not be run as root:
```lang-yml
- hosts: all
roles:
- professormanhattan.sdkman
```If you are incorporating this role into a pre-existing playbook, then it might be prudent to copy the requirements outlined in `pyproject.toml` and `requirements.yml` to their corresponding files in the root of your playbook so you only have to worry about installing one set of requirements during future use. Note that the dependencies in `pyproject.toml` can be moved to the more traditional `requirements.txt`, if that is what you are currently using to track Python dependencies.
### Real World Example
You can find an example of a playbook that incorporates this role in our main playbook (a.k.a. [Gas Station](https://github.com/ProfessorManhattan/Gas-Station)). The playbook is an excellent example for someone learning how to use Ansible. It also incorporates a lot of well-thought out build tools that more advanced Ansible users can appreciate. And people who could care less about Ansible can also benefit from it because it allows you to more or less turn your computer (and network) into the ultimate development enivornment. The bottom line is that it is an awesome project that developers should know about!
## Contributing
Contributions, issues, and feature requests are welcome! Feel free to check the [issues page](https://github.com/megabyte-labs/ansible-sdkman/issues). If you would like to contribute, please take a look at the [contributing guide](https://github.com/megabyte-labs/ansible-sdkman/blob/master/docs/CONTRIBUTING.md).
Sponsorship
Dear Awesome Person,
I create open source projects out of love. Although I have a job, shelter, and as much fast food as I can handle, it would still be pretty cool to be appreciated by the community for something I have spent a lot of time and money on. Please consider sponsoring me! Who knows? Maybe I will be able to quit my job and publish open source full time.
Sincerely,
**_Brian Zalewski_**
### Affiliates
Below you will find a list of services we leverage that offer special incentives for signing up for their services through our special links:
## License
Copyright © 2020-2021 [Megabyte LLC](https://megabyte.space). This project is [MIT](https://gitlab.com/megabyte-labs/ansible-roles/sdkman/-/blob/master/LICENSE) licensed.