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
@dmccuk
dmccuk / gdisk.md
Last active October 31, 2024 11:44

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:

sudo yum install gdisk

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

@dmccuk
dmccuk / ansible_failed_hosts.md
Last active November 11, 2024 21:46
For when you need Ansible to give you a list of unreachable or failed hosts

How to get a list of failed or unreachable hosts

This is in response to this stackoverflow question The solution was posted by Vladimir Botka.

  • YouTube walkthough here

When Ansible runs, it's great for setting up and configuring servers as per your playbooks and roles. But have you ever needed to collect a list of failed hosts where Ansible wasn't able to connect to them? In this demo I'm going to show you how to collect a list of failed and unreachable hosts.

My setup:

I'm simply using a list of servers that don't exist, along with one remote server that I can get to.

Get facts from Windows servers

In this vide I want to show you, as aLinux admin, how to get facts from a windows wserver.

To set the scene, you're a Linux admin who works with Ansible. You already collect facts, including custom facts from Linux servers, but you've been asked to extent this to a small number of Windows servers. Apart from the usual facts collected by the setup module, we also need to know the versions of installed software so we can get a picture of our estate. You don't know how to write powershell but you know it can;t be that hard.

This is what I'm going to show you today:

  • I already have Ansible able to manage a windows server. IF you don't, check out my other video on gtting that setup: https://youtu.be/aPN18jLRkJI
  • I'm goint to show you how to collect facts from a windows server using the setup module.
  • Next I'll add a custom facts to collect all installed applications and their versions.

Meetup 18

Welcome to the meetup. This page is to help you take part in the Ansible-lockdown talk. Request access to one of the Ansible control nodes and run ansible-lockdown against a Rocky Linux 8 server. He're the setup:

The ubuntu Ansible control Node has all the requisite software installed already.

These were the updates made for this demo:

  • Making sure port 80 was allowed and not removed - This didn't work yet...