It is possible to switch on /dev/tty[2-6] on admin node during bootstraping

This commit is contained in:
Vladimir Kozhukalov 2013-01-16 14:06:30 +04:00
parent fa52366fe4
commit 17919f84f4
7 changed files with 61 additions and 11 deletions

View File

@ -0,0 +1,17 @@
#
# This service starts bootstrap_admin_node.sh script
# which launches puppet but only if /etc/sysconfig/bootstrap_admin_node file exists.
#
start on stopped start-ttys
task
console output
script
. /etc/sysconfig/bootstrap_admin_node
if test "${ENABLED}" = "1"; then
echo "ENABLED=0" > /etc/sysconfig/bootstrap_admin_node
/usr/local/sbin/bootstrap_admin_node.sh | tee /var/log/puppet/bootstrap_admin_node.log
fi
initctl start tty TTY=/dev/tty1
end script

View File

@ -1,8 +1,6 @@
#!/bin/bash
puppet apply --modulepath=/opt/nailgun_puppet /opt/nailgun_puppet/nailgun/examples/site.pp 2>&1 | tee /var/log/puppet/firstboot.log
puppet apply --modulepath=/opt/nailgun_puppet /opt/nailgun_puppet/nailgun/examples/site.pp
puppet apply -e 'class {puppetdb:}'
sed -i -e s/8080/8082/ /etc/puppetdb/conf.d/jetty.ini
puppet apply -e 'class {puppetdb::master::config: puppet_service_name=>"puppetmaster"}'
sed -i --follow-symlinks "/bootstrap_admin_node.sh/d" /etc/rc.local

View File

@ -35,7 +35,7 @@ if [ ${numdrives} -gt 1 ]; then
echo '* W A R N I N G *'
echo '* *'
echo '* Which of the detected hard drives do you want to be used as *'
echo '* installation target. *'
echo '* installation target? *'
echo '* *'
echo '********************************************************************************'
echo
@ -233,10 +233,12 @@ EOF
# Disable GSSAPI in ssh server config
sed -i -e "/^\s*GSSAPICleanupCredentials yes/d" -e "/^\s*GSSAPIAuthentication yes/d" /etc/ssh/sshd_config
# Copying bootstrap_admin_node.sh , chmod it and adding to the rc.local to run it once
# Copying bootstrap_admin_node.sh, chmod it and
# adding /etc/init/bootstrap_admin_node.conf
cp ${SOURCE}/bootstrap_admin_node.sh /usr/local/sbin/bootstrap_admin_node.sh
chmod 0777 /usr/local/sbin/bootstrap_admin_node.sh
echo "/usr/local/sbin/bootstrap_admin_node.sh" >> /etc/rc.local
cp ${SOURCE}/bootstrap_admin_node.conf /etc/init/bootstrap_admin_node.conf
echo "ENABLED=1" > /etc/sysconfig/bootstrap_admin_node
# Prepare custom /etc/issue logon banner and script for changing IP in it
cat > /etc/issue << EOF
@ -279,9 +281,12 @@ sed -i /etc/rc.d/init.d/ntpdate -e 's/\([ $RETVAL -eq 0 ] && success || \)failur
sed -i --follow-symlinks -e '/^\skernel/ s/rhgb//' /etc/grub.conf
sed -i --follow-symlinks -e '/^\skernel/ s/quiet//' /etc/grub.conf
# Disabling first console clearing
# Disabling console clearing
sed -i 's/getty/getty --noclear/' /etc/init/tty.conf
# Disabling starting first console from start-ttys service
sed -i --follow-symlinks -e 's/ACTIVE_CONSOLES=.*/ACTIVE_CONSOLES=\/dev\/tty\[2-6\]/' /etc/sysconfig/init
# Copying default bash settings to the root directory
cp -f /etc/skel/.bash* /root/

View File

@ -48,7 +48,8 @@ $/isoroot-prepare.done: \
$(addprefix $(ISOROOT)/images/,$(IMAGES_FILES)) \
$(addprefix $(ISOROOT)/EFI/BOOT/,$(EFI_FILES)) \
$(ISOROOT)/ks.cfg \
$(ISOROOT)/bootstrap_admin_node.sh
$(ISOROOT)/bootstrap_admin_node.sh \
$(ISOROOT)/bootstrap_admin_node.conf
$(ACTION.TOUCH)
$/isoroot-bootstrap.done: \
@ -107,6 +108,7 @@ $/isoroot-puppetmod.done: \
$(ISOROOT)/ks.cfg: iso/ks.cfg ; $(ACTION.COPY)
$(ISOROOT)/bootstrap_admin_node.sh: iso/bootstrap_admin_node.sh ; $(ACTION.COPY)
$(ISOROOT)/bootstrap_admin_node.conf: iso/bootstrap_admin_node.conf ; $(ACTION.COPY)
$(ISOROOT)/.discinfo: iso/.discinfo ; $(ACTION.COPY)
$(ISOROOT)/.treeinfo: iso/.treeinfo ; $(ACTION.COPY)

View File

@ -175,6 +175,14 @@ class nailgun::cobbler(
require => Class["cobbler::server"],
}
file {"/var/lib/cobbler/snippets/pre_install_partition":
content => template("nailgun/cobbler/pre_install_partition.snippet.erb"),
owner => root,
group => root,
mode => 0644,
require => Class["cobbler::server"],
}
file { "/var/lib/cobbler/snippets/nailgun_repo":
content => template("nailgun/cobbler/nailgun_repo.snippet.erb"),
owner => root,

View File

@ -43,7 +43,7 @@ skipx
# --driveorder=sda,hda
# APPEND STRING TO KERNEL BOOT COMMAND
# --append=""
bootloader --location=mbr --driveorder=sda,hda --append=" crashkernel=auto"
%include /tmp/bootloader.ks
# PARTITIONING
# CLEAN ANY INVALID PARTITION TABLE
@ -52,8 +52,8 @@ zerombr
# REMOVE ALL PARTITIONS BEFORE CREATING NEW ONES
clearpart --all --initlabel
# AUTOMATICALLY CREATE / /boot AND swap PARTITIONS
autopart
# AUTOMATICALLY CREATE / AND swap PARTITIONS
%include /tmp/partition.ks
# COBBLER EMBEDDED SNIPPET: 'network_config'
# CONFIGURES NETWORK INTERFACES DEPENDING ON
@ -90,6 +90,10 @@ $SNIPPET('kickstart_start')
# INTO KICKSTART BY 'network_config' SNIPPET
$SNIPPET('pre_install_network_config')
# COBBLER EMBEDDED SNIPPET: 'pre_install_partition'
# DETECTS HARD DRIVES AND SETS FIRST OF THEM
# AS INSTALLATION TARGET AND BOOTLOADER INSTALLATION TARGET
$SNIPPET('pre_install_partition')
# PACKAGES SECTION
# HERE ARE LIST OF PACKAGES THAT WILL BE INSTALLED

View File

@ -0,0 +1,16 @@
# hard drives
tgtdrive="undefined"
for drv in `ls -1 /sys/block | grep "sd\|hd"`; do
if (grep -q 0 /sys/block/${drv}/removable); then
tgtdrive="${drv}"
break
fi
done
# bootloader
echo "bootloader --location=mbr --driveorder=${tgtdrive} --append=' crashkernel=auto'" > /tmp/bootloader.ks
# partition
echo "partition / --fstype=ext4 --ondisk=${tgtdrive} --size=1 --grow --asprimary" > /tmp/partition.ks
echo "partition swap --recommended --ondisk=${tgtdrive}" >> /tmp/partition.ks