professormanhattan.java

<!-- ⚠️ This README has been created from ".config/docs/blueprint-readme-role.md" ⚠️-->
<div align="center">
  <center>
    <a href="https://github.com/megabyte-labs/ansible-java">
      <img width="148" height="148" alt="Java logo" src="https://gitlab.com/megabyte-labs/ansible-roles/java/-/raw/master/logo.png" />
    </a>
  </center>
</div>
<div align="center">
  <center><h1 align="center"><i></i>Java<i></i></h1></center>
  <center><h4 style="color: #18c3d1;">Made by <a href="https://megabyte.space" target="_blank">Megabyte Labs</a></h4><i></i></center>
</div>

<div align="center">
  <a href="https://megabyte.space" title="Megabyte Labs homepage" target="_blank">
    <img alt="Homepage" src="https://img.shields.io/website?down_color=%23FF4136&down_message=Down&label=Homepage&logo=home-assistant&logoColor=white&up_color=%232ECC40&up_message=Up&url=https%3A%2F%2Fmegabyte.space&style=for-the-badge" />
  </a>
  <a href="https://github.com/megabyte-labs/ansible-java/blob/master/docs/CONTRIBUTING.md" title="Learn about contributing" target="_blank">
    <img alt="Contributing" src="https://img.shields.io/badge/Contributing-Guide-0074D9?logo=github-sponsors&logoColor=white&style=for-the-badge" />
  </a>
  <a href="https://app.slack.com/client/T01ABCG4NK1/C01NN74H0LW/details/" title="Chat with us on Slack" target="_blank">
    <img alt="Slack" src="https://img.shields.io/badge/Slack-Chat-e01e5a?logo=slack&logoColor=white&style=for-the-badge" />
  </a>
  <a href="https://gitter.im/megabyte-labs/community" title="Chat with the community on Gitter" target="_blank">
    <img alt="Gitter" src="https://img.shields.io/gitter/room/megabyte-labs/community?logo=gitter&logoColor=white&style=for-the-badge" />
  </a>
  <a href="https://github.com/megabyte-labs/ansible-java" title="GitHub mirror" target="_blank">
    <img alt="GitHub" src="https://img.shields.io/badge/Mirror-GitHub-333333?logo=github&style=for-the-badge" />
  </a>
  <a href="https://gitlab.com/megabyte-labs/ansible-roles/java" title="GitLab repository" target="_blank">
    <img alt="GitLab" src="https://img.shields.io/badge/Repo-GitLab-fc6d26?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgAQMAAABJtOi3AAAABlBMVEUAAAD///+l2Z/dAAAAAXRSTlMAQObYZgAAAHJJREFUCNdNxKENwzAQQNEfWU1ZPUF1cxR5lYxQqQMkLEsUdIxCM7PMkMgLGB6wopxkYvAeI0xdHkqXgCLL0Beiqy2CmUIdeYs+WioqVF9C6/RlZvblRNZD8etRuKe843KKkBPw2azX13r+rdvPctEaFi4NVzAN2FhJMQAAAABJRU5ErkJggg==&style=for-the-badge" />
  </a>
</div>
<br/>
<div align="center">
  <a title="Ansible Galaxy role: professormanhattan.java" href="https://galaxy.ansible.com/professormanhattan/java" target="_blank">
    <img alt="Ansible Galaxy role: professormanhattan.java" src="https://img.shields.io/ansible/role/57261?logo=ansible&style=flat-square" />
  </a>
  <a title="Version: 1.0.1" href="https://github.com/megabyte-labs/ansible-java" target="_blank">
    <img alt="Version: 1.0.1" src="https://img.shields.io/badge/version-1.0.1-blue.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgAQMAAABJtOi3AAAABlBMVEUAAAD///+l2Z/dAAAAAXRSTlMAQObYZgAAACNJREFUCNdjIACY//+BEp9hhM3hAzYQwoBIAqEDYQrCZLwAAGlFKxU1nF9cAAAAAElFTkSuQmCC&cacheSeconds=2592000&style=flat-square" />
  </a>
  <a title="GitLab build status" href="https://gitlab.com/megabyte-labs/ansible-roles/java/-/commits/master" target="_blank">
    <img alt="Build status" src="https://img.shields.io/gitlab/pipeline-status/megabyte-labs/ansible-roles/java?branch=master&label=build&logo=gitlab&logoColor=white&style=flat-square" />
  </a>
  <a title="Windows 11 test status on GitHub" href="https://github.com/megabyte-labs/ansible-java/actions/workflows/Windows.yml" target="_blank">
    <img alt="Windows 11 test status" src="https://img.shields.io/github/workflow/status/ProfessorManhattan/ansible-java/Windows%20Ansible%20Role%20Test/master?color=cyan&label=windows&logo=windows&style=flat-square" />
  </a>
  <a title="macOS test status on GitLab" href="https://gitlab.com/megabyte-labs/ansible-roles/java/-/commits/master" target="_blank">
    <img alt="macOS test status" src="https://img.shields.io/gitlab/pipeline-status/megabyte-labs/ansible-roles/java?branch=test%2Fdarwin&label=osx&logo=apple&style=flat-square" />
  </a>
  <a title="Linux Molecule test status on GitLab" href="https://gitlab.com/megabyte-labs/ansible-roles/java/-/commits/master" target="_blank">
    <img alt="Linux Molecule test status" src="https://img.shields.io/gitlab/pipeline-status/megabyte-labs/ansible-roles/java?branch=test%2Flinux&label=linux&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgBAMAAACBVGfHAAAAElBMVEUAAAAwPEEuOEIxOzswPj7///91+pI+AAAABXRSTlMANRkNJejDPNcAAAB+SURBVCjPddHBDYAgDIXhGtMRHMG7S3hvTP79VxFIQVq1wOVLm7wU8QIJpSThC2wGwwJoPQFKRdiAAIhGsAykZNSZAOVNMx4BMjwtpySgr6CDJdB/MAdJwAvSiFoE5aABHUb0ch0WHNQq+KPAOgCgrbEnbjAHArjGz3jr3hpumrQpvwi66rkAAAAASUVORK5CYII=&style=flat-square" />
  </a>
  <a title="Ansible Galaxy quality score (out of 5)" href="https://galaxy.ansible.com/professormanhattan/java" target="_blank">
    <img alt="Ansible Galaxy quality score" src="https://img.shields.io/ansible/quality/57261?logo=ansible&style=flat-square" />
  </a>
  <a title="Ansible Galaxy download count" href="https://galaxy.ansible.com/professormanhattan/java" target="_blank">
    <img alt="Ansible Galaxy download count" src="https://img.shields.io/ansible/role/d/57261?logo=ansible&label=downloads&style=flat-square" />
  </a>
  <a title="Documentation" href="https://megabyte.space/docs/ansible" target="_blank">
    <img alt="Documentation" src="https://img.shields.io/badge/documentation-yes-brightgreen.svg?logo=readthedocs&logoColor=white&style=flat-square" />
  </a>
  <a title="License: MIT" href="https://github.com/megabyte-labs/ansible-java/blob/master/LICENSE" target="_blank">
    <img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-yellow.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgAQMAAABJtOi3AAAABlBMVEUAAAD///+l2Z/dAAAAAXRSTlMAQObYZgAAAHpJREFUCNdjYOD/wMDAUP+PgYHxhzwDA/MB5gMM7AwMDxj4GBgKGGQYGCyAEEgbMDDwAAWAwmk8958xpIOI5zKH2RmOyhxmZjguAiKmgIgtQOIYmFgCIp4AlaQ9OczGkJYCJEAGgI0CGwo2HmwR2Eqw5SBnNIAdBHYaAJb6KLM15W/CAAAAAElFTkSuQmCC&style=flat-square" />
  </a>
</div>

> <br/><h4 align="center">**An Ansible role that installs Java on almost any platform**</h4><br/>

<a href="#table-of-contents" style="width:100%"><img style="width:100%" src="https://gitlab.com/megabyte-labs/assets/-/raw/master/png/aqua-divider.png" /></a>

## Table of Contents

- [Overview](#overview)
- [Features](#features)
- [Quick Start](#quick-start)
- [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)

<a href="#overview" style="width:100%"><img style="width:100%" src="https://gitlab.com/megabyte-labs/assets/-/raw/master/png/aqua-divider.png" /></a>

## Overview

This repository contains an [Ansible](https://www.ansible.com/) role that installs Java on most platforms. [Java](https://www.java.com/en/) is a programming language that is class-based and object-oriented, designed to reduce implementation dependencies.

<a href="#features" style="width:100%"><img style="width:100%" src="https://gitlab.com/megabyte-labs/assets/-/raw/master/png/aqua-divider.png" /></a>

## Features

**Installs Java:**

- Uses Chocolatey for installation on Windows
- Sets the `JAVA_HOME` environment variable
- Installs Java on macOS, Linux, and Windows
- Adds Java to the `PATH`

**Optimizations for Windows:**

- Removes the Java folder from the Windows start menu

<a href="#quick-start" style="width:100%"><img style="width:100%" src="https://gitlab.com/megabyte-labs/assets/-/raw/master/png/aqua-divider.png" /></a>

## Quick Start

Want to install Java without using [Ansible](https://www.ansible.com/)? Just run one of the following commands based on your operating system:

**Linux/macOS:**

```shell
curl -sS https://install.doctor/java | bash

Windows:

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/java?os=win'))

Important Note: Before running any commands, check the URL directly to ensure the script is safe. It has been verified, but it's always good practice to inspect before executing.

You might also want to try Install Doctor, an app we built that installs any Ansible role with a simple command, and offers features like passwordless binary installation. If you prefer to include this role in an Ansible playbook with customized settings, keep reading.

Supported Operating Systems

The following chart lists the operating systems we have tested this role on. It is automatically generated using Ansible Molecule tests in the molecule/ folder. We have CI logic in place to test Windows, macOS, Ubuntu, Fedora, CentOS, Debian, and Archlinux. If your OS isn't listed but is based on one of these, it might still work.

OS Family OS Version Status Idempotent Tested On

What does idempotent mean? It means if you run this role twice, there will be no changes on the second run.

We have put a lot of effort into refining our CI and build tools. If you're interested in how we accomplished this, you might find our Ansible common files and Ansible documentation repositories informative. Check the CONTRIBUTING.md guide for more details.

Dependencies

Many of our roles depend on Ansible Galaxy collections, and some require other roles and collections published on Ansible Galaxy. Before running this role, install the dependencies by executing:

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

If you're new to Ansible, you can run bash .config/scripts/start.sh to automatically install all dependencies, including development ones.

Python

Only Ansible (a Python package) is necessary to run this play on a standard machine, but we include additional Python packages needed for specialized tasks and development. Here's a list of these packages:

Package Description Required
ansible Configuration management system for remote computer configuration
✔️
docker Allows provisioning Docker containers with Ansible
✔️
python-vagrant Required for provisioning Vagrant VMs
✔️
pywinrm Needed for provisioning Windows machines using WinRM
✔️
ansible-lint Linting tool for Ansible files
ansibler Tool for generating advanced documentation (e.g., compatibility chart)
black Auto-formatter for Python files used in test scripts
blocklint Linting tool to prevent certain words from entering the code base
flake8 Linter that checks Python syntax and style errors
mod-ansible-autodoc Custom fork of ansible-autodoc for auto-generating documentation from role comments
molecule Testing framework for Ansible
molecule-docker Molecule plugin for provisioning Docker containers
molecule-vagrant Molecule plugin for provisioning Vagrant VMs
pre-commit-hooks Useful tools for linting
proselint Linter for generating improvements in English-language documentation
yamllint Linter for YAML files to ensure proper syntax and styling

Galaxy Roles

While most roles don’t have dependencies, some may require other roles to be installed first. At the beginning of the play, the Ansible Galaxy role dependencies in meta/main.yml will run. These dependencies are set to only run once per playbook. If you use multiple roles that share dependencies, the installation of these dependencies will be skipped after the first run. Some roles also utilize helper roles directly in the task files to keep our main playbook (Gas Station) DRY.

The requirements.yml file lists all the Ansible Galaxy dependencies needed by this role (i.e., meta/main.yml role dependencies, helper roles, collections, etc.). Here are some common role dependencies with brief descriptions:

role_dependencies

Galaxy Collections

This role depends on several Ansible Galaxy collections. Below are the collections and links to their sources.

  • chocolatey.chocolatey Ansible Galaxy badge
  • community.general Ansible Galaxy badge
  • google.cloud Ansible Galaxy badge

Example Playbook

Once the dependencies are installed, just add the role to your main playbook. This role manages become behavior, so you can add it without worrying about root commands:

- hosts: all
  roles:
    - professormanhattan.java

If you are adding this role to an existing playbook, consider copying the requirements from pyproject.toml and requirements.yml to their respective files at the root of your playbook to simplify future installations. Note that dependencies in pyproject.toml can be transferred to the more traditional requirements.txt if that's what you're currently using.

Real World Example

You can view a playbook that utilizes this role in our main playbook (also called Gas Station). This playbook is an excellent example for those learning Ansible; it incorporates many useful build tools for advanced users, and even those not familiar with Ansible can benefit from it as it helps turn a computer (and network) into a powerful development environment. Essentially, it’s a fantastic project for developers!

Contributing

We welcome contributions, issues, and feature requests! Don’t hesitate to check the issues page. If you want to contribute, please look at the contributing guide.

Sponsorship

Hello Awesome Person,

I create open-source projects because I love it. I have a job and housing, but it would be nice to be recognized by the community for the time and money I invest. Please consider sponsoring me! Who knows? I might be able to quit my job and work on open-source full time.

Best regards,

Brian Zalewski

Open Collective sponsors GitHub sponsors Patreon

License

Copyright © 2020-2021 Megabyte LLC. This project is licensed under MIT. ```

Installa
ansible-galaxy install professormanhattan.java
Licenza
other
Download
1.2k
Proprietario
Often imitated, never duplicated