{"id":18367815,"url":"https://github.com/gantsign/ansible-role-java","last_synced_at":"2025-04-06T17:31:34.965Z","repository":{"id":10503218,"uuid":"65627377","full_name":"gantsign/ansible-role-java","owner":"gantsign","description":"Ansible role for installing Java from Adoptium","archived":false,"fork":false,"pushed_at":"2025-02-11T19:21:45.000Z","size":863,"stargazers_count":34,"open_issues_count":7,"forks_count":16,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-22T03:51:13.314Z","etag":null,"topics":["ansible","ansible-role","java"],"latest_commit_sha":null,"homepage":"https://galaxy.ansible.com/gantsign/java","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gantsign.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-08-13T16:53:28.000Z","updated_at":"2024-11-30T15:55:25.000Z","dependencies_parsed_at":"2023-02-16T00:45:57.556Z","dependency_job_id":"65a182cd-a6a1-4e74-bd5a-23696733a4f7","html_url":"https://github.com/gantsign/ansible-role-java","commit_stats":null,"previous_names":[],"tags_count":65,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gantsign%2Fansible-role-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gantsign%2Fansible-role-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gantsign%2Fansible-role-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gantsign%2Fansible-role-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gantsign","download_url":"https://codeload.github.com/gantsign/ansible-role-java/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247522297,"owners_count":20952518,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","ansible-role","java"],"created_at":"2024-11-05T23:23:32.228Z","updated_at":"2025-04-06T17:31:34.949Z","avatar_url":"https://github.com/gantsign.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Ansible Role: Java\n==================\n\n[![Tests](https://github.com/gantsign/ansible-role-java/workflows/Tests/badge.svg)](https://github.com/gantsign/ansible-role-java/actions?query=workflow%3ATests)\n[![Ansible Galaxy](https://img.shields.io/badge/ansible--galaxy-gantsign.java-blue.svg)](https://galaxy.ansible.com/gantsign/java)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/gantsign/ansible-role-java/master/LICENSE)\n\nRole to install the Java JDK.\n\nRequirements\n------------\n\n* Ansible Core \u003e= 2.16\n\n* Linux Distribution\n\n    * Debian Family\n\n        * Debian\n\n            * Bullseye (11)\n            * Bookworm (12)\n\n        * Ubuntu\n\n            * Jammy (22.04)\n            * Noble (24.04)\n\n    * RedHat Family\n\n        * Rocky Linux\n\n            * 9\n\n        * Fedora\n\n            * 41\n\n    * SUSE Family\n\n        * openSUSE\n\n            * Tumbleweed\n\n    * Note: other versions are likely to work but have not been tested.\n\nRole Variables\n--------------\n\nThe following variables will change the behavior of this role (default values\nare shown below):\n\n```yaml\n# Java version number\n# Specify '8', '11', '17', '21' or '23' to get the latest patch version of that\n# release.\njava_version: '21.0.5+11'\n\n# Base installation directory for any Java distribution\njava_install_dir: '/opt/java'\n\n# Directory to store files downloaded for Java installation on the remote box\njava_download_dir: \"{{ x_ansible_download_dir | default(ansible_env.HOME + '/.ansible/tmp/downloads') }}\"\n\n# Location Java installations packages can be found on the local box\n# local packages will be uses in preference to downloading new packages.\njava_local_archive_dir: '{{ playbook_dir }}/files'\n\n# Wether to use installation packages in the local archive (if available)\njava_use_local_archive: true\n\n# If this is the default installation, profile scripts will be written to set\n# the JAVA_HOME environment variable and add the bin directory to the PATH\n# environment variable.\njava_is_default_installation: true\n\n# Name of the group of Ansible facts relating this Java installation.\n#\n# Override if you want use this role more than once to install multiple versions\n# of Java.\n#\n# e.g. java_fact_group_name: java_8\n# would change the Java home fact to:\n# ansible_local.java_8.general.home\njava_fact_group_name: java\n\n# The SHA-256 for the JDK redistributable\njava_redis_sha256sum:\n\n# Mirror location for JDK download (e.g. https://example.com/provisioning/files)\njava_redis_mirror:\n\n# File name for the JDK redistributable installation file\njava_redis_filename:\n\n# Timeout for JDK download response in seconds\njava_download_timeout_seconds: 600\n\n# The timeout for the Adoptium API\njava_api_timeout_seconds: 30\n```\n\nExample Playbooks\n-----------------\n\nBy default this role will install the latest LTS JDK version provided by\nAdoptium that has been tested and is known to work with this role:\n\n```yaml\n- hosts: servers\n  roles:\n    - role: gantsign.java\n```\n\nYou can install a specific version of the JDK by specifying the `java_version`.\n\n```yaml\n- hosts: servers\n  roles:\n    - role: gantsign.java\n      java_version: '8.0.432+6'\n```\n\n**Note:** with [curl](https://curl.haxx.se) and\n[jq](https://stedolan.github.io/jq) you can view the available versions by\nrunning the following command:\n\n```bash\nfor i in 23 21 17 11 8; do (curl --silent http \\\n  \"https://api.adoptium.net/v3/info/release_names?version=%5B$i,$(($i + 1)))\\\n\u0026release_type=ga\" | jq --raw-output '.releases[]' | sed -E 's/^jdk\\-?//'); done\n```\n\nYou can install the multiple versions of the JDK by using this role more than\nonce:\n\n```yaml\n- hosts: servers\n  roles:\n    - role: ansible-role-java\n      java_version: '8'\n      java_is_default_installation: false\n      java_fact_group_name: java_8\n\n    - role: ansible-role-java\n      java_version: '11'\n      java_is_default_installation: true\n      java_fact_group_name: java\n```\n\nTo perform an offline install, you need to specify a bit more information (i.e.\n`java_major_version`, `java_release_name`, `java_redis_filename` and\n`java_redis_sha256sum`). E.g. to perform an offline install of `11.0.25+9`:\n\n```yaml\n# Before performing the offline install, download\n# `OpenJDK11U-jdk_x64_linux_hotspot_11.0.25_9.tar.gz` to\n# `{{ playbook_dir }}/files/` on the local machine.\n- hosts: servers\n  roles:\n    - role: gantsign.java\n      java_major_version: '11'\n      java_version: '11.0.25+9'\n      java_release_name: 'jdk-11.0.25+9'\n      java_redis_filename: 'OpenJDK11U-jdk_x64_linux_hotspot_11.0.25_9.tar.gz'\n      java_redis_sha256sum: '191baa2e052627614022171400a917d28f0987dc54da48aaf07b06f552bb9884'\n```\n\nRole Facts\n----------\n\nThis role exports the following Ansible facts for use by other roles:\n\n* `ansible_local.java.general.version`\n\n    * e.g. `8u402`\n\n* `ansible_local.java.general.home`\n\n    * e.g. `/opt/java/jdk8u402`\n\nOverriding `java_fact_group_name` will change the names of the facts e.g.:\n\n```yaml\njava_fact_group_name: java_8\n```\n\nWould change the name of the facts to:\n\n* `ansible_local.java_8.general.version`\n* `ansible_local.java_8.general.home`\n\nMore Roles From GantSign\n------------------------\n\nYou can find more roles from GantSign on\n[Ansible Galaxy](https://galaxy.ansible.com/ui/standalone/namespaces/2463/).\n\nDevelopment \u0026 Testing\n---------------------\n\nThis project uses the following tooling:\n* [Molecule](http://molecule.readthedocs.io/) for orchestrating test scenarios\n* [Testinfra](http://testinfra.readthedocs.io/) for testing the changes on the\n  remote\n* [pytest](http://docs.pytest.org/) the testing framework\n* [Tox](https://tox.wiki/en/latest/) manages Python virtual\n  environments for linting and testing\n* [pip-tools](https://github.com/jazzband/pip-tools) for managing dependencies\n\nA Visual Studio Code\n[Dev Container](https://code.visualstudio.com/docs/devcontainers/containers) is\nprovided for developing and testing this role.\n\nLicense\n-------\n\nMIT\n\nAuthor Information\n------------------\n\nJohn Freeman\n\nGantSign Ltd.\nCompany No. 06109112 (registered in England)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgantsign%2Fansible-role-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgantsign%2Fansible-role-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgantsign%2Fansible-role-java/lists"}