blob: e41caa1759795161c35b601e622f73b38d5e8d59 [file] [log] [blame]
#
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
---
- name: Install OpenJDK 11 (CentOS)
yum: name="{{ openjdk_version }}" state=present update_cache=yes
become: yes
tags:
- always
when: ansible_distribution == "CentOS"
- name: Install OpenJDK 11 (Rocky)
dnf: name="{{ openjdk_version_rocky }}"
become: yes
tags:
- always
when: ansible_distribution == "Rocky"
# NOTE: If you see a file not found error, try running rm /var/lib/alternatives/{{ item.exe }} in the target machine
- name: set {{ java_home }} as default
alternatives:
name="{{ item.exe }}"
link="/usr/bin/{{ item.exe }}"
path="{{ item.path }}/{{ item.exe }}"
with_items:
- { path: "{{ java_home }}/bin", exe: 'java' }
- { path: "{{ java_home }}/bin", exe: 'keytool' }
- { path: "{{ java_home }}/bin", exe: 'javac' }
- { path: "{{ java_home }}/bin", exe: 'javadoc' }
become: yes
tags:
- always