Skip to content

Commit

Permalink
cobbler pxe loop fix and utils
Browse files Browse the repository at this point in the history
Signed-off-by: Lee Reynolds <[email protected]>
  • Loading branch information
leereyno-asu committed May 17, 2021
1 parent df92b5d commit 215230d
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 1 deletion.
9 changes: 8 additions & 1 deletion appliance/roles/provision/files/temp_centos7.ks
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,11 @@ reboot
%packages
@core
net-tools
%end
%end

%post
$SNIPPET('post_install_kernel_options')
$SNIPPET('cobbler_register')
$SNIPPET('kickstart_done')
%end

44 changes: 44 additions & 0 deletions cobbler_utils/create_system_profiles.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash

if [ $# -lt 1 ] ; then
echo -e "\nNeed mapping file\n"
echo -e "e.g. $(basename $0) mapping.csv\n"
exit 1
fi

MAPPING=$1

if [ ! -e $MAPPING ] ; then
echo -e "\nMapping file $MAPPING does not exist\n"
exit 1
fi

if [ ! -d profiles ] ; then
mkdir profiles
fi

echo -e "#!/bin/bash\n" > profiles/addall.sh

for profile in $(cat $MAPPING | grep -v ^MAC) ; do

MAC=$(echo $profile | cut -d "," -f 1 )
HOSTNAME=$(echo $profile | cut -d "," -f 2 )
IPADDR=$(echo $profile | cut -d "," -f 3 )
OUTFILE=${HOSTNAME}.sh

cat template.sh \
| sed -e "s/^HOSTNAME=/HOSTNAME=\"$HOSTNAME\"/" \
-e "s/^IPADDR=/IPADDR=\"$IPADDR\"/" \
-e "s/^MAC=/MAC=\"$MAC\"/" > profiles/$OUTFILE

echo "./$OUTFILE" >> profiles/addall.sh

chmod 755 profiles/$OUTFILE

done

echo -e "\ncobbler sync\n" >> profiles/addall.sh

chmod 755 profiles/addall.sh


20 changes: 20 additions & 0 deletions cobbler_utils/template.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

HOSTNAME=
IPADDR=
MAC=
INTERFACE="em1"
PROFILE="CentOS7-x86_64"

cobbler system remove --name=$HOSTNAME 2>&1 > /dev/null

cobbler system add --name=$HOSTNAME --hostname=$HOSTNAME --profile=$PROFILE

cobbler system edit --name=$HOSTNAME --interface=$INTERFACE --mac=$MAC

cobbler system edit --name=$HOSTNAME --kopts="ksdevice=$MAC nomodeset consoleblank=0"

cobbler system edit --name=$HOSTNAME --kopts-post="nomodeset consoleblank=0"

#cobbler sync

0 comments on commit 215230d

Please sign in to comment.