-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Lee Reynolds <[email protected]>
- Loading branch information
1 parent
df92b5d
commit 215230d
Showing
3 changed files
with
72 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|