DREN/Kickstart/snippets

From DER's LLC
Revision as of 19:30, 2 June 2023 by Admin (talk | contribs)
Jump to navigation Jump to search

AddADGroups

#raw
printf " Adding AD Groups:                                                           "
/bin/bash /tmp/status.sh &

groupadd domain_users -g 1342600513

STATUSPID=`ps -ef | grep status| egrep -v grep | head -1 | awk '{print $2}'`
kill $STATUSPID
printf "\b\b\b\b\b\b\b\b"
echo -e "[  \e[1;32mOK\e[0;39m  ]"
#end raw

AddAcasUser

#raw
printf " Creating ACAS Scan User:                                                    "
/bin/bash /tmp/status.sh &

useradd scan_account -g users
sudo -u scan_account ssh-keygen -b 2048 -t rsa -f /home/scan_account/.ssh/id_rsa -q -N ""
sudo -u scan_account rm -rf /home/scan_account/.ssh/id_rsa 
sudo -u scan_account curl --cacert /usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT https://rdhpwngmp-01/pub/kickstart/nga_acas.pub >  /home/scan_account/.ssh/authorized_keys

STATUSPID=`ps -ef | grep status| egrep -v grep | head -1 | awk '{print $2}'`
kill $STATUSPID
printf "\b\b\b\b\b\b\b\b"
echo -e "[  \e[1;32mOK\e[0;39m  ]"
#end raw

AddMounts

#raw
printf " Adding NFS Mounts:                                                          "
/bin/bash /tmp/status.sh &

mkdir -p /users
chown :domain_users /users
chmod 775 /users
mkdir -p /data
chown :domain_users /data
chmod 775 /data
echo 'users:/users  /users  nfs noauto,x-systemd.automount,x-systemd.device-timeout=10,timeo=14,relatime    0 0' >> /etc/fstab
echo 'data:/data  /data  nfs noauto,x-systemd.automount,x-systemd.device-timeout=10,timeo=14,relatime    0 0' >> /etc/fstab

STATUSPID=`ps -ef | grep status| egrep -v grep | head -1 | awk '{print $2}'`
kill $STATUSPID
printf "\b\b\b\b\b\b\b\b"
echo -e "[  \e[1;32mOK\e[0;39m  ]"
#end raw

AddScaleUser

#raw
printf " Creating Scale User:                                                    "
/bin/bash /tmp/status.sh &

useradd scale -u 7498 -g 1342600513 -G users
sed -i 's~scale:!!:~scale:$6$hQ5XU8FI$BFssO833kwMzahuVXMnMO9qReK4VRAXtMKRL/csxtJoFtj7Wgc9twzp6E79jw8y.U/JfSqMhzMafhijnISiyh1:~' /etc/shadow

STATUSPID=`ps -ef | grep status| egrep -v grep | head -1 | awk '{print $2}'`
kill $STATUSPID
printf "\b\b\b\b\b\b\b\b"
echo -e "[  \e[1;32mOK\e[0;39m  ]"
#end raw

AddSpacewalkToHosts

#raw
printf " Adding Spacewalk server to /etc/hosts:                                              "
/bin/bash /tmp/status.sh &
curl http://140.32.192.51/pub/kickstart/hosts > /mnt/sysimage/etc/hosts
curl http://140.32.192.51/pub/kickstart/hosts > /etc/hosts
STATUSPID=`ps -ef | grep status| egrep -v grep | head -1 | awk '{print $2}'`
kill $STATUSPID
printf "\b\b\b\b\b\b\b\b"
echo -e "[  \e[1;32mOK\e[0;39m  ]"
#end raw

ForceTime

printf " Forcing Time Synce with NTP Server:                                         "
/bin/bash /tmp/status.sh &
ntpdate -s 140.32.191.249
STATUSPID=`ps -ef | grep status| egrep -v grep | head -1 | awk '{print $2}'`
kill $STATUSPID
printf "\b\b\b\b\b\b\b\b"
echo -e "[  \e[1;32mOK\e[0;39m  ]"

InstallDCOSMaster

#raw
printf " Installing DCOS Master:                                                     "
/bin/bash /tmp/status.sh &
#end raw
$SNIPPET('spacewalk/1/InstallDCOSPrereqs')
#raw
# This is needed for using the dcos command with jenkins 
yum -y install expect &> /dev/null

# Creating installDCOS.sh script 
echo "#CHECK=\`systemctl is-active docker\`"  > /root/installDCOS.sh
echo "#while \$CHECK != 'active' ; do sleep 5; CHECK=\`systemctl is-active docker\`;done"  >> /root/installDCOS.sh
echo "/bin/bash /tmp/dcos/dcos_install.sh master" >> /root/installDCOS.sh
echo "mkdir -p /var/log/mesos/archive" >> /root/installDCOS.sh
echo "echo 'ENABLE_CHECK_TIME=false' >> /opt/mesosphere/environment" >> /root/installDCOS.sh
echo "#sleep 6000" >> /root/installDCOS.sh
echo "#rm -rf /root/installDCOS.sh" >> /root/installDCOS.sh
echo "sed -i 's/\/bin\/bash\ \/root\/installDCOS.sh//g' /etc/rc.d/rc.local" >> /root/installDCOS.sh
echo "sed -i 's~LD_LIBRARY_PATH=/opt/mesosphere/lib~LD_LIBRARY_PATH=/lib64~' /opt/mesosphere/environment.export"  >> /root/installDCOS.sh
echo "curl -fLsS --retry 20 -Y 100000 -y 60 https://downloads.dcos.io/binaries/cli/linux/x86-64/dcos-1.8/dcos -o dcos"  >> /root/installDCOS.sh
echo "mv dcos /usr/local/bin"  >> /root/installDCOS.sh
echo "chmod +x /usr/local/bin/dcos"  >> /root/installDCOS.sh
echo "dcos config set core.dcos_url http://172.16.99.200"  >> /root/installDCOS.sh

chmod 777 /root/installDCOS.sh
echo "/bin/bash /root/installDCOS.sh" >> /etc/rc.d/rc.local
chmod +x /etc/rc.d/rc.local

STATUSPID=`ps -ef | grep status| egrep -v grep | head -1 | awk '{print $2}'`
kill $STATUSPID
printf "\b\b\b\b\b\b\b\b"
echo -e "[  \e[1;32mOK\e[0;39m  ]"
#end raw

InstallDCOSPrereqs

echo "proxy=http://192.168.1.73:3128" >> /etc/yum.conf
yum -y install ipset tar xz unzip curl docker docker-selinux &> /dev/null
yum -y upgrade &> /dev/null

grep -q Restart=on-failure /usr/lib/systemd/system/docker.service && printf 'Restart function is already set in systemd script' || sed -i '/MountFlags=slave/aRestart=on-failure' /usr/lib/systemd/system/docker.service
rhncfg-client get
systemctl daemon-reload  
systemctl enable docker.service
systemctl start docker.service

# DCOS requires this firewall to be shut off.
## https://docs.mesosphere.com/1.7/administration/installing/custom/system-requirements/
systemctl disable firewalld
systemctl stop firewalld

mkdir -p /var/{lib,log}/mesos
chown nobody /var/{lib,log}/mesos
touch /var/marathon.ip
chown /var/marathon.ip

groupadd nogroup -g 9999
groupadd docker

yum -y remove dnsmasq &> /dev/null
PIDS=`ps -ef | grep dnsmasq | egrep -v grep | awk '{ print $2 }'`
kill $PIDS
mkdir -p /tmp/dcos && cd /tmp/dcos
#curl -s http://140.32.192.51/dcos/install/genconf/serve/dcos_install.sh > dcos_install.sh
curl -s http://192.168.1.73:81/dcos/genconf/serve/dcos_install.sh > dcos_install.sh

InstallDCOSSlave

InstallDesktopPackages

InstallVMTools

JoinAD

PostNoChroot-InstallNetworking

PreScript Get-Hostname-Network

RemoveNetworkManager

SetHostname

SetupFiglet

SetupNTP

| SetupPuppetAgent

| StatusBarScript

| SwitchToTTY1

| SwitchToTTY7

| UpdateAllRPMs