How to write when installing Amazon Corretto 8 on CentOS 8 with Ansible.

I want to execute the following command to install Amazon Corretto 8 in Ansible.

$ sudo rpm --import https://yum.corretto.aws/corretto.key
$ sudo curl -L -o /etc/yum.repos.d/corretto.repo https://yum.corretto.aws/corretto.repo
$ sudo yum install -y java-1.8.0-amazon-corretto-devel

You can install it by writing as follows.

playbooks/roles/server/tasks/main.yml


- name: Import rpm key.
  rpm_key:
    key: https://yum.corretto.aws/corretto.key

- name: Add corretto repository.
  yum_repository:
    name: corretto
    description: "Amazon Corretto repository"
    baseurl: https://yum.corretto.aws/$basearch

- name: Install Amazon Corretto 8.
  yum:
    name: java-1.8.0-amazon-corretto-devel
    state: present
    enablerepo: corretto

Installation confirmation

$ docker exec -it server_container bash
[root@target /]# java -version
openjdk version "1.8.0_275"
OpenJDK Runtime Environment Corretto-8.275.01.1 (build 1.8.0_275-b01)
OpenJDK 64-Bit Server VM Corretto-8.275.01.1 (build 25.275-b01, mixed mode)

I didn't notice the baseurl and enablerepo settings and was a little addicted to it. Also, inside CentOS 8, [dnf is running] instead of yum [https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/facts/system/pkg_mgr.py#L94 ).

Recommended Posts

How to write when installing Amazon Corretto 8 on CentOS 8 with Ansible.
How to write when installing Amazon Corretto 8 on CentOS 8 with Ansible.
How to deploy Laravel on CentOS 7
How to install MariaDB 10.4 on CentOS 8
Rails on Tiles (how to write)
How to install beta php8.0 on CentOS8
How to resolve errors when installing Rails 5.1.3
How to install kafkacat on Amazon Linux2
[Java] Memo on how to write the source
Notes on how to write comments in English
How to share on the host side (windows) and guest side (CentOS 7) with VirtualBox
[Ruby on Rails] How to write enum in Japanese
How to run javafx with Raspberry Pi Posted on 2020/07/12
How to write Rails
Install Java 8 (OpenJDK: Amazon Corretto) on macOS with Homebrew
How to write dockerfile
How to write docker-compose
Install MySQL 5.6 on CentOS6 [How to specify the version]
How to write migrationfile
How to write in Model class when you want to save binary data in DB with PlayFramework
How to reduce the load on the program even a little when combining characters with JAVA
How to set environment variables when using Payjp with Rails
Let's write how to make API with SpringBoot + Docker from 0
How to set chrony when the time shifts in CentOS7
How to specify db when creating an app with rails
How to write and notes when migrating from VB to JAVA
When you want to explicitly write OR or AND with ransack
How to install GNOME as a desktop environment on CentOS 7
How to write query option when using gem ruby-firebase (memorial)
How to get started with JDBC using PostgresSQL on MacOS
How to write good code
Bit Tetris (how to write)
How to deploy on heroku
How to write java comments
[Refactoring] How to write routing
Great poor (how to write)
[Note] How to write Dockerfile/docker-compose.yml
How to number (number) with html.erb
How to update with activerecord-import
How to write Junit 5 organized
How to write Rails validation
How to write Rails seed
[Ruby] How to write blocks
How to write Rails routing
How to use PlantUML with Visual Studio Code (created on October 30, 2020)
[RSpec on Rails] How to write test code for beginners by beginners
A story of connecting to a CentOS 8 server with an old Ansible
[Java] How to write when passing two or more arguments to super
How to cure screen flickering when fading pages with CSS animations
How to call with One Touch (without confirmation) on Android (Java)
How to write the view when Vue is introduced in Rails?
How to scroll horizontally with ScrollView
Install Amazon Corretto JDK with SDKMAN!
How to get started with slim
Studying Java # 6 (How to write blocks)
How to "hollow" View on Android
[Rails] How to write in Japanese
Ansible: Allow downgrade when installing Docker
[Java] How to update Java on Windows
How to install ImageMagick on Windows 10
How to enclose any character with "~"