Skip to content

Commit

Permalink
#167 remove redundant lines and improve maintainability
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonio Arenzana Pulido committed Feb 2, 2022
1 parent 9b84773 commit 4c55540
Showing 9 changed files with 10 additions and 26 deletions.
10 changes: 1 addition & 9 deletions tasks/install_openjdk.yml
Original file line number Diff line number Diff line change
@@ -16,15 +16,7 @@

- name: Java | Setting OS and architecture specific variables (II)
set_fact:
java_open_jdk_home_dir: |-
{% if ansible_facts.architecture == "x86_64" %}
{{ java_open_jdk_home_dir if java_open_jdk_home_dir is defined and java_open_jdk_home_dir is not sameas None and java_open_jdk_home_dir else __java_open_jdk_home_dir }}
{%- endif %}
{%- if ansible_facts.architecture == "aarch64" and (ansible_distribution == "Debian" or ansible_distribution == "Ubuntu") and (java_jdk_vendor == "adoptopenjdk" or java_jdk_vendor == "openjdk") %}
{{ java_open_jdk_home_dir if java_open_jdk_home_dir is defined and java_open_jdk_home_dir is not sameas None and java_open_jdk_home_dir else __java_open_jdk_home_dir_arm64 }}
{%- endif %}
java_open_jdk_home_dir: "{{ java_open_jdk_home_dir if java_open_jdk_home_dir is defined and java_open_jdk_home_dir is not sameas None and java_open_jdk_home_dir else __java_open_jdk_home_dir }}" # noqa 204
java_open_jdk_package: "{{ java_open_jdk_package if java_open_jdk_package is defined and java_open_jdk_package is not sameas None and java_open_jdk_package else __java_open_jdk_package }}" # noqa 204

- name: Java | Setting specific variables
4 changes: 1 addition & 3 deletions vars/adoptopenjdk/Debian-10.yml
Original file line number Diff line number Diff line change
@@ -9,9 +9,7 @@ __java_open_jdk_version_major: 8
__java_required_libs_openjdk: []
__java_required_repositories_openjdk:
- deb https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ {{ ansible_distribution_release }} main
__java_open_jdk_home_dir: adoptopenjdk-{{ java_open_jdk_version_major }}-hotspot-amd64
__java_open_jdk_home_dir_arm64: adoptopenjdk-{{ java_open_jdk_version_major }}-hotspot-arm64

__java_open_jdk_home_dir: adoptopenjdk-{{ java_open_jdk_version_major }}-hotspot-{{ 'arm64' if ansible_facts.architecture == 'aarch64' else 'amd64'}}
__java_required_key_repositories_openjdk:
- https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public
__java_open_jdk_package: adoptopenjdk-{{ java_open_jdk_version_major }}-hotspot
3 changes: 1 addition & 2 deletions vars/adoptopenjdk/Debian-11.yml
Original file line number Diff line number Diff line change
@@ -10,8 +10,7 @@ __java_open_jdk_version_major: 8
__java_required_libs_openjdk: []
__java_required_repositories_openjdk:
- deb https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ {{ ansible_distribution_release }} main
__java_open_jdk_home_dir: adoptopenjdk-{{ java_open_jdk_version_major }}-hotspot-amd64
__java_open_jdk_home_dir_arm64: adoptopenjdk-{{ java_open_jdk_version_major }}-hotspot-arm64
__java_open_jdk_home_dir: adoptopenjdk-{{ java_open_jdk_version_major }}-hotspot-{{ 'arm64' if ansible_facts.architecture == 'aarch64' else 'amd64'}}

__java_required_key_repositories_openjdk:
- https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public
3 changes: 1 addition & 2 deletions vars/openjdk/Debian-10.yml
Original file line number Diff line number Diff line change
@@ -9,5 +9,4 @@ __java_required_libs_openjdk: []
__java_required_key_repositories_openjdk: []

__java_open_jdk_package: openjdk-{{ java_open_jdk_version_major }}-jdk-headless
__java_open_jdk_home_dir: java-{{ java_open_jdk_version_major }}-openjdk-amd64
__java_open_jdk_home_dir_arm64: java-{{ java_open_jdk_version_major }}-openjdk-arm64
__java_open_jdk_home_dir: java-{{ java_open_jdk_version_major }}-openjdk-{{ 'arm64' if ansible_facts.architecture == 'aarch64' else 'amd64'}}
3 changes: 1 addition & 2 deletions vars/openjdk/Debian-11.yml
Original file line number Diff line number Diff line change
@@ -10,7 +10,6 @@ __java_required_key_repositories_openjdk: []
__java_open_jdk_apt_extra_packages: []

__java_open_jdk_package: openjdk-{{ java_open_jdk_version_major }}-jdk-headless
__java_open_jdk_home_dir: java-{{ java_open_jdk_version_major }}-openjdk-amd64
__java_open_jdk_home_dir_arm64: java-{{ java_open_jdk_version_major }}-openjdk-arm64
__java_open_jdk_home_dir: java-{{ java_open_jdk_version_major }}-openjdk-{{ 'arm64' if ansible_facts.architecture == 'aarch64' else 'amd64'}}

ansible_python_interpreter: /usr/bin/python3
3 changes: 1 addition & 2 deletions vars/openjdk/Debian-9.yml
Original file line number Diff line number Diff line change
@@ -10,5 +10,4 @@ __java_required_libs_openjdk: []
__java_required_key_repositories_openjdk: []

__java_open_jdk_package: openjdk-{{ java_open_jdk_version_major }}-jdk-headless
__java_open_jdk_home_dir: java-{{ java_open_jdk_version_major }}-openjdk-amd64
__java_open_jdk_home_dir_arm64: java-{{ java_open_jdk_version_major }}-openjdk-arm64
__java_open_jdk_home_dir: java-{{ java_open_jdk_version_major }}-openjdk-{{ 'arm64' if ansible_facts.architecture == 'aarch64' else 'amd64'}}
3 changes: 1 addition & 2 deletions vars/openjdk/Ubuntu-16.yml
Original file line number Diff line number Diff line change
@@ -9,5 +9,4 @@ __java_required_libs_openjdk: []
__java_required_key_repositories_openjdk: []

__java_open_jdk_package: openjdk-{{ java_open_jdk_version_major }}-jdk-headless
__java_open_jdk_home_dir: java-{{ java_open_jdk_version_major }}-openjdk-amd64
__java_open_jdk_home_dir_arm64: java-{{ java_open_jdk_version_major }}-openjdk-arm64
__java_open_jdk_home_dir: java-{{ java_open_jdk_version_major }}-openjdk-{{ 'arm64' if ansible_facts.architecture == 'aarch64' else 'amd64'}}
3 changes: 1 addition & 2 deletions vars/openjdk/Ubuntu-18.yml
Original file line number Diff line number Diff line change
@@ -13,5 +13,4 @@ __java_required_libs_openjdk: []
__java_required_key_repositories_openjdk: []

__java_open_jdk_package: openjdk-{{ java_open_jdk_version_major }}-jdk-headless
__java_open_jdk_home_dir: java-{{ java_open_jdk_version_major }}-openjdk-amd64
__java_open_jdk_home_dir_arm64: java-{{ java_open_jdk_version_major }}-openjdk-arm64
__java_open_jdk_home_dir: java-{{ java_open_jdk_version_major }}-openjdk-{{ 'arm64' if ansible_facts.architecture == 'aarch64' else 'amd64'}}
4 changes: 2 additions & 2 deletions vars/openjdk/Ubuntu-20.yml
Original file line number Diff line number Diff line change
@@ -12,5 +12,5 @@ __java_required_libs_openjdk: []
__java_required_key_repositories_openjdk: []

__java_open_jdk_package: openjdk-{{ java_open_jdk_version_major }}-jdk-headless
__java_open_jdk_home_dir: java-{{ java_open_jdk_version_major }}-openjdk-amd64
__java_open_jdk_home_dir_arm64: java-{{ java_open_jdk_version_major }}-openjdk-arm64
__java_open_jdk_home_dir: java-{{ java_open_jdk_version_major }}-openjdk-{{ 'arm64' if ansible_facts.architecture == 'aarch64' else 'amd64'}}

0 comments on commit 4c55540

Please sign in to comment.