remove unused snippets

Change-Id: Ibee01d3260900acd9a2330803cf11e030f2be0a9
This commit is contained in:
xiaodongwang 2014-05-20 13:49:57 -07:00
parent ae44332c69
commit c4f81a709e
22 changed files with 28 additions and 849 deletions

View File

@ -86,6 +86,8 @@ liblogging
rsyslog
%post --log=/var/log/post_install.log
$SNIPPET('log_ks_post')
$SNIPPET('kickstart_post_install_kernel_options')
$SNIPPET('kickstart_post_install_network_config')
chkconfig iptables off

View File

@ -1,73 +0,0 @@
## Generate client.rb
mkdir -p /etc/chef
## Generate validation.pem
cat << EOL > /etc/chef/validation.pem
$SNIPPET('chef-validator.pem')
EOL
cat << EOL > /etc/chef/client.rb
$SNIPPET('client.rb')
EOL
## Generate first-boot.json
cat << EOL > /etc/chef/first-boot.json
$SNIPPET('first-boot.json')
EOL
## Register Server in Rsyslog
cat << EOL > /etc/rsyslog.d/chef.conf
$SNIPPET('rsyslogchef')
EOL
cat << EOL > /etc/rsyslog.conf
$SNIPPET('rsyslogconf')
EOL
service rsyslog restart
cat << EOF > /etc/chef/rerun.sh
#raw
#!/bin/bash
pgrep chef-client
if [ "\$?" != "0" ]; then
chef-client -p /var/run/chef-client.pid -j /etc/chef/first-boot.json &> /tmp/chef.log
fi
#end raw
EOF
## 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>71 >> /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
/etc/chef/rerun.sh
chmod +x /etc/chef/rerun.sh
crontab -l > mycron
echo "*/1 * * * * /etc/chef/rerun.sh" >> mycron
crontab mycron
rm mycron
chkconfig chef off
rm -rf /etc/init.d/chef
EOF
chmod +x /etc/init.d/chef
chkconfig --level 2345 chef on

View File

@ -1,15 +0,0 @@
log_level :info
log_location '/var/log/chef-client.log'
#if $getVar('chef_url', '') != ""
chef_server_url '$chef_url'
#end if
#if $getVar('proxy', '') != ""
http_proxy '$proxy'
https_proxy '$proxy'
#end if
#if $getVar('ignore_proxy', '') != ""
no_proxy '$ignore_proxy'
#end if
validation_client_name 'chef-validator'
# Using default node name (fqdn)

View File

@ -1,10 +1,20 @@
## A self-destruct service to boot chef client and register cron job
#if $getVar('ntp_server', '') != ""
#set $ntp_server = '0.centos.pool.ntp.org'
#end if
cat << EOF > /etc/init.d/chef
#raw
#!/bin/bash
# chkconfig: 2345 99 20
# description: Description of the script
# processname: chef-agent
#end raw
echo "old date is: `date`" 2>&1 > /tmp/ntp.log
service ntpd stop 2>&1 >> /tmp/ntp.log
ntpdate $ntp_server 2>&1 >> /tmp/ntp.log
service ntpd start 2>&1 >> /tmp/ntp.log
echo "new date is: `date`" 2>&1 >> /tmp/ntp.log
rm -rf /var/lib/rsyslog/firstboot_log
service rsyslog restart
/etc/chef/firstrun.sh
@ -15,7 +25,6 @@ crontab /tmp/mycron
rm /tmp/mycron
chkconfig chef off
mv /etc/init.d/chef /tmp/chef
#end raw
EOF
chmod +x /etc/init.d/chef

View File

@ -1,6 +1,6 @@
cat << EOL > /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
127.0.0.1 $system_name localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 $system_name localhost localhost.localdomain localhost6 localhost6.localdomain6
#for $iname, $idata in $interfaces.items()
#if $hostname and $idata["management"] and $idata["static"] and $idata.get("ip_address", "") != ""
$idata["ip_address"] $hostname

View File

@ -1,5 +1,6 @@
#if $getVar('ntp_server', '') != ""
#set $ntp_server = '0.centos.pool.ntp.org'
#end if
chkconfig ntpd on
cat << EOF > /etc/ntp.conf
@ -69,12 +70,3 @@ keys /etc/ntp/keys
# Enable writing of statistics records.
# statistics clockstats cryptostats loopstats peerstats
EOF
chkconfig ntpd on
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

View File

@ -1,7 +0,0 @@
## start of cobbler network_config generated code
#if $getVar("system_name","") != ""
# Using "new" style networking config, by matching networking information to the physical interface's
# MAC-address
%include /tmp/pre_install_network_config
#end if
## end of cobbler network_config generated code

View File

@ -1,63 +0,0 @@
# For more information about this file, see the man pages
# ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5).
driftfile /var/lib/ntp/drift
# Permit time synchronization with our time source, but do not
# permit the source to query or modify the service on this system.
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
# Permit all access over the loopback interface. This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
restrict 127.0.0.1
restrict -6 ::1
# Hosts on local network are less restricted.
# restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
# server 0.centos.pool.ntp.org
# server 1.centos.pool.ntp.org
# server 2.centos.pool.ntp.org
#if $getVar('ntp_server', '') != ""
server $ntp_server
#end if
# broadcast 192.168.1.255 autokey # broadcast server
# broadcastclient # broadcast client
# broadcast 224.0.1.1 autokey # multicast server
# multicastclient 224.0.1.1 # multicast client
# manycastserver 239.255.254.254 # manycast server
# manycastclient 239.255.254.254 autokey # manycast client
# Undisciplined Local Clock. This is a fake driver intended for backup
# and when no outside source of synchronized time is available.
server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10
# Enable public key cryptography.
# crypto
includefile /etc/ntp/crypto/pw
# Key file containing the keys and key identifiers used when operating
# with symmetric key cryptography.
keys /etc/ntp/keys
# Specify the key identifiers which are trusted.
# trustedkey 4 8 42
# Specify the key identifier to use with the ntpdc utility.
# requestkey 8
# Specify the key identifier to use with the ntpq utility.
# controlkey 8
# Enable writing of statistics records.
# statistics clockstats cryptostats loopstats peerstats
# make ntpdate using the server in conf to update the system time.
NTPDATE_USE_NTP_CONF=yes

View File

@ -1,46 +0,0 @@
#set hostname=$getVar('$hostname',None)
#set partition = $getVar('$partition', None)
#if $hostname == None
#set $vgname = "VolGroup00"
#else
#set $vgname = $hostname.split('.')[0]
#end if
set \$(list-harddrives)
let numd=\$#/2
d1=\$1
d2=\$3
echo "clearpart --all --initlabel" > /tmp/part-include
echo "part /boot --fstype ext3 --size=100 --ondisk=\$d1 --asprimary" >> /tmp/part-include
echo "part swap --recommended --ondisk=\$d1" >> /tmp/part-include
echo "part pv.01 --size=1 --grow --ondisk=\$d1" >> /tmp/part-include
# if [ "$numd" == "2" ]
# echo "part pv.02 --size=1 --glow --ondisk=\$d2" >> /tmp/part-include
# echo "volgroup $vgname pv.01 pv.02" >> /tmp/part-include
# else
echo "volgroup $vgname pv.01" >> /tmp/part-include
# fi
echo "logvol / --fstype ext3 --vgname=$vgname --size=1 --grow --percent=30 --name=rootvol" >> /tmp/part-include
#if $partition != None
#set vol_sizes = [part.strip() for part in $partition.split(';') if part.strip()]
#for vol_and_size in vol_sizes
#set vol, vol_size = $vol_and_size.split(' ', 1)
#set vol = $vol.strip()
#set vol_size = $vol_size.strip()
#if $vol.startswith('/')
#set volname = $vol[1:]
#if $vol_size.endswith('%'):
#set vol_percent = vol_size[:-1]
echo "logvol $vol --fstype ext3 --vgname=$vgname --size=1 --grow --percent=$vol_percent --name=${volname}vol" >> /tmp/part-include
#else
echo "logvol $vol --vgname=$vgname --fstype ext3 --size=$vol_size --name=${volname}vol" >> /tmp/part-include
#end if
#else
# $vol is not starts with /
#end if
#end for
#end if

View File

@ -1,34 +0,0 @@
%include /tmp/partinfo
%pre
# Determine how many drives we have
set \$(list-harddrives)
let numd=\$#/2
d1=\$1
d2=\$3
# Determine architecture-specific partitioning needs
EFI_PART=""
PPC_PREP_PART=""
BOOT_PART=""
case \$(uname -m) in
ia64)
EFI_PART="part /boot/efi --fstype vfat --size 200 --recommended"
;;
ppc*)
PPC_PREP_PART="part None --fstype 'PPC PReP Boot' --size 8"
BOOT_PART="part /boot --fstype ext3 --size 200 --recommended"
;;
*)
BOOT_PART="part /boot --fstype ext3 --size 200 --recommended"
;;
esac
cat << EOF > /tmp/partinfo
\$EFI_PART
\$PPC_PREP_PART
\$BOOT_PART
part / --fstype ext3 --size=1024 --grow --ondisk=\$d1 --asprimary
part swap --recommended --ondisk=\$d1 --asprimary
EOF

View File

@ -1,23 +0,0 @@
#if $str($getVar('anamon_enabled','')) == "1"
## install anamon script
wget -O /usr/local/sbin/anamon "http://$server:$http_port/cobbler/aux/anamon"
## install anamon system service
wget -O /etc/rc.d/init.d/anamon "http://$server:$http_port/cobbler/aux/anamon.init"
## adjust permissions
chmod 755 /etc/rc.d/init.d/anamon /usr/local/sbin/anamon
test -d /selinux && restorecon /etc/rc.d/init.d/anamon /usr/local/sbin/anamon
## enable the script
chkconfig --add anamon
## configure anamon service
cat << __EOT__ > /etc/sysconfig/anamon
COBBLER_SERVER="$server"
COBBLER_PORT="$http_port"
COBBLER_NAME="$name"
LOGFILES="/var/log/boot.log /var/log/messages /var/log/dmesg"
__EOT__
#end if

View File

@ -1,345 +0,0 @@
# Start post_install_network_config generated code
#if $getVar('promisc_nics', '') != ""
#set promisc_interfaces = [promisc.strip() for promisc in $promisc_nics.split(',') if promisc.strip()]
#else
#set promisc_interfaces = []
#end if
#if $getVar("system_name","") != ""
## this is being provisioned by system records, not profile records
## so we can do the more complex stuff
## get the list of interface names
#set ikeys = $interfaces.keys()
#set osversion = $getVar("os_version","")
#import re
#set $vlanpattern = $re.compile("[a-zA-Z0-9]+[\.:][0-9]+")
## Determine if we should use the MAC address to configure the interfaces first
## Only physical interfaces are required to have a MAC address
## Also determine the number of bonding devices we have, so we can set the
## max-bonds option in modprobe.conf accordingly. -- jcapel
#set $configbymac = True
#set $numbondingdevs = 0
#set $enableipv6 = False
## =============================================================================
#for $iname in $ikeys
## look at the interface hash data for the specific interface
#set $idata = $interfaces[$iname]
## do not configure by mac address if we don't have one AND it's not for bonding/vlans
## as opposed to a "real" physical interface
#if $idata.get("mac_address", "") == "" and not $vlanpattern.match($iname) and not $idata.get("interface_type", "").lower() in ("master","bond","bridge"):
## we have to globally turn off the config by mac feature as we can't
## use it now
#set $configbymac = False
#end if
## count the number of bonding devices we have.
#if $idata.get("interface_type", "").lower() in ("master","bond","bonded_bridge_slave")
#set $numbondingdevs += 1
#end if
## enable IPv6 networking if we set an ipv6 address or turn on autoconfiguration
#if $idata.get("ipv6_address", "") != "" or $ipv6_autoconfiguration == True
#set $enableipv6 = True
#end if
#end for
## end looping through the interfaces to see which ones we need to configure.
## =============================================================================
#set $i = 0
## setup bonding if we have to
#if $numbondingdevs > 0
# we have bonded interfaces, so set max_bonds
if [ -f "/etc/modprobe.conf" ]; then
echo "options bonding max_bonds=$numbondingdevs" >> /etc/modprobe.conf
fi
#end if
## =============================================================================
## create a staging directory to build out our network scripts into
## make sure we preserve the loopback device
# create a working directory for interface scripts
mkdir /etc/sysconfig/network-scripts/cobbler
cp /etc/sysconfig/network-scripts/ifcfg-lo /etc/sysconfig/network-scripts/cobbler/
## =============================================================================
## configure the gateway if set up (this is global, not a per-interface setting)
#if $gateway != ""
# set the gateway in the network configuration file
grep -v GATEWAY /etc/sysconfig/network > /etc/sysconfig/network.cobbler
echo "GATEWAY=$gateway" >> /etc/sysconfig/network.cobbler
rm -f /etc/sysconfig/network
mv /etc/sysconfig/network.cobbler /etc/sysconfig/network
#end if
## =============================================================================
## Configure the system's primary hostname. This is also passed to anaconda, but
## anaconda doesn't seem to honour it in DHCP-setups.
#if $hostname != ""
# set the hostname in the network configuration file
grep -v HOSTNAME /etc/sysconfig/network > /etc/sysconfig/network.cobbler
echo "HOSTNAME=$hostname" >> /etc/sysconfig/network.cobbler
rm -f /etc/sysconfig/network
mv /etc/sysconfig/network.cobbler /etc/sysconfig/network
# Also set the hostname now, some applications require it
# (e.g.: if we're connecting to Puppet before a reboot).
/bin/hostname $hostname
#end if
#if $enableipv6 == True
grep -v NETWORKING_IPV6 /etc/sysconfig/network > /etc/sysconfig/network.cobbler
echo "NETWORKING_IPV6=yes" >> /etc/sysconfig/network.cobbler
rm -f /etc/sysconfig/network
mv /etc/sysconfig/network.cobbler /etc/sysconfig/network
#if $ipv6_autoconfiguration != ""
grep -v IPV6_AUTOCONF /etc/sysconfig/network > /etc/sysconfig/network.cobbler
#if $ipv6_autoconfiguration == True
echo "IPV6_AUTOCONF=yes" >> /etc/sysconfig/network.cobbler
#else
echo "IPV6_AUTOCONF=no" >> /etc/sysconfig/network.cobbler
#end if
rm -f /etc/sysconfig/network
mv /etc/sysconfig/network.cobbler /etc/sysconfig/network
#end if
#if $ipv6_default_device != ""
grep -v IPV6_DEFAULTDEV /etc/sysconfig/network > /etc/sysconfig/network.cobbler
echo "IPV6_DEFAULTDEV=$ipv6_default_device" >> /etc/sysconfig/network.cobbler
rm -f /etc/sysconfig/network
mv /etc/sysconfig/network.cobbler /etc/sysconfig/network
#end if
#end if
## =============================================================================
## now create the config file for each interface
#for $iname in $ikeys
# Start configuration for $iname
## create lots of variables to use later
#set $idata = $interfaces[$iname]
#set $mac = $idata.get("mac_address", "").upper()
#set $mtu = $idata.get("mtu", "")
#set $static = $idata.get("static", "")
#set $ip = $idata.get("ip_address", "")
#set $netmask = $idata.get("netmask", "")
#set $if_gateway = $idata.get("if_gateway", "")
#set $static_routes = $idata.get("static_routes", "")
#set $iface_type = $idata.get("interface_type", "").lower()
#set $iface_master = $idata.get("interface_master", "")
#set $bonding_opts = $idata.get("bonding_opts", "")
#set $bridge_opts = $idata.get("bridge_opts", "").split(" ")
#set $ipv6_address = $idata.get("ipv6_address", "")
#set $ipv6_secondaries = $idata.get("ipv6_secondaries", "")
#set $ipv6_mtu = $idata.get("ipv6_mtu", "")
#set $ipv6_default_gateway = $idata.get("ipv6_default_gateway", "")
#set $ipv6_static_routes = $idata.get("ipv6_static_routes", "")
#set $devfile = "/etc/sysconfig/network-scripts/cobbler/ifcfg-" + $iname
#set $routesfile = "/etc/sysconfig/network-scripts/cobbler/route-" + $iname
#set $ipv6_routesfile = "/etc/sysconfig/network-scripts/cobbler/route6-" + $iname
## determine if this interface is for a VLAN
#if $vlanpattern.match($iname)
#set $is_vlan = "true"
#else
#set $is_vlan = "false"
#end if
## slave interfaces are assumed to be static
#if $iface_type in ("slave","bond_slave","bridge_slave","bonded_bridge_slave")
#set $static = 1
#end if
## ===================================================================
## Things every interface get, no matter what
## ===================================================================
echo "DEVICE=$iname" > $devfile
echo "ONBOOT=yes" >> $devfile
#if $mac != "" and $iface_type not in ("master","bond","bridge","bonded_bridge_slave")
## virtual interfaces don't get MACs
echo "HWADDR=$mac" >> $devfile
IFNAME=\$(ip -o link | grep -i '$mac' | sed -e 's/^[0-9]*: //' -e 's/:.*//')
## Rename this interface in modprobe.conf
## FIXME: if both interfaces startwith eth this is wrong
if [ -f "/etc/modprobe.conf" ] && [ \$IFNAME ]; then
grep \$IFNAME /etc/modprobe.conf | sed "s/\$IFNAME/$iname/" >> /etc/modprobe.conf.cobbler
grep -v \$IFNAME /etc/modprobe.conf >> /etc/modprobe.conf.new
rm -f /etc/modprobe.conf
mv /etc/modprobe.conf.new /etc/modprobe.conf
fi
#end if
## ===================================================================
## Actions based on interface_type
## ===================================================================
#if $iface_type in ("master","bond","bonded_bridge_slave")
## if this is a bonded interface, configure it in modprobe.conf
#if $osversion == "rhel4"
if [ -f "/etc/modprobe.conf" ]; then
echo "install $iname /sbin/modprobe bonding -o $iname $bonding_opts" >> /etc/modprobe.conf.cobbler
fi
#else
## Add required entry to modprobe.conf
if [ -f "/etc/modprobe.conf" ]; then
echo "alias $iname bonding" >> /etc/modprobe.conf.cobbler
fi
#end if
#if $bonding_opts != ""
cat >> $devfile << EOF
BONDING_OPTS="$bonding_opts"
EOF
#end if
#elif $iface_type in ("slave","bond_slave") and $iface_master != ""
echo "SLAVE=yes" >> $devfile
echo "MASTER=$iface_master" >> $devfile
echo "HOTPLUG=no" >> $devfile
#end if
#if $iface_type == "bridge"
echo "TYPE=Bridge" >> $devfile
#for $bridge_opt in $bridge_opts
#if $bridge_opt.strip() != ""
echo "$bridge_opt" >> $devfile
#end if
#end for
#elif ($iface_type == "bridge_slave" or $iface_type == "bonded_bridge_slave") and $iface_master != ""
echo "BRIDGE=$iface_master" >> $devfile
echo "HOTPLUG=no" >> $devfile
#end if
#if $iface_type != "bridge"
echo "TYPE=Ethernet" >> $devfile
#end if
## ===================================================================
## Actions based on static/dynamic configuration
## ===================================================================
#if $static
#if $mac == "" and $iface_type == ""
# WARNING! Configuring interfaces by their names only
# is error-prone, and can cause issues if and when
# the kernel gives an interface a different name
# following a reboot/hardware changes.
#end if
echo "BOOTPROTO=none" >> $devfile
#if $ip != "" and $iface_type not in ("slave","bond_slave","bridge_slave","bonded_bridge_slave")
## Only configure static networking if an IP-address is configured
## and if the interface isn't slaved to another interface (bridging or bonding)
#if $iname in $promisc_interfaces
echo "PROMISC=yes" >> $devfile
#else
echo "IPADDR=$ip" >> $devfile
#end if
#if $if_gateway != ""
echo "GATEWAY=$if_gateway" >> $devfile
#end if
#if $netmask == ""
## Default to 255.255.255.0?
#set $netmask = "255.255.255.0"
#end if
echo "NETMASK=$netmask" >> $devfile
#end if
#if $enableipv6 == True and $ipv6_autoconfiguration == False
#if $ipv6_address != ""
echo "IPV6INIT=yes" >> $devfile
echo "IPV6ADDR=$ipv6_address" >> $devfile
#end if
#if $ipv6_secondaries != ""
#set ipv6_secondaries = ' '.join(ipv6_secondaries)
## The quotes around the ipv6 ip's need to be here
echo "IPV6ADDR_SECONDARIES=\"$ipv6_secondaries\"" >> $devfile
#end if
#if $ipv6_mtu != ""
echo "IPV6MTU=$ipv6_mtu" >> $devfile
#end if
#if $ipv6_default_gateway != ""
echo "IPV6_DEFAULTGW=$ipv6_default_gateway" >> $devfile
#end if
#end if
#else
## this is a DHCP interface, much less work to do
echo "BOOTPROTO=dhcp" >> $devfile
#if $len($name_servers) > 0
echo "PEERDNS=no" >> $devfile
#end if
#end if
## ===================================================================
## VLAN configuration
## ===================================================================
#if $is_vlan == "true"
echo "VLAN=yes" >> $devfile
echo "ONPARENT=yes" >> $devfile
#end if
## ===================================================================
## Optional configuration stuff
## ===================================================================
#if $mtu != ""
echo "MTU=$mtu" >> $devfile
#end if
## ===================================================================
## Non-slave DNS configuration, when applicable
## ===================================================================
## If the interface is anything but a slave then add DNSn entry
#if $iface_type.lower() not in ("slave","bond_slave","bridge_slave","bonded_bridge_slave")
#set $nct = 0
#for $nameserver in $name_servers
#set $nct = $nct + 1
echo "DNS$nct=$nameserver" >> $devfile
#end for
#end if
## ===================================================================
## Interface route configuration
## ===================================================================
#for $route in $static_routes
#set routepattern = $re.compile("[0-9/.]+:[0-9.]+")
#if $routepattern.match($route)
#set $routebits = $route.split(":")
#set [$network, $router] = $route.split(":")
echo "$network via $router" >> $routesfile
#else
# Warning: invalid route "$route"
#end if
#end for
#if $enableipv6 == True
#for $route in $ipv6_static_routes
#set routepattern = $re.compile("[0-9a-fA-F:/]+,[0-9a-fA-F:]+")
#if $routepattern.match($route)
#set $routebits = $route.split(",")
#set [$network, $router] = $route.split(",")
echo "$network via $router dev $iname" >> $ipv6_routesfile
#else
# Warning: invalid ipv6 route "$route"
#end if
#end for
#end if
## ===================================================================
## Done with this interface
## ===================================================================
#set $i = $i + 1
# End configuration for $iname
#end for
## =============================================================================
## Configure name server search path in /etc/resolv.conf
#set $num_ns = $len($name_servers)
#set $num_ns_search = $len($name_servers_search)
#if $num_ns_search > 0
sed -i -e "/^search /d" /etc/resolv.conf
echo -n "search " >>/etc/resolv.conf
#for $nameserversearch in $name_servers_search
echo -n "$nameserversearch " >>/etc/resolv.conf
#end for
echo "" >>/etc/resolv.conf
#end if
## =============================================================================
## Configure name servers in /etc/resolv.conf
#if $num_ns > 0
sed -i -e "/^nameserver /d" /etc/resolv.conf
#for $nameserver in $name_servers
echo "nameserver $nameserver" >>/etc/resolv.conf
#end for
#end if
## Disable all eth interfaces by default before overwriting
## the old files with the new ones in the working directory
## This stops unneccesary (and time consuming) DHCP queries
## during the network initialization
sed -i 's/ONBOOT=yes/ONBOOT=no/g' /etc/sysconfig/network-scripts/ifcfg-eth*
## Move all staged files to their final location
rm -f /etc/sysconfig/network-scripts/ifcfg-*
mv /etc/sysconfig/network-scripts/cobbler/* /etc/sysconfig/network-scripts/
rm -r /etc/sysconfig/network-scripts/cobbler
if [ -f "/etc/modprobe.conf" ]; then
cat /etc/modprobe.conf.cobbler >> /etc/modprobe.conf
rm -f /etc/modprobe.conf.cobbler
fi
#end if
# End post_install_network_config generated code

View File

@ -1 +0,0 @@
# A general purpose snippet to add late-command actions for preseeds

View File

@ -1,4 +0,0 @@
#if $str($getVar('anamon_enabled','')) == "1"
wget -O /tmp/anamon "http://$server:$http_port/cobbler/aux/anamon"
python /tmp/anamon --name "$name" --server "$server" --port "$http_port"
#end if

View File

@ -1,90 +0,0 @@
#if $getVar("system_name","") != ""
# Start pre_install_network_config generated code
#raw
# generic functions to be used later for discovering NICs
mac_exists() {
if which ip 2>/dev/null >/dev/null; then
ip -o link | grep -i "$1" 2>/dev/null >/dev/null
return $?
elif which esxcfg-nics 2>/dev/null >/dev/null; then
esxcfg-nics -l | grep -i "$1" 2>/dev/null >/dev/null
return $?
else
ifconfig -a | grep -i "$1" 2>/dev/null >/dev/null
return $?
fi
}
get_ifname() {
if which ip 2>/dev/null >/dev/null; then
IFNAME=$(ip -o link | grep -i "$1" | sed -e 's/^[0-9]*: //' -e 's/:.*//')
elif which esxcfg-nics 2>/dev/null >/dev/null; then
IFNAME=$(esxcfg-nics -l | grep -i "$1" | cut -d " " -f 1)
else
IFNAME=$(ifconfig -a | grep -i "$1" | cut -d " " -f 1)
if [ -z $IFNAME ]; then
IFNAME=$(ifconfig -a | grep -i -B 2 "$1" | sed -n '/flags/s/:.*$//p')
fi
fi
}
#end raw
#set ikeys = $interfaces.keys()
#import re
#set $vlanpattern = $re.compile("[a-zA-Z0-9]+[\.:][0-9]+")
#set $routepattern = $re.compile("[0-9/.]+:[0-9.]+")
##
#for $iname in $ikeys
# Start $iname
#set $idata = $interfaces[$iname]
#set $mac = $idata["mac_address"]
#set $static = $idata["static"]
# #set $management = $idata["management"]
#set $ip = $idata["ip_address"]
#set $netmask = $idata["netmask"]
#set $iface_type = $idata["interface_type"]
#set $iface_master = $idata["interface_master"]
#set $static_routes = $idata["static_routes"]
#set $devfile = "/etc/sysconfig/network-scripts/ifcfg-" + $iname
#if not $management or $mac == ""
#continue
#end if
#if $static and $ip != ""
#if $netmask == ""
## Netmask not provided, default to /24.
#set $netmask = "255.255.255.0"
#end if
#set $netinfo = "--bootproto=static --ip=%s --netmask=%s" % ($ip, $netmask)
#if $gateway != ""
#set $netinfo = "%s --gateway=%s" % ($netinfo, $gateway)
#end if
#if $len($name_servers) > 0
#set $netinfo = "%s --nameserver=%s" % ($netinfo, $name_servers[0])
#end if
#else if not $static
#set $netinfo = "--bootproto=dhcp"
#else
## Skip this interface, it's set as static, but without
## networking info.
# Skipping (no configuration)...
#continue
#end if
#if $hostname != ""
#set $netinfo = "%s --hostname=%s" % ($netinfo, $hostname)
#end if
# Configuring $iname ($mac)
if mac_exists $mac
then
get_ifname $mac
echo "network --device=\$IFNAME $netinfo" >> /tmp/pre_install_network_config
#for $route in $static_routes
#if $routepattern.match($route)
#set $routebits = $route.split(":")
#set [$network, $router] = $route.split(":")
ip route add $network via $router dev \$IFNAME
#else
# Warning: invalid route "$route"
#end if
#end for
fi
#end for
# End pre_install_network_config generated code
#end if

View File

@ -1,5 +1,13 @@
## A self-destruct service to boot chef client and register cron job
#if $getVar('ntp_server', '') != ""
#set $ntp_server = '0.ubuntu.pool.ntp.org'
#end if
echo "#!/bin/bash" > /target/etc/init.d/chef; \
echo "echo \"old date is: \`date\`\" 2>&1 > /tmp/ntp.log" >> /target/etc/init.d/chef; \
echo "service ntp stop 2>&1 >> /tmp/ntp.log" >> /target/etc/init.d/chef; \
echo "ntpdate $ntp_server 2>&1 >> /tmp/ntp.log" >> /target/etc/init.d/chef; \
echo "service ntp start 2>&1 >> /tmp/ntp.log" >> /target/etc/init.d/chef; \
echo "echo \"new date is: \`date\`\" 2>&1 >> /tmp/ntp.log" >> /target/etc/init.d/chef; \
echo "rm -rf /var/lib/rsyslog/firstboot_log" >> /target/etc/init.d/chef; \
echo "service rsyslog restart" >> /target/etc/init.d/chef; \
echo "/etc/chef/firstrun.sh" >> /target/etc/init.d/chef; \

View File

@ -1,5 +1,5 @@
echo "127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4" > /target/etc/hosts; \
echo "::1 localhost localhost.localdomain localhost6 localhost6.localdomain6" >> /target/etc/hosts; \
echo "127.0.0.1 $system_name localhost localhost.localdomain localhost4 localhost4.localdomain4" > /target/etc/hosts; \
echo "::1 $system_name localhost localhost.localdomain localhost6 localhost6.localdomain6" >> /target/etc/hosts; \
#for $iname, $idata in $interfaces.items()
#if $hostname and $idata["management"] and $idata["static"] and $idata.get("ip_address", "") != ""
echo "$idata["ip_address"] $hostname" >> /target/etc/hosts; \

View File

@ -1,4 +1,6 @@
#if $getVar('ntp_server', '') != ""
#set $ntp_server = '0.centos.pool.ntp.org'
#end if
echo "driftfile /var/lib/ntp/ntp.drift" > /target/etc/ntp.conf; \
echo "#statsdir /var/log/ntpstats/" >> /target/etc/ntp.conf; \
echo "statistics loopstats peerstats clockstats" >> /target/etc/ntp.conf; \
@ -12,7 +14,3 @@ echo "restrict 127.0.0.1" >> /target/etc/ntp.conf; \
echo "restrict ::1" >> /target/etc/ntp.conf; \
echo "server 127.127.1.0 # local clock" >> /target/etc/ntp.conf; \
chroot /target update-rc.d ntp defaults 58 74; \
chroot /target service ntp stop 2>&1 >> /tmp/ntp.log; \
chroot /target ntpdate $ntp_server 2>&1 >> /tmp/ntp.log; \
chroot /target service ntp start 2>&1 >> /tmp/ntp.log; \
#end if

View File

@ -1,14 +0,0 @@
\\$ModLoad imfile
#
\\$InputFileName /var/log/chef-client.log
\\$InputFileReadMode 0
\\$InputFileTag
\\$InputFileStateFile firstboot_log
\\$InputFileSeverity notice
\\$InputFileFacility local3
\\$InputRunFileMonitor
#
\\$InputFilePollInterval 1
#
#
local3.info @$server:514

View File

@ -1,87 +0,0 @@
# rsyslog v5 configuration file
# For more information see /usr/share/doc/rsyslog-*/rsyslog_conf.html
# If you experience problems, see http://www.rsyslog.com/doc/troubleshoot.html
#### MODULES ####
\\$ModLoad imuxsock # provides support for local system logging (e.g. via logger command)
# $ModLoad imklog # provides kernel logging support (previously done by rklogd)
#$ModLoad immark # provides --MARK-- message capability
\\$ModLoad imfile
\\$WorkDirectory /var/lib/rsyslog
\\$ActionQueueType LinkedList
\\$ActionQueueFileName srvrfwd
\\$ActionResumeRetryCount -1
\\$ActionQueueSaveOnShutDown on
*.* @@$server:514
# Provides UDP syslog reception
\\$ModLoad imudp
\\$UDPServerRun 514
# Provides TCP syslog reception
\\$ModLoad imtcp
\\$InputTCPServerRun 514
#### GLOBAL DIRECTIVES ####
# Use default timestamp format
\\$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
# File syncing capability is disabled by default. This feature is usually not required,
# not useful and an extreme performance hit
#$ActionFileEnableSync on
# Include all config files in /etc/rsyslog.d/
\\$IncludeConfig /etc/rsyslog.d/*.conf
#### RULES ####
# Log all kernel messages to the console.
# Logging much else clutters up the screen.
#kern.* /dev/console
# Log anything (except mail) of level info or higher.
# Don't log private authentication messages!
*.info;mail.none;authpriv.none;cron.none /var/log/messages
# The authpriv file has restricted access.
#authpriv.* /etc/chef/test.log
#authpriv.* @@$server:514
# Log all the mail messages in one place.
mail.* -/var/log/maillog
# Log cron stuff
cron.* /var/log/cron
# Everybody gets emergency messages
*.emerg *
# Save news errors of level crit and higher in a special file.
uucp,news.crit /var/log/spooler
# Save boot messages also to boot.log
local7.* /var/log/boot.log
# ### begin forwarding rule ###
# The statement between the begin ... end define a SINGLE forwarding
# rule. They belong together, do NOT split them. If you create multiple
# forwarding rules, duplicate the whole block!
# Remote Logging (we use TCP for reliable delivery)
#
# An on-disk queue is created for this action. If the remote host is
# down, messages are spooled to disk and sent when it is up again.
#$WorkDirectory /var/lib/rsyslog # where to place spool files
#$ActionQueueFileName fwdRule1 # unique name prefix for spool files
#$ActionQueueMaxDiskSpace 1g # 1gb space limit (use as much as possible)
#$ActionQueueSaveOnShutdown on # save messages to disk on shutdown
#$ActionQueueType LinkedList # run asynchronously
#$ActionResumeRetryCount -1 # infinite retries if host is down
# remote host is: name/ip:port, e.g. 192.168.0.1:514, port optional
# ### end of the forwarding rule ###

View File

@ -1,28 +0,0 @@
[main]
cachedir=/var/cache/yum/$basearch/$releasever
#if $getVar('proxy', '') != ""
proxy=$proxy
#end if
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=5
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=16&ref=http://bugs.centos.org/bug_report_page.php?category=yum
distroverpkg=centos-release
# This is the default, if you make this bigger yum won't see if the metadata
# is newer on the remote and so you'll "gain" the bandwidth of not having to
# download the new metadata and "pay" for it by yum not having correct
# information.
# It is esp. important, to have correct metadata, for distributions like
# Fedora which don't keep old packages around. If you don't like this checking
# interupting your command line usage, it's much better to have something
# manually check the metadata once an hour (yum-updatesd will do this).
# metadata_expire=90m
# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d