Updated the RHEL setup to automate partition resizing and Puppet install

This commit is contained in:
Gregory Ballantine
2026-06-17 12:38:02 -04:00
parent cc5e690fef
commit b210f910b8
3 changed files with 18 additions and 7 deletions

View File

@@ -49,10 +49,10 @@ sudo
%post %post
# Update the system # Update the system
dnf -y update dnf -y update
# Istall the EPEL repository # Install the EPEL repository
dnf -y install epel-release dnf -y install epel-release
dnf -y install wget vim yum-plugin-versionlock qemu-guest-agent dnf -y install wget vim yum-plugin-versionlock qemu-guest-agent cloud-utils-growpart
echo 'xadmin ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/xadmin echo 'xadmin ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/xadmin

View File

@@ -49,10 +49,10 @@ sudo
%post %post
# Update the system # Update the system
dnf -y update dnf -y update
# Istall the EPEL repository # Install the EPEL repository
dnf -y install epel-release dnf -y install epel-release
dnf -y install wget vim yum-plugin-versionlock qemu-guest-agent dnf -y install wget vim yum-plugin-versionlock qemu-guest-agent cloud-utils-growpart
echo 'xadmin ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/xadmin echo 'xadmin ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/xadmin

View File

@@ -1,10 +1,11 @@
#!/bin/bash #!/bin/bash
PUPPET_MASTER='puppet-v1.int.metaunix.net' PUPPET_MASTER='puppet-v2.int.metaunix.net'
# determine OS version # determine OS version
if [ -f '/etc/redhat-release' ]; then if [ -f '/etc/redhat-release' ]; then
OS="rhel" OS="rhel"
OSVERSION=$(sed -rn 's/.*release ([0-9]+).*/\1/p' /etc/redhat-release)
elif [ -f '/etc/debian_version' ]; then elif [ -f '/etc/debian_version' ]; then
OS="debian" OS="debian"
elif [ -d '/etc/ubuntu-advantage' ]; then elif [ -d '/etc/ubuntu-advantage' ]; then
@@ -27,9 +28,19 @@ if [ "$OS" = 'freebsd' ]; then
zpool online -e zroot da0p3 # make ZFS resize the volume to match zpool online -e zroot da0p3 # make ZFS resize the volume to match
# Install Puppet # Install Puppet
echo -e "[agent]\nserver = $PUPPET_MASTER" > /usr/local/etc/puppet/puppet.conf echo -e "[agent]\nserver = $PUPPET_MASTER\nruninterval = 6h\n" > /usr/local/etc/puppet/puppet.conf
sysrc puppet_enable="YES" sysrc puppet_enable="YES"
else else
# Configure system hostname # Configure system hostname
hostnamectl set-hostname "$HOSTNAME" hostnamectl set-hostname "$HOSTNAME.$DOMAIN"
# Grow the partition and filesystem
growpart /dev/sda 4
xfs_growfs /
# Install and configure Puppet (OpenVox)
rpm -Uvh "https://yum.voxpupuli.org/openvox8-release-el-$OSVERSION.noarch.rpm"
dnf install -y openvox-agent
echo -e "[agent]\nserver = $PUPPET_MASTER\nruninterval = 6h\n" > /etc/puppetlabs/puppet/puppet.conf
systemctl restart puppet
fi fi