Skip to content

pichuang/openshift4-toolbox

Repository files navigation

OpenShift 4 Toolbox

Speed delivery with Red Hat Ansible and OpenShift 4

                              \\\\\\\
                            \\\\\\\\\\\\
                          \\\\\\\\\\\\\\\
  -----------,-|           |C>   // )\\\\|
           ,','|          /    || ,'/////|
---------,','  |         (,    ||   /////
         ||    |          \\  ||||//''''|
Red Hat  ||    |           |||||||     _|
OpenShift||    |______      `````\____/ \
   4     ||    |     ,|         _/_____/ \
         ||  ,'    ,' |        /          |
         ||,'    ,'   |       |  YOU    \  |
_________|/    ,'     |      /           | |
_____________,'      ,',_____|      |    | |
             |     ,','      |      |    | |
             |   ,','    ____|_____/    /  |
             | ,','  __/ |             /   |
_____________|','   ///_/-------------/   |
              |===========,'

Current Environments

  • Red Hat OpenShift 4.6.17 using vSphere UPI
  • VMware vSphere 7.0.1 build: 17005016
  • Bastion
    • Red Hat Enterprise Linux 7.9
    • Red Hat Ansible 2.9.15
    • Python 3.6.8

Toolbox

OpenShift 4 ETCD

Execute commands on specifc nodes

  • Run commands to multiple nodes within one command - ./shell.sh "timedatectl | grep -i "Local time""
  • Run commands to multiple nodes with prompt mode - ansible-playbook shell_prompt.yml

OpenShift 4 Machine Management

  • Add Machineset on vSphere - ansible-playbook add-vsphere-machineset.yml
  • Add MachineHealthCheck - ansible-playbook add-machinehealthcheck.yml
  • Add MachineAutoScaler - ansible-playbook add-machineautoscaler.yml
  • Add ClusterAutoScaler - ansible-playbook add-clusterautoscaler.yml
  • Causing a Scaling Event for testing purpose - ./force-node-scaling-event.sh

OpenShift 4 Power Control

OpenShift 4 Authentication

  • Add new account and identity provider - ansible-playbook add-ocp4-account.yml
  • Disable default account kubeadmin - ansible-playbook remove-kubeadmin.yml

OpenShift 4 Security

  • Pull Audit Log

OpenShift 4 Time

  • Check System Time - `ansible-playbook
  • check-system-time.yml`
  • Change Timezone - ansible-playbook config-time-service.yml

OpenShift 4 Certificates

  • Add API server certificates

NFS

Service Mesh

ACM

Misc

  • Save container images to tar archive - ansible-playbook save-containe-images.yml
  • deadman is an observation software for host status using ping. - ansible-playbook monitoring-host-reboot.yml
  • Kubeeye

Prerequisite

  1. Edit hosts, ansible.cfg and put your own environment setting first
  2. Use ansible-playbook pingpong.yml to connect to host and verify a usable python interpreter
  3. (Optioanl) pip3 install -r requirements.txt
  4. Do anything you want to do

Tested Recording

Date Status OpenShift Version Ansible Version Bastion OS Version
20240126 OK 4.12.27 2.16.2 RHEL 9.3
20210222 OK 4.6.1 2.9.15 RHEL 7.9
20210220 OK 4.6.17 2.9.15 RHEL 7.9
20210220 OK 4.6.16 2.4.2.0 RHEL 7.9
20210220 OK 4.5.31 2.4.2.0 RHEL 7.9

Develope Environment

python3 -m venv .venv
ansible-galaxy collection install kubernetes.core:3.0.0 --force
pip install -r ~/.ansible/collections/ansible_collections/kubernetes/core/requirements.txt

Welcome to contribute!

References