echo "Running Software Installations" # enable chef user to use sudo usermod -aG sudo chef # Activate SSH package # already listed openssh-server to install during preseed #sudo apt-get -y install openssh-server # Fix for E3-1240V3 IPMI Hang sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"/GRUB_CMDLINE_LINUX_DEFAULT="splash"/g' /etc/default/grub sudo update-grub mkdir -pv /etc/systemd/system/networking.service.d/ # fix for long wait for interfaces to come up (in case backend interface is disabled ... it takes 5 minutes to boot) cat > /etc/systemd/system/networking.service.d/override.conf < /etc/snmp/snmpd.conf sed -i 's/ 127.0.0.1//g' /etc/default/snmpd sed -i 's/snmpd.pid/snmpd.pid -c \/etc\/snmp\/snmpd.conf/g' /etc/default/snmpd wget -q -O /dev/null 'http://192.168.200.2/automation/updateKickstartInstallationStatus.php?kickstartInstallationId=72988&securityKey=ipmtbpwgyaopvkjlwzplsgbzojujwuxj&percentComplete=99&message=Completing%20Installation' BACKEND_INTERFACE=$(ip ntable | grep dev | sort | uniq | sed -e 's/^.*dev //;/^lo/d' | head -n 1 | tail -n 1 | xargs) echo detected backend interface name: $BACKEND_INTERFACE FRONTEND_INTERFACE=$(ip ntable | grep dev | sort | uniq | sed -e 's/^.*dev //;/^lo/d' | head -n 2 | tail -n 1 | xargs) # Configure Network echo "# Loopback" > /etc/network/interfaces2 echo "auto lo" >> /etc/network/interfaces2 echo "iface lo inet loopback" >> /etc/network/interfaces2 echo "" >> /etc/network/interfaces2 echo "# Backend Interface" >> /etc/network/interfaces2 echo "auto $BACKEND_INTERFACE" >> /etc/network/interfaces2 echo "iface $BACKEND_INTERFACE inet static" >> /etc/network/interfaces2 echo "address 0.0.0.0" >> /etc/network/interfaces2 echo "netmask 255.255.255.255" >> /etc/network/interfaces2 echo "" >> /etc/network/interfaces2 echo "# Public Interfaces" >> /etc/network/interfaces2 echo "auto $FRONTEND_INTERFACE" >> /etc/network/interfaces2 echo "iface $FRONTEND_INTERFACE inet static" >> /etc/network/interfaces2 echo "address 184.95.54.194" >> /etc/network/interfaces2 echo "netmask 255.255.255.248" >> /etc/network/interfaces2 echo "gateway 184.95.54.193" >> /etc/network/interfaces2 # Name Servers echo "dns-search securedservers.com" >> /etc/network/interfaces2 echo "dns-nameservers 8.8.8.8 8.8.4.4" >> /etc/network/interfaces2 # Startup script echo "mv /etc/network/interfaces2 /etc/network/interfaces" > /root/initializeNetwork.sh echo "/etc/init.d/networking stop; /etc/init.d/networking start" >> /root/initializeNetwork.sh #echo "service networking restart" >> /root/initializeNetwork.sh echo "ifdown --exclude=lo -a && sudo ifup --exclude=lo -a" >> /root/initializeNetwork.sh echo "mv /etc/rc.local.bu /etc/rc.local" >> /root/initializeNetwork.sh echo "chmod +x /etc/rc.local" >> /root/initializeNetwork.sh echo "#rm /root/initializeNetwork.sh" >> /root/initializeNetwork.sh chmod +x /root/initializeNetwork.sh echo "" >> /etc/network/interfaces2 echo "auto $FRONTEND_INTERFACE:1" >> /etc/network/interfaces2 echo "iface $FRONTEND_INTERFACE:1 inet static" >> /etc/network/interfaces2 echo "address 184.95.54.195" >> /etc/network/interfaces2 echo "netmask 255.255.255.248" >> /etc/network/interfaces2 echo "" >> /etc/network/interfaces2 echo "auto $FRONTEND_INTERFACE:2" >> /etc/network/interfaces2 echo "iface $FRONTEND_INTERFACE:2 inet static" >> /etc/network/interfaces2 echo "address 184.95.54.196" >> /etc/network/interfaces2 echo "netmask 255.255.255.248" >> /etc/network/interfaces2 echo "" >> /etc/network/interfaces2 echo "auto $FRONTEND_INTERFACE:3" >> /etc/network/interfaces2 echo "iface $FRONTEND_INTERFACE:3 inet static" >> /etc/network/interfaces2 echo "address 184.95.54.197" >> /etc/network/interfaces2 echo "netmask 255.255.255.248" >> /etc/network/interfaces2 echo "" >> /etc/network/interfaces2 echo "auto $FRONTEND_INTERFACE:4" >> /etc/network/interfaces2 echo "iface $FRONTEND_INTERFACE:4 inet static" >> /etc/network/interfaces2 echo "address 184.95.54.198" >> /etc/network/interfaces2 echo "netmask 255.255.255.248" >> /etc/network/interfaces2 #this should blacklist the mei and mei_me modules as per ticket 848112 - #echo "\n#blacklisting the mei modules\n\n" >> /target/etc/modprobe.d/blacklist.conf #echo "blacklist mei" >> /target/etc/modprobe.d/blacklist.conf #echo "blacklist mei_me" >> /target/etc/modprobe.d/blacklist.conf # Add the startup script to firstboot cp /etc/rc.local /etc/rc.local.bu echo "#!/bin/sh -e" > /etc/rc.local echo "" >> /etc/rc.local echo "/root/initializeNetwork.sh" >> /etc/rc.local echo "exit 0" >> /etc/rc.local chmod +x /etc/rc.local # inject SSH key for user chef messenger "Inserting sshKey to /home/chef/.ssh/authorized_keys" #dir must be 700 file must be 644 or it won't work. mkdir -p -m 755 /home/chef/.ssh chmod 755 /home/chef/.ssh chown chef:chef /home/chef/.ssh echo ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC1IfMy2VAX7pX2nwKCAnah3ri3yTLnpImYuLm1QTr4r/EFHyJU5YfKMhVKbbSN2j2TrrYkJ0aLy4Ht+YtXOhJfXVQNGLAJdcm3DFhwL6LKfTpaMKxBPjCuUuwy1w+ZxWIy1HPbW2DGg2wlE4kccLpRRF28zW0ntF2PdDescwk19V1dU7HeYpjZZ9s2HnMqo6UgR8EIqb6NGeq2K+JpnS4hipO+HAf/HEkAv+h/I5Q3T1OO1LC3/lIav61wkqqin9IWME2RLHSV/N8eyZZRSBsxj2eBAJ94Firz+OmSEFvkR8FtMrKlWcfNFlhMnDprJ6MuShSs0fvrGGNl+DlF0baR chef > /home/chef/.ssh/authorized_keys messenger "sshKey was not provided" chmod 644 /home/chef/.ssh/authorized_keys chown chef:chef /home/chef/.ssh/authorized_keys cat /home/chef/.ssh/authorized_keys | wc -l ls -la /home/chef/.ssh/ # All done here wget --tries=2 -T 30 -O /dev/null 'http://192.168.200.2/automation/completeKickstartInstallation.php?kickstartInstallationId=72988&securityKey=ipmtbpwgyaopvkjlwzplsgbzojujwuxj' echo "Done" #delete this script rm -- "$0"