/lab.local

Ansible based install and setup of OCP and other tools

GNU General Public License v3.0GPL-3.0

Ansible-Lab to learn Ansible while installing OCP via UPI

This document is intended for folks who want to learn ansible basics and how to install Red hat Openshift on KVM for training purposes or demo.

Lab Diagram

Playbooks can be found here: https://github.com/elajoie/lab.local

Most of the Ansible is basic and fits well with someone who has just finished the EX294 exam.

Setup Bation (Manual)

In this section you will set up the bastion which is used to stage many network services including PXE booting of KVM nodes. Grab the latest version of RHEL8 (8.2 Beta for this version) and put it on a USB to boot your bastion HW off of. All the HW in my topology is set up on VLAN1 and VLAN2 with the 192.168.1.0/24 network on VLAN1.

  1. Install minimal server version and register with RH

  2. get the latest RHEL8 boot iso and put it in the files folder in the pxe role

  3. update the variables in the defaults folder for this role to match the iso

  4. create a .gitignore file with the following

    1. .gitignore
    2. inventory
    3. vault
  5. install packages needed on your laptop running the playbooks

    1. rhel-system-roles
    2. python3-netaddr
  6. create vault file with these variable:

    1. vault_rhn_username: RHNusername
    2. vault_rhn_password: neverEndingShadow
    3. vault_orgid: sevenDigitOrgID
    4. vault_actkey: keyNameYouCreate
    5. vault_rootpasswd: changeme
    6. vault_kvm02_user: redfish (optional)
    7. vault_kvm02_pass: changeme (optional)
    8. vault_token_long: "long secret"
    9. vault_sshkey: "ssh-rsa AAAA"
  7. Run 01bastion.yml to setup all the services

  8. Once this play is done you should be able to PXE boot your KVM nodes

  9. You also have an optional role called redfish if you have redfish support in your KVM nodes to automate the reboot and boot mode setting to PXE via APIs

  10. Run 02kvm.yml roles when all the kvm nodes have done rebooting

  11. For now just manually start the VMs once they are all off and the OCP install should finish on its own

  12. Shut down the bootstrap node #On bastion:

  13. export KUBECONFIG=/opt/registry/www/html/ignition/auth/kubeconfig

  14. oc get nodes

  15. oc patch configs.imageregistry.operator.openshift.io cluster --type merge --patch '{"spec":{"storage":{"emptyDir":{}}}}'

  16. oc get clusterversion; echo; oc get clusteroperators

  17. Do this command untill all the CRSs are approved and you see all your workers. oc get csr -ojson | jq -r '.items[] | select(.status == {} ) | .metadata.name' | xargs oc adm certificate approve