update cobbler snippets
Change-Id: I74a4c844da915a51cc714c5a30919f5863e7ae26
This commit is contained in:
parent
1f13960afb
commit
41676f96c9
@ -20,6 +20,11 @@ ignore client-updates;
|
||||
set vendorclass = option vendor-class-identifier;
|
||||
|
||||
option pxe-system-type code 93 = unsigned integer 16;
|
||||
option space pxelinux;
|
||||
option pxelinux.magic code 208 = string;
|
||||
option pxelinux.configfile code 209 = text;
|
||||
option pxelinux.pathprefix code 210 = text;
|
||||
option pxelinux.reboottime code 211 = unsigned integer 32;
|
||||
|
||||
subnet $subnet netmask $netmask {
|
||||
option routers $gateway;
|
||||
@ -55,6 +60,13 @@ group {
|
||||
#set iface = $dhcp_tags[$dhcp_tag][$mac]
|
||||
host $iface.name {
|
||||
hardware ethernet $mac;
|
||||
site-option-space "pxelinux";
|
||||
option pxelinux.magic f1:00:74:7e;
|
||||
if exists dhcp-parameter-request-list {
|
||||
# Always send the PXELINUX options (specified in hexadecimal)
|
||||
option dhcp-parameter-request-list = concat(option dhcp-parameter-request-list,d0,d1,d2,d3);
|
||||
}
|
||||
option pxelinux.reboottime 30;
|
||||
#if $iface.hostname:
|
||||
option host-name "$iface.hostname";
|
||||
#end if
|
||||
|
@ -55,7 +55,11 @@ selinux --disabled
|
||||
skipx
|
||||
|
||||
# System Timezone
|
||||
#if $getVar('timezone', '') != ""
|
||||
timezone --utc $timezone
|
||||
#else
|
||||
timezone --utc US/Pacific
|
||||
#end if
|
||||
|
||||
# Install
|
||||
install
|
||||
@ -80,11 +84,10 @@ $SNIPPET('pre_anamon')
|
||||
$SNIPPET('partition_disks')
|
||||
|
||||
# Packages
|
||||
# %packages --ignoremissing --nobase
|
||||
%packages --nobase
|
||||
@core
|
||||
iproute
|
||||
chef-11.8.0-1.el6.x86_64
|
||||
chef
|
||||
ntp
|
||||
openssh-clients
|
||||
wget
|
||||
@ -92,28 +95,21 @@ json-c
|
||||
libestr
|
||||
libgt
|
||||
liblogging
|
||||
rsyslog-7.6.3-1.el6.x86_64
|
||||
rsyslog
|
||||
|
||||
%post --log=/var/log/post_install.log
|
||||
#if $getVar('passwd', '') != ""
|
||||
#set $passwd = $passwd.strip()
|
||||
/usr/sbin/useradd -p '$passwd' $user
|
||||
#end if
|
||||
|
||||
$SNIPPET('post_install_network_config')
|
||||
|
||||
cat << EOF > /etc/yum.conf
|
||||
$SNIPPET('yum.conf')
|
||||
EOF
|
||||
|
||||
chkconfig ntpd on
|
||||
$SNIPPET('ssh')
|
||||
$SNIPPET('ntp')
|
||||
|
||||
chkconfig iptables off
|
||||
chkconfig ip6tables off
|
||||
|
||||
cat << EOF > /etc/ntp.conf
|
||||
$SNIPPET('ntp.conf')
|
||||
EOF
|
||||
|
||||
cat << EOF > /etc/security/limits.conf
|
||||
$SNIPPET('limits.conf')
|
||||
EOF
|
||||
@ -124,13 +120,7 @@ EOF
|
||||
|
||||
sysctl -p
|
||||
|
||||
## $yum_repo_stanza
|
||||
## $yum_config_stanza
|
||||
|
||||
$SNIPPET($tool)
|
||||
|
||||
# rm -rf /etc/yum.repos.d/CentOS-Base.repo
|
||||
|
||||
|
||||
$SNIPPET('post_anamon')
|
||||
$SNIPPET('kickstart_done')
|
||||
|
@ -28,16 +28,22 @@ service rsyslog restart
|
||||
cat << EOF > /etc/chef/firstrun.sh
|
||||
#raw
|
||||
#!/bin/bash
|
||||
touch /tmp/chef.log
|
||||
while true; do
|
||||
pgrep chef-client
|
||||
echo "firstrun chef-client on `date`" &>> /tmp/chef.log
|
||||
clients=\$(pgrep chef-client)
|
||||
if [ "\$?" == "0" ]; then
|
||||
exit 1
|
||||
fi
|
||||
chef-client -L /var/log/chef-client.log &> /tmp/chef.log
|
||||
if [ "\$?" != "0" ]; then
|
||||
sleep 1m
|
||||
echo "there are chef-clients '\$clients' running" &>> /tmp/chef.log
|
||||
sleep 1m
|
||||
else
|
||||
break
|
||||
chef-client -L /var/log/chef-client.log &>> /tmp/chef.log
|
||||
if [ "\$?" != "0" ]; then
|
||||
echo "chef-client run failed" &>> /tmp/chef.log
|
||||
sleep 1m
|
||||
else
|
||||
echo "chef-client run success" &>> /tmp/chef.log
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
#end raw
|
||||
@ -46,32 +52,31 @@ EOF
|
||||
cat << EOF > /etc/chef/rerun.sh
|
||||
#raw
|
||||
#!/bin/bash
|
||||
pgrep chef-client
|
||||
echo "rerun chef-client on `date`" &>> /tmp/chef.log
|
||||
clients=\$(pgrep chef-client)
|
||||
if [ "\$?" == "0" ]; then
|
||||
exit 1
|
||||
echo "there are chef-clients '\$clients' running" &>> /tmp/chef.log
|
||||
exit 1
|
||||
fi
|
||||
chef-client &>> /tmp/chef.log
|
||||
if [ "\$?" != "0" ]; then
|
||||
echo "chef-client run failed" &>> /tmp/chef.log
|
||||
else
|
||||
echo "chef-client run success" &>> /tmp/chef.log
|
||||
fi
|
||||
chef-client &> /tmp/chef.log
|
||||
#end raw
|
||||
EOF
|
||||
|
||||
chmod +x /etc/chef/firstrun.sh
|
||||
chmod +x /etc/chef/rerun.sh
|
||||
|
||||
## A self-destruct service to boot chef client and register cron job
|
||||
cat << EOF > /etc/init.d/chef
|
||||
#!/bin/bash
|
||||
# chkconfig: 2345 95 20
|
||||
# description: Description of the script
|
||||
# processname: chef-agent
|
||||
#if $getVar('ntp_server', '') != ""
|
||||
echo "old date is: \`date\`" 2>&1 > /tmp/ntp.log
|
||||
echo "path: \$PATH" 2>&1 >> /tmp/ntp.log
|
||||
/sbin/service ntpd stop 2>&1 >> /tmp/ntp.log
|
||||
/usr/sbin/ntpdate $server 2>&1 >> /tmp/ntp.log
|
||||
/sbin/service ntpd start 2>&1 >> /tmp/ntp.log
|
||||
echo "new date is: \`date\`" 2>&1 >> /tmp/ntp.log
|
||||
#end if
|
||||
|
||||
chmod +x /etc/chef/firstrun.sh
|
||||
chmod +x /etc/chef/rerun.sh
|
||||
/etc/chef/firstrun.sh &
|
||||
/etc/chef/firstrun.sh
|
||||
|
||||
crontab -l > mycron
|
||||
echo "*/30 * * * * /etc/chef/rerun.sh" >> mycron
|
||||
@ -81,6 +86,5 @@ chkconfig chef off
|
||||
mv /etc/init.d/chef /tmp/chef
|
||||
EOF
|
||||
|
||||
|
||||
chmod +x /etc/init.d/chef
|
||||
chkconfig --level 2345 chef on
|
||||
|
14
cobbler/snippets/ntp
Normal file
14
cobbler/snippets/ntp
Normal file
@ -0,0 +1,14 @@
|
||||
chkconfig ntpd on
|
||||
|
||||
cat << EOF > /etc/ntp.conf
|
||||
$SNIPPET('ntp.conf')
|
||||
EOF
|
||||
|
||||
#if $getVar('ntp_server', '') != ""
|
||||
echo "old date is: \`date\`" 2>&1 > /tmp/ntp.log
|
||||
echo "path: \$PATH" 2>&1 >> /tmp/ntp.log
|
||||
/sbin/service ntpd stop 2>&1 >> /tmp/ntp.log
|
||||
/usr/sbin/ntpdate $ntp_server 2>&1 >> /tmp/ntp.log
|
||||
/sbin/service ntpd start 2>&1 >> /tmp/ntp.log
|
||||
echo "new date is: \`date\`" 2>&1 >> /tmp/ntp.log
|
||||
#end if
|
6
cobbler/snippets/ssh
Normal file
6
cobbler/snippets/ssh
Normal file
@ -0,0 +1,6 @@
|
||||
mkdir -p /root/.ssh
|
||||
chmod 700 -R /root/.ssh
|
||||
cat << EOL >> /root/.ssh/authorized_keys
|
||||
$SNIPPET('id_rsa.pub')
|
||||
EOL
|
||||
chmod 600 /root/.ssh/authorized_keys
|
Loading…
Reference in New Issue
Block a user