Skip to content

Commit

Permalink
refactor: fix some variables form vars/main.yml file
Browse files Browse the repository at this point in the history
  • Loading branch information
antmelekhin committed Oct 17, 2024
1 parent be52f5c commit 2f1d259
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 15 deletions.
4 changes: 2 additions & 2 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ java_type: 'jre'
java_openjdk_package_name: '{{ __java_openjdk_package_name }}'

# Install the Java package from the Amazon Corretto repository
java_corretto_repository_mirror_url: '{{ __java_corretto_repository_mirror_url }}'
java_corretto_repository_gpgkey_url: '{{ __java_corretto_repository_gpgkey_url }}'
java_corretto_repository_mirror_url: "https://{{ (ansible_os_family == 'Debian') | ternary('apt', 'yum') }}.corretto.aws"
java_corretto_repository_gpgkey_url: '{{ java_corretto_repository_mirror_url }}/corretto.key'
java_corretto_repository: '{{ __java_corretto_repository }}'
java_corretto_package_name: '{{ __java_corretto_package_name }}'

Expand Down
4 changes: 2 additions & 2 deletions meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ argument_specs:
description:
- 'The Amazon Corretto repository mirror.'
- 'By default, the role uses https://apt.corretto.aws for Debian-based distributions and https://yum.corretto.aws for RedHat-based distributions.'
default: '{{ __java_corretto_repository_mirror_url }}'
default: "https://{{ (ansible_os_family == 'Debian') | ternary('apt', 'yum') }}.corretto.aws"
java_corretto_repository_gpgkey_url:
type: 'str'
description:
- 'Specify where to fetch the Amazon Corretto GPG key file from.'
- 'By default, the role uses the official Amazon Corretto GPG key.'
default: '{{ __java_corretto_repository_gpgkey_url }}'
default: '{{ java_corretto_repository_mirror_url }}/corretto.key'
java_corretto_repository:
type: 'str'
description: 'Specify the Amazon Corretto repository.'
Expand Down
2 changes: 1 addition & 1 deletion templates/corretto.list.j2
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{{ ansible_managed | comment }}

deb [signed-by={{ __java_corretto_repository_gpgkey_keyring }}] {{ java_corretto_repository }}
{{ java_corretto_repository }}
12 changes: 2 additions & 10 deletions vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,13 @@ __java_openjdk_package_name_dict:

__java_openjdk_package_name: '{{ __java_openjdk_package_name_dict[ansible_os_family] }}'

# Default Amazon Corretto mirror
__java_corretto_repository_mirror_url_dict:
Debian: 'https://apt.corretto.aws'
RedHat: 'https://yum.corretto.aws'

__java_corretto_repository_mirror_url: '{{ __java_corretto_repository_mirror_url_dict[ansible_os_family] }}'

# Default Amazon Corretto GPG key
__java_corretto_repository_gpgkey_url: '{{ __java_corretto_repository_mirror_url }}/corretto.key'
__java_corretto_repository_gpgkey_keyring: '/usr/share/keyrings/corretto-archive-keyring.gpg'

# Default Amazon Corretto repository
__java_corretto_repository_dict:
Debian: '{{ __java_corretto_repository_mirror_url }} stable main'
RedHat: '{{ __java_corretto_repository_mirror_url }}/$basearch'
Debian: 'deb [signed-by={{ __java_corretto_repository_gpgkey_keyring }}] {{ java_corretto_repository_mirror_url }} stable main'
RedHat: '{{ java_corretto_repository_mirror_url }}/$basearch'

__java_corretto_repository: '{{ __java_corretto_repository_dict[ansible_os_family] }}'

Expand Down

0 comments on commit 2f1d259

Please sign in to comment.