Skip to content

Commit

Permalink
Make Amazon linux great again.
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-de-bock committed Jun 14, 2023
1 parent 41759db commit 4ca4585
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ This example is taken from [`molecule/default/converge.yml`](https://github.com/
vars:
_desired_java_version:
default: 8
Amazon: 17
Debian: 11
Debian-bookworm: 17
desired_java_version: "{{ _desired_java_version[ansible_distribution ~ '-' ~ ansible_distribution_release] | default(_desired_java_version[ansible_distribution] | default(_desired_java_version['default'])) }}"
Expand Down Expand Up @@ -59,7 +60,7 @@ java_vendor: openjdk
# Set the variable to install the type, valid values are "jre" and "jdk".
java_type: jre

# Set the version of java, valid values are 6, 7, 8, 9, 10, 11, 12 or 13.
# Set the version of java, valid values are 6, 7, 8, 9, 10, 11, 12, 13 or 17.
# By default, a distribution default is used, mapped in `vars/main.yml`.
# By setting java_version, you overwrite this default to your selected
# version.
Expand Down
2 changes: 1 addition & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ java_vendor: openjdk
# Set the variable to install the type, valid values are "jre" and "jdk".
java_type: jre

# Set the version of java, valid values are 6, 7, 8, 9, 10, 11, 12 or 13.
# Set the version of java, valid values are 6, 7, 8, 9, 10, 11, 12, 13 or 17.
# By default, a distribution default is used, mapped in `vars/main.yml`.
# By setting java_version, you overwrite this default to your selected
# version.
Expand Down
1 change: 1 addition & 0 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
vars:
_desired_java_version:
default: 8
Amazon: 17
Debian: 11
Debian-bookworm: 17
desired_java_version: "{{ _desired_java_version[ansible_distribution ~ '-' ~ ansible_distribution_release] | default(_desired_java_version[ansible_distribution] | default(_desired_java_version['default'])) }}"
Expand Down
5 changes: 1 addition & 4 deletions molecule/default/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
vars:
_expected_java_version:
default: 'openjdk version "1.8.'
Amazon: 'openjdk version "17.0.'
Debian: 'openjdk version "11.0.'
Debian-bookworm: 'openjdk version "17.0.'
expected_java_version: "{{ _expected_java_version[ansible_distribution ~ '-' ~ ansible_distribution_release] | default(_expected_java_version[ansible_distribution] | default(_expected_java_version['default'])) }}"
Expand All @@ -18,10 +19,6 @@
changed_when: no
register: output

- name: Show output or java -version
ansible.builtin.debug:
msg: "{{ output }}"

- name: Check if the correct version was found.
ansible.builtin.assert:
that:
Expand Down
3 changes: 3 additions & 0 deletions vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
_java_default_version:
default: 11
Alpine: 8
Amazon: 17
Debian: 17
Gentoo: 8
RedHat: 8
Expand Down Expand Up @@ -47,6 +48,7 @@ _java_openjdk_package:
default: openjdk-13-jre
17:
default: openjdk-17-jre
Amazon: java-17-amazon-corretto
jdk:
6:
default: java-1.6.0-openjdk-devel
Expand Down Expand Up @@ -76,6 +78,7 @@ _java_openjdk_package:
default: openjdk-13-jdk
17:
default: openjdk-17-jdk
Amazon: java-17-amazon-corretto-devel

java_openjdk_package: "{{ _java_openjdk_package[java_type][java_version | int][ansible_distribution] | default(_java_openjdk_package[java_type][java_version | int]['default'] | default([])) }}"

Expand Down

0 comments on commit 4ca4585

Please sign in to comment.