lordoftheflies.ansible_role_java
Ansible Role: Java
Status
This role installs Java on RedHat/CentOS and Debian/Ubuntu Linux servers.
Setting Up the Test Environment
virtualenv --python=/usr/bin/python3.7 .env
source .env/bin/activate
pip install molecule molecule[lint] molecule[docker] docker docker-compose tox pytest
Requirements
No specific requirements.
Role Variables
Here are the available variables along with their default values:
The default packages for each distribution:
java_packages: - java-1.8.0-openjdk
You can specify the version and development kit of Java to install, along with any other necessary packages specific to your distribution, which are listed in the role's 'defaults' folder.
java_home: ""
If you set this, the role will configure the global environment variableJAVA_HOME
with the specified value.
Dependencies
None.
Example Playbook (using default package)
- hosts: servers
roles:
- role: lordoftheflies.role_java
become: yes
Example Playbook (install OpenJDK 8)
For RHEL / CentOS:
- hosts: server
roles:
- role: lordoftheflies.role_java
when: "ansible_os_family == 'RedHat'"
java_packages:
- java-1.8.0-openjdk
For Ubuntu versions lower than 16.04:
- hosts: server
tasks:
- name: Install repository for Java 8 in Ubuntu
apt_repository: repo='ppa:openjdk-r/ppa'
- hosts: server
roles:
- role: lordoftheflies.role_java
when: "ansible_os_family == 'Debian'"
java_packages:
- openjdk-8-jdk
Authors
Development Setup
pre-commit install
It’s recommended to enable settings for storing virtual environments (venvs) within your projects:
poetry config settings.virtualenvs.in-project true
Install the project dependencies:
poetry install
Running the Package Locally
Activate the virtual environment:
source .venv/bin/activate
Run the package as a module:
python -m gitcommit
Deployment
Deployment is managed automatically by Travis CI. It is connected to the repository and watches for pushes to the master branch. It builds and tests each commit to master, as well as every tagged commit, which it attempts to publish to PyPI.
Remember to update the version number in pyproject.toml
using Poetry:
poetry version [patch|minor|major]
Tag your commit (this generally applies to the latest commit, so ensure you are on the most recent one):
git tag v#.#.#
When pushing commits to the remote repository, be sure to also push the tags:
git push origin --tags
Ansible Galaxy role for maintain Java.
ansible-galaxy install lordoftheflies.ansible_role_java