maven
Ansible role maven
Install and configure Apache Maven on your systems.
GitHub | Version | Issues | Pull Requests | Downloads |
---|---|---|---|---|
Example Playbook
This example is taken from molecule/default/converge.yml
and is tested on each push, pull request and release.
# code: language=ansible
---
- name: Converge
hosts: all
become: true
gather_facts: true
pre_tasks:
- name: Update apt cache
ansible.builtin.apt:
update_cache: true
changed_when: false
when: ansible_pkg_mgr in ('apt')
- name: Install jdk 8 (apt)
become: true
ansible.builtin.apt:
name: openjdk-8-jdk
state: present
when: ansible_pkg_mgr in ('apt')
roles:
- role: buluma.maven
maven_version: '3.9.6'
maven_install_dir: /opt/maven
- role: buluma.maven
maven_version: '3.3.9'
maven_is_default_installation: false
maven_fact_group_name: maven_3_3
# post_tasks:
# - name: Verify default maven facts
# ansible.builtin.assert:
# that:
# - ansible_local.maven.general.version is defined
# - ansible_local.maven.general.home is defined
#
# - name: Verify maven 3.3 facts
# ansible.builtin.assert:
# that:
# - ansible_local.maven_3_3.general.version is defined
# - ansible_local.maven_3_3.general.home is defined
The machine needs to be prepared. In CI this is done using molecule/default/prepare.yml
:
---
- name: Prepare
hosts: all
gather_facts: false
become: true
vars:
- java_type: jdk
- java_version: "8"
roles:
- role: buluma.bootstrap
- role: buluma.core_dependencies
- role: buluma.buildtools
- role: buluma.java
java_vendor: openjdk
java_version: "11"
Also see a full explanation and example on how to use these roles.
Role Variables
The default values for the variables are set in defaults/main.yml
:
# code: language=ansible
# https://github.com/gantsign/ansible-role-maven/blob/master/defaults/main.yml
---
# Maven version number
maven_version: '3.9.6'
# Mirror to download the Maven redistributable package from
maven_mirror: "http://archive.apache.org/dist/maven/maven-{{ maven_version | regex_replace('\\..*', '') }}/{{ maven_version }}/binaries"
# Base installation directory the Maven distribution
maven_install_dir: /opt/maven
# Directory to store files downloaded for Maven installation
maven_download_dir: "{{ x_ansible_download_dir | default(ansible_env.HOME + '/.ansible/tmp/downloads') }}"
# The number of seconds to wait before the Maven download times-out
maven_download_timeout: 10
# Whether to use the proxy when downloading Maven (if the proxy environment variable is present)
maven_use_proxy: true
# Whether to validate HTTPS certificates when downloading Maven
maven_validate_certs: true
# If this is the default installation, symbolic links to mvn and mvnDebug will
# be created in /usr/local/bin
maven_is_default_installation: true
# Name of the group of Ansible facts relating this Maven installation.
#
# Override if you want use this role more than once to install multiple versions
# of Maven.
#
# e.g. maven_fact_group_name: maven_3_3
# would change the Maven home fact to:
# ansible_local.maven_3_2.general.home
maven_fact_group_name: maven
Requirements
- pip packages listed in requirements.txt.
State of used roles
The following roles are used to prepare a system. You can prepare your system in another way.
Requirement | GitHub | Version |
---|---|---|
buluma.bootstrap | ||
buluma.buildtools | ||
buluma.core_dependencies | ||
buluma.java |
Context
This role is a part of many compatible roles. Have a look at the documentation of these roles for further information.
Here is an overview of related roles:
Compatibility
This role has been tested on these container images:
container | tags |
---|---|
EL | 8, 9 |
Fedora | 39, 38 |
opensuse | all |
Ubuntu | bionic, focal, jammy |
The minimum version of Ansible required is 2.12, tests have been done to:
- The previous version.
- The current version.
- The development version.
If you find issues, please register them in GitHub
Changelog
License
Author Information
ansible-galaxy install buluma/ansible-role-maven