diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 826e2ae1..4740eb6d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,6 +47,7 @@ jobs: - ubuntu2004 - debian12 - debian11 + - amazonlinux2023 steps: - name: Check out the codebase. diff --git a/README.md b/README.md index 8a38f794..800b1d37 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![CI](https://github.com/geerlingguy/ansible-role-java/workflows/CI/badge.svg?event=push)](https://github.com/geerlingguy/ansible-role-java/actions?query=workflow%3ACI) -Installs Java for RedHat/CentOS and Debian/Ubuntu linux servers. +Installs Java for RedHat/CentOS, Amazon and Debian/Ubuntu linux servers. ## Requirements diff --git a/tasks/main.yml b/tasks/main.yml index 2da43d66..965bd9d2 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -3,6 +3,10 @@ include_vars: "{{ ansible_distribution }}.yml" when: ansible_distribution == 'FreeBSD' or ansible_distribution == 'Fedora' +- name: Include OS-specific variables for Amazon. + include_vars: "{{ ansible_distribution }}-{{ ansible_distribution_version}}.yml" + when: ansible_distribution == 'Amazon' + - name: Include version-specific variables for CentOS/RHEL. include_vars: "RedHat-{{ ansible_distribution_version.split('.')[0] }}.yml" when: >- @@ -30,7 +34,10 @@ # Setup/install tasks. - include_tasks: setup-RedHat.yml - when: ansible_os_family == 'RedHat' + when: ansible_os_family == 'RedHat' and ansible_distribution_file_variety == 'RedHat' + +- include_tasks: setup-Amazon.yml + when: ansible_distribution == 'Amazon' - include_tasks: setup-Debian.yml when: ansible_os_family == 'Debian' diff --git a/tasks/setup-Amazon.yml b/tasks/setup-Amazon.yml new file mode 100644 index 00000000..13069452 --- /dev/null +++ b/tasks/setup-Amazon.yml @@ -0,0 +1,5 @@ +--- +- name: Ensure Java is installed. + package: + name: "{{ java_packages }}" + state: present diff --git a/vars/Amazon-2.yml b/vars/Amazon-2.yml new file mode 100644 index 00000000..203660ba --- /dev/null +++ b/vars/Amazon-2.yml @@ -0,0 +1,8 @@ +--- +# JDK version options include: +# - java-1.7.0-openjdk +# - java-1.8.0-openjdk +# - java-11-amazon-corretto +# - java-17-amazon-corretto +__java_packages: + - java-17-amazon-corretto diff --git a/vars/Amazon-2023.yml b/vars/Amazon-2023.yml new file mode 100644 index 00000000..86c3d5cf --- /dev/null +++ b/vars/Amazon-2023.yml @@ -0,0 +1,8 @@ +--- +# JDK version options include: +# - java-1.8.0-openjdk +# - java-11-amazon-corretto +# - java-17-amazon-corretto +# - java-21-amazon-corretto +__java_packages: + - java-11-amazon-corretto