Saturday, January 28, 2023

Ansible playbook for creating an OpenShift cluster on VMware Cloud (VMC)

Ansible playbook for creating an OpenShift cluster on VMware Cloud (VMC)

Creating an OpenShift cluster on VMware Cloud (VMC) is a great way to take advantage of the power and flexibility of OpenShift while also leveraging the scalability and security of VMC. In this blog post, we'll walk through how to use Ansible to automate the process of creating an OpenShift cluster on VMC.

The first step is to create an Ansible playbook that will handle the creation of the OpenShift cluster. Here's an example of what that playbook might look like:

This playbook makes use of several key Ansible modules and variables to automate the process of creating an OpenShift cluster on VMC. The vmc_username, vmc_password, vmc_sddc_name, and vmc_org_name variables are used to authenticate with VMC, while the cluster_name, cluster_region, and cluster_size variables are used to specify the details of the OpenShift cluster that we want to create.

The playbook also makes use of the package and pip modules to install the necessary dependencies (python3, python3-pip, pyvmomi, and vmc-tools) and the vmc_cluster module to create the OpenShift cluster with the specified name, region, and size.

It is important to note that this playbook assumes that the following environment variables are set with the appropriate values: VMC_USERNAME, VMC_PASSWORD, VMC_SDDC_NAME, and VMC_ORG_NAME.

To run this playbook, simply execute the following command:

Monday, January 23, 2023

PowerShell Script to Retrieve Last Patch Status for Windows Servers

PowerShell Script to Retrieve Last Patch Status for Windows Servers

This script assumes that the text file containing the list of servers is located at "C:\serverlist.txt" and that the CSV file containing the patch status information will be saved at "C:\patchstatus.csv". You can change the path of the files as per your requirements. Also, you may need to run the script as an administrator and with appropriate permissions to be able to connect to the remote servers and retrieve the patch status information.

Automating Linux VM Patching with a Bash Script

Automating Linux VM Patching with a Bash Script

Keeping your Linux virtual machines (VMs) up-to-date with the latest patches is an important task to maintain their security and stability. In this post, we'll walk through a simple bash script that automates this process for a list of VMs.

The Script

The script reads a list of VMs from a text file and patches only the security packages on each VM using the yum update --security command. If the patching fails on a VM, the script moves on to the next VM in the list. Once patching is completed on all VMs, the script gets the kernel version of each VM using the uname -r command and stores the results in an array. The patching results are then written to a text file called "patch_results.txt" in the format "VM Name : Kernel Version".

This script assumes that you have passwordless ssh setup between your machine and the remote machines.

Conclusion

By automating the patching process with a simple bash script, you can save time and ensure that your Linux VMs are always up-to-date with the latest security patches. This script can be easily customized to suit your needs and can be used as a starting point for more advanced automation tasks.

Script for Pulling Uptime Information from Remote VMs

Script for Pulling Uptime Information from Remote VMs


This script prompts the user for an input file containing a list of VMs, checks if the input file exists, creates an output file to store the hostname and uptime information, and loops through the list of VMs to remotely connect to each one and pull the uptime information. The hostname and uptime are then extracted from the uptime_info and appended to the output file.

It uses the "uptime" command to get the uptime information and "awk" command to extract the uptime information, which is in the third field and

Configuring Storage in Nutanix

Steps for Configuring Storage in Nutanix

  1. Log in to the Nutanix Prism web console by entering the IP address of your Nutanix cluster into a web browser.
  2. Navigate to the "Storage" section of the menu on the left-hand side of the screen.
    • Click on the "Create Container" button to create a new storage container
    • Fill out the form to create a new container, providing details such as the name, data protection settings, and storage policies.
  3. Add new storage to the container by:
    • Clicking on the container you just created
    • Clicking on the "Add Storage" button
    • Selecting the appropriate storage options, such as capacity and performance.
  4. Save your changes by clicking the "Save" button

Your storage container should now be configured and ready to use.

It's important to note that these are just the basic steps for configuring storage in Nutanix, you may have to consult the Nutanix documentation for more detailed instructions and troubleshooting.

Configuring Networking in Nutanix

Steps for Configuring Networking in Nutanix

  1. Log in to the Nutanix Prism web console by entering the IP address of your Nutanix cluster into a web browser.
  2. Navigate to the "Networking" section of the menu on the left-hand side of the screen.
    • Click on the "Create Network" button
    • Fill out the form to create a new network, providing details such as the name, subnet, and VLAN ID.
  3. Configure your network settings by:
    • Clicking on the network you just created
    • Clicking on the "Edit" button
    • Providing the DHCP settings, IP address range, and gateway
  4. Save your changes by clicking the "Save" button

Your network should now be configured and ready to use.

It's important to note that these are just the basic steps for configuring networking in Nutanix, you may have to consult the Nutanix documentation for more detailed instructions and troubleshooting.

Creating a Virtual Machine in Nutanix

Creating a Virtual Machine in Nutanix

Nutanix provides a powerful platform for managing virtual machines, and in this guide, we'll show you how to create a VM in Nutanix with 4GB memory, 100GB HDD, and 2 CPU.

Steps:

  1. Log in to the Nutanix web console.
  2. Click on the "VMs" tab in the left-hand menu.
  3. Click on the "Create VM" button.
  4. Enter a name for your VM and select the appropriate cluster and storage container.
  5. Click on "Next" and select "Custom" as the configuration type.
  6. Assign 4GB of memory, 2 CPU, and 100GB of HDD space to the VM.
  7. Click on "Next" and select the appropriate network settings for your VM.
  8. Click on "Finish" to create the VM.

Once the VM is created, you can begin installing an operating system and other software on it. Keep in mind that you will need to have the appropriate licenses and image files in place in order to create a VM.

To learn more about creating VMs and other features of Nutanix, visit the Nutanix documentation and the Nutanix Community forum.