%#
name: Convert to RHEL
snippet: false
template_inputs:
- name: Activation Key
required: true
input_type: user
description: Set the activation key to assign the desired RHEL subscription and
life cycle environment to the converted machine at the registration step.
advanced: false
value_type: resource
resource_type: Katello::ActivationKey
hidden_value: false
- name: Restart
required: true
input_type: user
description: Restart the system when it is successfully converted to RHEL to boot
the new RHEL kernel.
options: "yes\r\nno"
advanced: false
value_type: plain
hidden_value: false
- name: Data telemetry
required: true
input_type: user
description: "The convert2rhel utility uploads the following data about the system
conversion to Red Hat servers for the purpose of the utility usage analysis:
\r\n-
The convert2rhel command as executed
\r\n- The convert2rhel RPM version and
GPG signature
\r\n- Success or failure status of the conversion
\r\n- Conversion
start and end timestamps
\r\n- Source OS vendor and version
\r\n- Target
RHEL version
\r\n- convert2rhel related environment variables
"
options: "yes\r\nno"
advanced: false
value_type: plain
resource_type: Katello::ActivationKey
default: 'yes'
hidden_value: false
model: JobTemplate
job_category: Convert 2 RHEL
provider_type: Ansible
kind: job_template
%>
---
- hosts: all
<%- if input('Data telemetry') != "yes" -%>
environment:
CONVERT2RHEL_DISABLE_TELEMETRY: 1
<%- end -%>
tasks:
- name: Install convert2rhel
ansible.builtin.package:
name: convert2rhel
state: present
- name: Gather package facts
package_facts:
manager: auto
- name: Set fact for package version
set_fact:
convert2rhel_version: "{{ ansible_facts.packages['convert2rhel'][0].version }}"
when: "'convert2rhel' in ansible_facts.packages"
no_log: true
- name: Prepopulate katello-ca-consumer
get_url:
url: <%= subscription_manager_configuration_url(@host) %>
dest: /usr/share/convert2rhel/subscription-manager/katello-ca-consumer-latest.noarch.rpm
when:
- "convert2rhel_version is version('2.0.0', '<')"
- name: Start convert2rhel
command: convert2rhel -y --activationkey "<%= input_resource('Activation Key').name %>" --org "<%= @host.organization.label %>"
<%- if input('Restart') == "yes" -%>
- name: Reboot the machine
reboot:
reboot_timeout: 1800
<%- end -%>
<%- # This will update system facts in Satellite and link the correct OS of the host %->
- name: Update system facts
command: subscription-manager facts --update