Migration of Centos To Rhel by Automation
Migration of Centos To Rhel by Automation
# uname -r
# yum update -y
# reboot
# vi /etc/ansible/hosts
# vi setup-convert2rhel.yml
# ansible-playbook setup-convert2rhel.yml
# ansible-playbook run-convert2rhel.yml
Step7 :- Check the OS version of client server
# cat /etc/os-release
===========================================================================
Playbook1 :- setup-convert2rhel.yml
- hosts: all
become: yes
strategy: free
# You may modify these to fit your environment or use ansible-playbook --extra-vars
# to override them if needed.
vars:
skip_os_version_check: false
centos8_repos:
- CentOS-Linux-AppStream.repo
- CentOS-Linux-BaseOS.repo
- CentOS-Linux-ContinuousRelease.repo
- CentOS-Linux-Devel.repo
- CentOS-Linux-Extras.repo
- CentOS-Linux-FastTrack.repo
- CentOS-Linux-HighAvailability.repo
- CentOS-Linux-Plus.repo
- CentOS-Linux-PowerTools.repo
tasks:
regexp: "#baseurl=http://mirror.centos.org"
replace: baseurl=https://vault.centos.org
loop: "{{ centos8_repos }}"
when: ansible_distribution == 'CentOS' and ansible_distribution_major_version | int == 8
name: convert2rhel
Playbook2:- run-convert2rhel.yml
import_playbook: setup-convert2rhel.yml
- hosts: all
become: yes
strategy: free
# Modify these to be your red hat subscription manager username and password
# or override them via ansible-playbook --extra-vars
vars:
rhsm_username: redhat-user-name
rhsm_password: redhat-users-password
tasks:
block:
# Put the password into a file as arguments on the commandline can be
# seen in the process list.
- name: Create a temporary file to hold the password
# Note: Temporary files are always created with a secure mode, 0600
tempfile:
state: file
suffix: .temp
path: ~/
register: password_file
insertafter: EOF
no_log: True # Contains a secret
# NOTE 1: use the -y option to answer yes to all yes/no questions the
# tool asks carefully and only after you have tested interactively to
# ensure that there are not surprises within your environment. Also
# take care to read and follow all prerequisites and backup guidance documented at
# https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-
single/converting_from_an_rpm-based_linux_distribution_to_rhel/index
# network and storage. This will need to be run in parallel from the
# control node or Tower to effectively run against many systems.
--auto-attach
--debug
# -y
always:
- name: reboot
reboot:
setup:
gather_subset: 'distribution'
After Migration