Skip to content

Instantly share code, notes, and snippets.

View dmccuk's full-sized avatar
🏠
Working from home

Dennis McCarthy dmccuk

🏠
Working from home
View GitHub Profile

🧰 Morpheus + Ansible Integration (Standalone Mode) for VM Provisioning (On-Prem & Cloud)

This guide walks you through setting up Morpheus 8 to provision virtual machines both on-prem (vSphere, KVM, Hyper-V) and in the cloud (AWS, Azure, etc.), and to automatically configure them using Ansible (Standalone mode) running from the Morpheus appliance.


🧱 1. Prepare Base VM Template

Ensure your VM image (on-prem or cloud) includes:

Building a RHEL 9 ISO image using Packer 1.12 on RHEL 8 requires multiple steps. This guide will take you from installing dependencies to creating the ISO with Packer.
---
Step 1: Install Required Packages
Ensure your RHEL 8 system has the necessary tools installed.
# Enable required repositories
  1. Retrieve Security Groups via AWS CLI Get the Security Groups Attached to an Instance Run:
aws ec2 describe-instances --instance-id $(curl -s http://169.254.169.254/latest/meta-data/instance-id) --query "Reservations[].Instances[].SecurityGroups" --output json

This will return something like:

@dmccuk
dmccuk / gdisk.md
Last active January 9, 2025 10:36

The issue you're encountering is likely due to the use of the MBR (Master Boot Record) partitioning scheme. MBR has a partition size limitation of 2TB. If you have disks larger than 2TB and you want to use the entire space in a single partition, you should use the GPT (GUID Partition Table) partitioning scheme instead of MBR.

To use the full capacity of a 3TB (or larger) disk on RHEL6, you'd want to use the GPT format. Here's how you can create a GPT partition:

  1. Backup any data: Before making any changes to the disk, ensure you've backed up any data on it.

  2. Install gdisk: The gdisk utility is a version of fdisk for GPT. It might not be installed by default:

bash

Oracle Linux 8 VM Templating Guide in VMware

Reset Hostname

echo "localhost" > /etc/hostname

Clear Network Configuration

Delete specific network manager settings.

nmcli connection delete <connection_name>

Creating a VM Template on VMware vSphere 7

Prerequisites

  • ISO Images: Ensure you have the ISO images for RHEL9 and OEL9 downloaded.
  • vSphere Client: Have the vSphere Client open and connected to your vCenter or ESXi host.

1. Prepare the ISO Image

  • Upload the RHEL9 and OEL9 ISOs to a datastore accessible by the ESXi hosts.

2. Create a New Virtual Machine

---
- name: Manage iptables on RHEL6 or OEL6
hosts: your_target_hosts # You need to replace this with your actual target host group or host.
become: true
gather_facts: true # This is required to collect facts about the target host.
tasks:
- name: Check if the system is RHEL6 or OEL6
assert:
that:
@dmccuk
dmccuk / building_VMs.md
Last active September 1, 2023 13:54
building_VMs

Building VMs using Ansible and the VMware API can be a streamlined process, but it does come with some considerations. Here's a more detailed guide:

Ansible and VMware

You'll want to make use of the Ansible vmware_guest module, which can create, clone, or reconfigure VMware VMs through vCenter.

Approach:

  1. Inventory:

Generated via ChatGPT:

Hopefully this is what you need...

Python version:

To use this script, you'll need to replace your_company_name with the name of the company you're searching for, and your_github_api_token with a valid GitHub API token that has the necessary permissions to access user data. You can run the script from the command line or in a Python development environment, and it will print a list of usernames associated with the specified company on GitHub.

To use this script with the company_name argument, you can run the command like this:

python github_users.py -c teslamotors

Project Name

The project [insert project name] is a [insert brief description of what the project does]. The project is [insert why it's useful or entertaining].

Prerequisites

Before using the project, please ensure that your system meets the following requirements:

  • Operating System: [insert supported OS]
  • Software: [insert any software or dependencies required]
  • Additional Information: [insert any other important information required to run the project]

Quick Start