Skip to content

Instantly share code, notes, and snippets.

@benders
Created September 11, 2012 22:38
Show Gist options
  • Save benders/3702684 to your computer and use it in GitHub Desktop.
Save benders/3702684 to your computer and use it in GitHub Desktop.
Cobbler provisioning helpers
#!/bin/bash
if [ $# -ne 5 ]; then
prog=`basename $0`
echo "Usage $prog <short-hostname> <eth0> <eth1> <eth2> <eth3>" >&2
exit -1
fi
set -xe
name=$1
mac0=$2
mac1=$3
mac2=$4
mac3=$5
ipaddr0=`gethostip -d $name`
ipaddr1=`echo $ipaddr0 | sed 's/1\.2\.3\.\([0-9]*\)/1.2.250.\1/'`
cobbler system remove --name="$name"
cobbler system add --name="$name" --hostname="$name.example.com" --profile=CentOS-5-x86_64-database
cobbler system edit --name="$name" --interface=eth0 --mac="$mac0" --bonding=slave --bonding-master=bond0
cobbler system edit --name="$name" --interface=eth1 --mac="$mac1" --bonding=slave --bonding-master=bond0
cobbler system edit --name="$name" --interface=bond0 --bonding=master --bonding-opts="mode=802.3ad miimon=100"
cobbler system edit --name="$name" --interface=bond0 --ip-address="$ipaddr0" --static=1 --subnet=255.255.255.0 --gateway=1.2.3.1
cobbler system edit --name="$name" --interface=eth2 --mac="$mac2" --bonding=slave --bonding-master=bond1
cobbler system edit --name="$name" --interface=eth3 --mac="$mac3" --bonding=slave --bonding-master=bond1
cobbler system edit --name="$name" --interface=bond1 --bonding=master --bonding-opts="mode=802.3ad miimon=100"
cobbler system edit --name="$name" --interface=bond1 --ip-address="$ipaddr1" --static=1 --subnet=255.255.255.0
#!/bin/bash
set -xe
name=$1
mac0=$2
mac1=$3
ipaddr=`gethostip -d $name`
cobbler system add --name="$name" --hostname="$name.example.com" --profile=CentOS-5-x86_64
cobbler system edit --name="$name" --interface=eth0 --mac="$mac0" --bonding=slave --bonding-master=bond0
cobbler system edit --name="$name" --interface=eth1 --mac="$mac1" --bonding=slave --bonding-master=bond0
cobbler system edit --name="$name" --interface=bond0 --bonding=master --bonding-opts="mode=802.3ad miimon=100"
cobbler system edit --name="$name" --interface=bond0 --ip-address="$ipaddr" --static=1 --subnet=255.255.255.0 --gateway=1.2.3.1
#!/bin/bash
set -xe
mac=$1
name=$2
ipaddr=`gethostip -d $name`
cobbler system add --name="$name" --hostname="$name.example.com" --interface=eth0 --mac="$mac" --ip-address="$ipaddr" --static=1 --subnet=255.255.255.0 --gateway=1.2.3.1 --profile=CentOS-5-x86_64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment