-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #35302 - Playbook for Leapp install
- Loading branch information
1 parent
73c3888
commit acfade5
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<%# | ||
kind: job_template | ||
name: Install Leapp | ||
job_category: Leapp - Install | ||
description_format: 'Install Leapp CLI tool' | ||
provider_type: Ansible | ||
model: JobTemplate | ||
oses: | ||
- RedHat | ||
%> | ||
<% | ||
os_major = @host.operatingsystem.major.to_i | ||
rhel_compatible = @host.operatingsystem.family == 'Redhat' && @host.operatingsystem.name == 'RedHat' | ||
supported_version = [7, 8].include? os_major | ||
|
||
repos = case os_major | ||
when 7 | ||
['rhel-7-server-rpms', 'rhel-7-server-extras-rpms'] | ||
when 8 | ||
['rhel-8-for-x86_64-baseos-rpms', 'rhel-8-for-x86_64-appstream-rpms'] | ||
end | ||
|
||
package = case os_major | ||
when 7 | ||
'leapp' | ||
when 8 | ||
'leapp-upgrade' | ||
end | ||
-%> | ||
--- | ||
- hosts: all | ||
tasks: | ||
<% if rhel_compatible && supported_version -%> | ||
- name: Enable Leapp repositories | ||
command: subscription-manager repos <%= repos.map{|r| "--enable #{r}"}.join(" ") %> | ||
- name: Install <%= package %> | ||
package: | ||
name: <%= package %> | ||
state: present | ||
<% else -%> | ||
- name: Fail if the target server is not RHEL | ||
fail: | ||
msg: "This playbook can be executed only on RHEL server version 7 and 8." | ||
<% end -%> |