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;
|
set vendorclass = option vendor-class-identifier;
|
||||||
|
|
||||||
option pxe-system-type code 93 = unsigned integer 16;
|
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 {
|
subnet $subnet netmask $netmask {
|
||||||
option routers $gateway;
|
option routers $gateway;
|
||||||
@ -55,6 +60,13 @@ group {
|
|||||||
#set iface = $dhcp_tags[$dhcp_tag][$mac]
|
#set iface = $dhcp_tags[$dhcp_tag][$mac]
|
||||||
host $iface.name {
|
host $iface.name {
|
||||||
hardware ethernet $mac;
|
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:
|
#if $iface.hostname:
|
||||||
option host-name "$iface.hostname";
|
option host-name "$iface.hostname";
|
||||||
#end if
|
#end if
|
||||||
|
@ -55,7 +55,11 @@ selinux --disabled
|
|||||||
skipx
|
skipx
|
||||||
|
|
||||||
# System Timezone
|
# System Timezone
|
||||||
|
#if $getVar('timezone', '') != ""
|
||||||
|
timezone --utc $timezone
|
||||||
|
#else
|
||||||
timezone --utc US/Pacific
|
timezone --utc US/Pacific
|
||||||
|
#end if
|
||||||
|
|
||||||
# Install
|
# Install
|
||||||
install
|
install
|
||||||
@ -80,11 +84,10 @@ $SNIPPET('pre_anamon')
|
|||||||
$SNIPPET('partition_disks')
|
$SNIPPET('partition_disks')
|
||||||
|
|
||||||
# Packages
|
# Packages
|
||||||
# %packages --ignoremissing --nobase
|
|
||||||
%packages --nobase
|
%packages --nobase
|
||||||
@core
|
@core
|
||||||
iproute
|
iproute
|
||||||
chef-11.8.0-1.el6.x86_64
|
chef
|
||||||
ntp
|
ntp
|
||||||
openssh-clients
|
openssh-clients
|
||||||
wget
|
wget
|
||||||
@ -92,28 +95,21 @@ json-c
|
|||||||
libestr
|
libestr
|
||||||
libgt
|
libgt
|
||||||
liblogging
|
liblogging
|
||||||
rsyslog-7.6.3-1.el6.x86_64
|
rsyslog
|
||||||
|
|
||||||
%post --log=/var/log/post_install.log
|
%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')
|
$SNIPPET('post_install_network_config')
|
||||||
|
|
||||||
cat << EOF > /etc/yum.conf
|
cat << EOF > /etc/yum.conf
|
||||||
$SNIPPET('yum.conf')
|
$SNIPPET('yum.conf')
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
chkconfig ntpd on
|
$SNIPPET('ssh')
|
||||||
|
$SNIPPET('ntp')
|
||||||
|
|
||||||
chkconfig iptables off
|
chkconfig iptables off
|
||||||
chkconfig ip6tables off
|
chkconfig ip6tables off
|
||||||
|
|
||||||
cat << EOF > /etc/ntp.conf
|
|
||||||
$SNIPPET('ntp.conf')
|
|
||||||
EOF
|
|
||||||
|
|
||||||
cat << EOF > /etc/security/limits.conf
|
cat << EOF > /etc/security/limits.conf
|
||||||
$SNIPPET('limits.conf')
|
$SNIPPET('limits.conf')
|
||||||
EOF
|
EOF
|
||||||
@ -124,13 +120,7 @@ EOF
|
|||||||
|
|
||||||
sysctl -p
|
sysctl -p
|
||||||
|
|
||||||
## $yum_repo_stanza
|
|
||||||
## $yum_config_stanza
|
|
||||||
|
|
||||||
$SNIPPET($tool)
|
$SNIPPET($tool)
|
||||||
|
|
||||||
# rm -rf /etc/yum.repos.d/CentOS-Base.repo
|
|
||||||
|
|
||||||
|
|
||||||
$SNIPPET('post_anamon')
|
$SNIPPET('post_anamon')
|
||||||
$SNIPPET('kickstart_done')
|
$SNIPPET('kickstart_done')
|
||||||
|
@ -28,16 +28,22 @@ service rsyslog restart
|
|||||||
cat << EOF > /etc/chef/firstrun.sh
|
cat << EOF > /etc/chef/firstrun.sh
|
||||||
#raw
|
#raw
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
touch /tmp/chef.log
|
||||||
while true; do
|
while true; do
|
||||||
pgrep chef-client
|
echo "firstrun chef-client on `date`" &>> /tmp/chef.log
|
||||||
|
clients=\$(pgrep chef-client)
|
||||||
if [ "\$?" == "0" ]; then
|
if [ "\$?" == "0" ]; then
|
||||||
exit 1
|
echo "there are chef-clients '\$clients' running" &>> /tmp/chef.log
|
||||||
fi
|
sleep 1m
|
||||||
chef-client -L /var/log/chef-client.log &> /tmp/chef.log
|
|
||||||
if [ "\$?" != "0" ]; then
|
|
||||||
sleep 1m
|
|
||||||
else
|
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
|
fi
|
||||||
done
|
done
|
||||||
#end raw
|
#end raw
|
||||||
@ -46,32 +52,31 @@ EOF
|
|||||||
cat << EOF > /etc/chef/rerun.sh
|
cat << EOF > /etc/chef/rerun.sh
|
||||||
#raw
|
#raw
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
pgrep chef-client
|
echo "rerun chef-client on `date`" &>> /tmp/chef.log
|
||||||
|
clients=\$(pgrep chef-client)
|
||||||
if [ "\$?" == "0" ]; then
|
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
|
fi
|
||||||
chef-client &> /tmp/chef.log
|
|
||||||
#end raw
|
#end raw
|
||||||
EOF
|
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
|
## A self-destruct service to boot chef client and register cron job
|
||||||
cat << EOF > /etc/init.d/chef
|
cat << EOF > /etc/init.d/chef
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# chkconfig: 2345 95 20
|
# chkconfig: 2345 95 20
|
||||||
# description: Description of the script
|
# description: Description of the script
|
||||||
# processname: chef-agent
|
# processname: chef-agent
|
||||||
#if $getVar('ntp_server', '') != ""
|
/etc/chef/firstrun.sh
|
||||||
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 &
|
|
||||||
|
|
||||||
crontab -l > mycron
|
crontab -l > mycron
|
||||||
echo "*/30 * * * * /etc/chef/rerun.sh" >> mycron
|
echo "*/30 * * * * /etc/chef/rerun.sh" >> mycron
|
||||||
@ -81,6 +86,5 @@ chkconfig chef off
|
|||||||
mv /etc/init.d/chef /tmp/chef
|
mv /etc/init.d/chef /tmp/chef
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|
||||||
chmod +x /etc/init.d/chef
|
chmod +x /etc/init.d/chef
|
||||||
chkconfig --level 2345 chef on
|
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