summaryrefslogtreecommitdiffstats
path: root/deploy/adapters/cobbler
diff options
context:
space:
mode:
authorbaigk <baiguoku@huawei.com>2015-08-05 02:00:31 -0400
committerbaigk <baiguoku@huawei.com>2015-08-05 02:00:31 -0400
commit4fb32751f9c8e82a729780fc5dedae71cecc32b6 (patch)
treecb1af3b6eff4249874469bc567ebe6b6e0cfc4db /deploy/adapters/cobbler
parentd05b5f04c92034eae1675dc8102247a3cc3315f7 (diff)
support deployment os of centos7.1 with cobbler for compass
JIRA: COMPASS-5 Change-Id: I6aa19548a17791f8862c6dba00380ef946ea3108 Signed-off-by: baigk <baiguoku@huawei.com>
Diffstat (limited to 'deploy/adapters/cobbler')
-rw-r--r--deploy/adapters/cobbler/kickstarts/default.ks131
-rw-r--r--deploy/adapters/cobbler/snippets/keep_cfengine_keys10
-rw-r--r--deploy/adapters/cobbler/snippets/kickstart_ansible1
-rw-r--r--deploy/adapters/cobbler/snippets/kickstart_chef13
-rw-r--r--deploy/adapters/cobbler/snippets/kickstart_chef-admin.pem8
-rw-r--r--deploy/adapters/cobbler/snippets/kickstart_chef-validator.pem8
-rw-r--r--deploy/adapters/cobbler/snippets/kickstart_chef_init31
-rw-r--r--deploy/adapters/cobbler/snippets/kickstart_chef_run.sh108
-rw-r--r--deploy/adapters/cobbler/snippets/kickstart_client.rb39
-rw-r--r--deploy/adapters/cobbler/snippets/kickstart_done84
-rw-r--r--deploy/adapters/cobbler/snippets/kickstart_gem_local_repo23
-rw-r--r--deploy/adapters/cobbler/snippets/kickstart_hosts19
-rw-r--r--deploy/adapters/cobbler/snippets/kickstart_knife.rb35
-rw-r--r--deploy/adapters/cobbler/snippets/kickstart_limits.conf54
-rw-r--r--deploy/adapters/cobbler/snippets/kickstart_network_config7
-rw-r--r--deploy/adapters/cobbler/snippets/kickstart_ntp70
-rw-r--r--deploy/adapters/cobbler/snippets/kickstart_partition_disks5
-rw-r--r--deploy/adapters/cobbler/snippets/kickstart_post_anamon91
-rw-r--r--deploy/adapters/cobbler/snippets/kickstart_post_install_kernel_options14
-rw-r--r--deploy/adapters/cobbler/snippets/kickstart_post_install_network_config603
-rw-r--r--deploy/adapters/cobbler/snippets/kickstart_post_log2
-rw-r--r--deploy/adapters/cobbler/snippets/kickstart_post_partition_disks33
-rw-r--r--deploy/adapters/cobbler/snippets/kickstart_pre_anamon9
-rw-r--r--deploy/adapters/cobbler/snippets/kickstart_pre_install_network_config99
-rw-r--r--deploy/adapters/cobbler/snippets/kickstart_pre_log12
-rw-r--r--deploy/adapters/cobbler/snippets/kickstart_pre_partition_disks542
-rw-r--r--deploy/adapters/cobbler/snippets/kickstart_rsyslog.conf66
-rw-r--r--deploy/adapters/cobbler/snippets/kickstart_software_chef1
-rw-r--r--deploy/adapters/cobbler/snippets/kickstart_ssh34
-rw-r--r--deploy/adapters/cobbler/snippets/kickstart_start30
-rw-r--r--deploy/adapters/cobbler/snippets/kickstart_sysctl.conf72
-rw-r--r--deploy/adapters/cobbler/snippets/kickstart_yum91
-rw-r--r--deploy/adapters/cobbler/snippets/kickstart_yum_repo_config11
-rw-r--r--deploy/adapters/cobbler/snippets/preseed_chef_run.sh4
-rw-r--r--deploy/adapters/cobbler/snippets/preseed_pre_install_network_config2
-rw-r--r--deploy/adapters/cobbler/snippets/sysctl.xml78
-rw-r--r--deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.5/kickstart_centos_base_repo59
-rw-r--r--deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.5/kickstart_centos_debuginfo_repo23
-rw-r--r--deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.5/kickstart_centos_epel_repo25
-rw-r--r--deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.5/kickstart_centos_epel_testing_repo25
-rw-r--r--deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.5/kickstart_centos_vault_repo213
-rw-r--r--deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.5/kickstart_repos5
-rw-r--r--deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.6/kickstart_centos_base_repo59
-rw-r--r--deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.6/kickstart_centos_debuginfo_repo23
-rw-r--r--deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.6/kickstart_centos_epel_repo25
-rw-r--r--deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.6/kickstart_centos_epel_testing_repo25
-rw-r--r--deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.6/kickstart_centos_fasttrack_repo10
-rw-r--r--deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.6/kickstart_centos_vault_repo256
-rw-r--r--deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.6/kickstart_repos6
-rw-r--r--deploy/adapters/cobbler/snippets/yum.repos.d/centos/7.0/kickstart_centos_base_repo59
-rw-r--r--deploy/adapters/cobbler/snippets/yum.repos.d/centos/7.0/kickstart_centos_debuginfo_repo23
-rw-r--r--deploy/adapters/cobbler/snippets/yum.repos.d/centos/7.0/kickstart_centos_epel_repo25
-rw-r--r--deploy/adapters/cobbler/snippets/yum.repos.d/centos/7.0/kickstart_centos_epel_testing_repo25
-rw-r--r--deploy/adapters/cobbler/snippets/yum.repos.d/centos/7.0/kickstart_centos_mysql_repo35
-rw-r--r--deploy/adapters/cobbler/snippets/yum.repos.d/centos/7.0/kickstart_centos_mysql_source_repo31
-rw-r--r--deploy/adapters/cobbler/snippets/yum.repos.d/centos/7.0/kickstart_repos7
56 files changed, 3391 insertions, 8 deletions
diff --git a/deploy/adapters/cobbler/kickstarts/default.ks b/deploy/adapters/cobbler/kickstarts/default.ks
new file mode 100644
index 00000000..ecd877b8
--- /dev/null
+++ b/deploy/adapters/cobbler/kickstarts/default.ks
@@ -0,0 +1,131 @@
+# Kickstart for Profile: CentOS6.4_x86-64-1
+# Distro: CentOS6.4
+
+# System Authorization
+auth --useshadow --enablemd5
+
+#if $os_version == "rhel7"
+eula --agreed
+services --enabled=NetworkManager,sshd
+#end if
+
+# Use Graphic Mode
+text
+
+# Disable Firewall
+firewall --disabled
+
+# Run the Setup Agent on first-boot
+firstboot --disable
+
+# System Keyboard
+keyboard us
+
+# Language Setting
+lang en_US
+
+# Installation Loggin Level
+logging --level=info
+
+# Network Installation
+url --url=$tree
+
+
+$SNIPPET('kickstart_network_config')
+$SNIPPET('kickstart_partition_disks')
+$SNIPPET('kickstart_yum_repo_config')
+
+# Set User Password
+#if $getVar('username', 'root') != "root"
+rootpw root
+ #set username = $getVar('username', 'root')
+ #set crypted_param = ''
+ #set password_param = '--password=%s' % $username
+ #if $getVar('password', '') != ""
+ #set crypted_param = '--iscrypted'
+ #set password_param = '--password=%s' % $password
+ #end if
+user --name=$username $crypted_param $password_param
+#else
+ #if $getVar('password', '') != ""
+rootpw --iscrypted $password
+ #else
+rootpw root
+ #end if
+#end if
+
+# Selinux Disable
+selinux --disabled
+
+# No X Window System
+skipx
+
+# System Timezone
+#if $getVar('timezone', '') != ""
+timezone --utc $timezone
+#else
+timezone --utc US/Pacific
+#end if
+
+# Install
+install
+
+# Reboot After Installation
+reboot
+
+%pre
+$SNIPPET('kickstart_pre_log')
+$SNIPPET('kickstart_start')
+$SNIPPET('kickstart_pre_install_network_config')
+$SNIPPET('kickstart_pre_partition_disks')
+
+# Enable installation monitoring
+$SNIPPET('kickstart_pre_anamon')
+%end
+
+# Packages
+%packages --nobase
+@core
+iproute
+ntp
+openssh-clients
+wget
+yum-plugin-priorities
+json-c
+libestr
+rsyslog
+parted
+vim
+lsof
+strace
+#if $os_version == "rhel7"
+net-tools
+#end if
+#if $getVar('tool', '') != ''
+ #set $kickstart_software = "kickstart_software_%s" % $tool
+$SNIPPET($kickstart_software)
+#end if
+%end
+
+%post --log=/var/log/post_install.log
+$SNIPPET('kickstart_post_log')
+$SNIPPET('kickstart_post_install_kernel_options')
+$SNIPPET('kickstart_post_install_network_config')
+$SNIPPET('kickstart_post_partition_disks')
+
+chkconfig iptables off
+chkconfig ip6tables off
+
+$SNIPPET('kickstart_yum')
+$SNIPPET('kickstart_ssh')
+$SNIPPET('kickstart_ntp')
+$SNIPPET('kickstart_limits.conf')
+$SNIPPET('kickstart_sysctl.conf')
+$SNIPPET('kickstart_rsyslog.conf')
+#if $getVar('tool', '') != ''
+ #set $kickstart_tool = "kickstart_%s" % $tool
+$SNIPPET($kickstart_tool)
+#end if
+$SNIPPET('kickstart_post_anamon')
+$SNIPPET('kickstart_done')
+%end
diff --git a/deploy/adapters/cobbler/snippets/keep_cfengine_keys b/deploy/adapters/cobbler/snippets/keep_cfengine_keys
index 06854adc..d2c5622f 100644
--- a/deploy/adapters/cobbler/snippets/keep_cfengine_keys
+++ b/deploy/adapters/cobbler/snippets/keep_cfengine_keys
@@ -32,13 +32,13 @@ function findkeys
# Copy current host keys out to be reused
if [ -d /tmp/$tmpdir$SEARCHDIR ] && cp -a /tmp/$tmpdir$SEARCHDIR/${PATTERN}* /tmp/$TEMPDIR; then
keys_found="yes"
- umount /tmp/$tmpdir
- rm -r /tmp/$tmpdir
- break
+ umount /tmp/$tmpdir
+ rm -r /tmp/$tmpdir
+ break
elif [ -n "$SHORTDIR" ] && [ -d /tmp/$tmpdir$SHORTDIR ] && cp -a /tmp/$tmpdir$SHORTDIR/${PATTERN}* /tmp/$TEMPDIR; then
- keys_found="yes"
+ keys_found="yes"
umount /tmp/$tmpdir
- rm -r /tmp/$tmpdir
+ rm -r /tmp/$tmpdir
break
fi
umount /tmp/$tmpdir
diff --git a/deploy/adapters/cobbler/snippets/kickstart_ansible b/deploy/adapters/cobbler/snippets/kickstart_ansible
new file mode 100644
index 00000000..8b137891
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/kickstart_ansible
@@ -0,0 +1 @@
+
diff --git a/deploy/adapters/cobbler/snippets/kickstart_chef b/deploy/adapters/cobbler/snippets/kickstart_chef
new file mode 100644
index 00000000..1261b713
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/kickstart_chef
@@ -0,0 +1,13 @@
+mkdir -p /etc/chef
+mkdir -p /var/log/chef
+
+## Generate validation.pem
+$SNIPPET('kickstart_chef-validator.pem')
+## Generate admin.pem
+$SNIPPET('kickstart_chef-admin.pem')
+## Generate client.rb
+$SNIPPET('kickstart_client.rb')
+$SNIPPET('kickstart_knife.rb')
+$SNIPPET('kickstart_gem_local_repo')
+$SNIPPET('kickstart_chef_run.sh')
+$SNIPPET('kickstart_chef_init')
diff --git a/deploy/adapters/cobbler/snippets/kickstart_chef-admin.pem b/deploy/adapters/cobbler/snippets/kickstart_chef-admin.pem
new file mode 100644
index 00000000..36aad5d1
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/kickstart_chef-admin.pem
@@ -0,0 +1,8 @@
+#if $getVar('chef_admin_file', '') == ""
+ #set chef_admin_file = '/etc/chef-server/admin.pem'
+#end if
+#set f = $open($chef_admin_file)
+cat << EOL > /etc/chef/admin.pem
+#echo $f.read()
+EOL
+#silent $f.close()
diff --git a/deploy/adapters/cobbler/snippets/kickstart_chef-validator.pem b/deploy/adapters/cobbler/snippets/kickstart_chef-validator.pem
new file mode 100644
index 00000000..515a2195
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/kickstart_chef-validator.pem
@@ -0,0 +1,8 @@
+#if $getVar('chef_validation_file', '') == ""
+ #set chef_validation_file = '/etc/chef-server/chef-validator.pem'
+#end if
+#set f = $open($chef_validation_file)
+cat << EOL > /etc/chef/validation.pem
+#echo $f.read()
+EOL
+#silent $f.close()
diff --git a/deploy/adapters/cobbler/snippets/kickstart_chef_init b/deploy/adapters/cobbler/snippets/kickstart_chef_init
new file mode 100644
index 00000000..9bb9784f
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/kickstart_chef_init
@@ -0,0 +1,31 @@
+## 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 ntp stop 2>&1 >> /tmp/ntp.log
+ntpdate $ntp_server 2>&1 >> /tmp/ntp.log
+service ntp start 2>&1 >> /tmp/ntp.log
+echo "new date is: `date`" 2>&1 >> /tmp/ntp.log
+yum -y update 2>&1 >> /tmp/yum_update.log
+
+crontab -l > /tmp/mycron
+echo "*/30 * * * * /etc/chef/chef_client_run.sh" >> /tmp/mycron
+crontab /tmp/mycron
+rm /tmp/mycron
+
+/etc/chef/chef_client_run.sh &
+
+chkconfig chef off
+mv /etc/init.d/chef /tmp/chef
+EOF
+
+chmod +x /etc/init.d/chef
+chkconfig chef on
diff --git a/deploy/adapters/cobbler/snippets/kickstart_chef_run.sh b/deploy/adapters/cobbler/snippets/kickstart_chef_run.sh
new file mode 100644
index 00000000..6b2e0301
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/kickstart_chef_run.sh
@@ -0,0 +1,108 @@
+#set ip_address = ""
+#set ikeys = $interfaces.keys()
+#for $iname in $ikeys
+ #set $idata = $interfaces[$iname]
+ #set $static = $idata["static"]
+ #set $management = $idata["management"]
+ #set $ip = $idata["ip_address"]
+ #if $management and $ip
+ #set $ip_address = $ip
+ #end if
+#end for
+
+#set $proxy_url = ""
+#set $local_repo_url = ""
+#if $getVar("local_repo","") != ""
+ #set $local_repo_url = $local_repo
+#end if
+#if $getVar("proxy","") != ""
+ #set $proxy_url = $proxy
+#end if
+
+#if $getVar('compass_server', '') != ""
+ #set srv = $getVar('compass_server','')
+#else
+ #set srv = $getVar('server','')
+#end if
+
+cat << EOF > /etc/chef/chef_client_run.sh
+#!/bin/bash
+touch /var/log/chef.log
+PIDFILE=/tmp/chef_client_run.pid
+if [ -f \\$PIDFILE ]; then
+ pid=\\$(cat \\$PIDFILE)
+ if [ -f /proc/\\$pid/exe ]; then
+ echo "there are chef_client_run.sh running with pid \\$pid" >> /var/log/chef.log 2>&1
+ exit 1
+ fi
+fi
+echo \\$$ > \\$PIDFILE
+while true; do
+ echo "run chef-client on \`date\`" >> /var/log/chef.log 2>&1
+ clients=\\$(pgrep chef-client)
+ if [[ "\\$?" == "0" ]]; then
+ echo "there are chef-clients '\\$clients' running" >> /var/log/chef.log 2>&1
+ break
+ else
+ echo "knife search nodes" >> /var/log/chef.log 2>&1
+# use knife node list here to check if node has been registered because knife search node
+# doesn't work as expected.
+ USER=root HOME=/root knife node list |grep \\$HOSTNAME. >> /var/log/chef.log 2>&1
+ nodes=\\$(USER=root HOME=/root knife node list |grep \\$HOSTNAME.)
+ echo "found nodes \\$nodes" >> /var/log/chef.log 2>&1
+ let all_nodes_success=1
+ for node in \\$nodes; do
+ mkdir -p /var/log/chef/\\$node
+ if [ ! -f /etc/chef/\\$node.json ]; then
+ cat << EOL > /etc/chef/\\$node.json
+{
+ "local_repo": "$local_repo_url",
+ "proxy_url": "$proxy_url",
+ "ip_address": "$ip_address"
+}
+EOL
+ fi
+ if [ ! -f "/etc/chef/\\$node.pem" ]; then
+ cat << EOL > /etc/rsyslog.d/\\$node.conf
+\\\\$ModLoad imfile
+\\\\$InputFileName /var/log/chef/\\$node/chef-client.log
+\\\\$InputFileReadMode 0
+\\\\$InputFileTag \\$node
+\\\\$InputFileStateFile chef_\\${node}_log
+\\\\$InputFileSeverity notice
+\\\\$InputFileFacility local3
+\\\\$InputRunFileMonitor
+\\\\$InputFilePollInterval 1
+#if $getVar("compass_server","") != ""
+local3.info @$compass_server:514
+#else
+local3.info @@$server:514
+#end if
+EOL
+ rm -rf /var/lib/rsyslog/chef_\\$node_log
+ service rsyslog restart
+ fi
+ if [ -f "/etc/chef/\\$node.done" ]; then
+ USER=root HOME=/root chef-client --node-name \\$node -j /etc/chef/\\$node.json --client_key /etc/chef/\\$node.pem >> /var/log/chef.log 2>&1
+ else
+ USER=root HOME=/root chef-client --node-name \\$node -j /etc/chef/\\$node.json --client_key /etc/chef/\\$node.pem -L /var/log/chef/\\$node/chef-client.log >> /var/log/chef.log 2>&1
+ fi
+ if [ "\\$?" != "0" ]; then
+ echo "chef-client --node-name \\$node run failed" >> /var/log/chef.log 2>&1
+ let all_nodes_success=0
+ else
+ echo "chef-client --node-name \\$node run success" >> /var/log/chef.log 2>&1
+ touch /etc/chef/\\$node.done
+ wget -O /tmp/package_state.\\$node --post-data='{"ready": true}' --header=Content-Type:application/json "http://$srv/api/clusterhosts/\\${node}/state_internal"
+ fi
+ done
+ if [ \\$all_nodes_success -eq 0 ]; then
+ sleep 1m
+ else
+ break
+ fi
+ fi
+done
+EOF
+chmod +x /etc/chef/chef_client_run.sh
+
diff --git a/deploy/adapters/cobbler/snippets/kickstart_client.rb b/deploy/adapters/cobbler/snippets/kickstart_client.rb
new file mode 100644
index 00000000..568ba46a
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/kickstart_client.rb
@@ -0,0 +1,39 @@
+mkdir -p /etc/chef
+cat << EOL > /etc/chef/client.rb
+log_level :info
+log_location '/dev/null'
+#if $getVar('chef_url', '') != ""
+chef_server_url '$chef_url'
+#elif $getVar("compass_server","") != ""
+chef_server_url 'https://$compass_server'
+#else
+chef_server_url 'https://$server'
+#end if
+validation_client_name 'chef-validator'
+json_attribs nil
+pid_file '/var/run/chef-client.pid'
+# Using default node name (fqdn)
+no_lazy_load true
+ssl_verify_mode :verify_none
+#if $os_version == "rhel7"
+verify_api_cert false
+#end if
+EOL
+
+mkdir -p /etc/chef/trusted_certs
+#set certs_path = $getVar("trusted_certs_path", "/var/opt/chef-server/nginx/ca")
+#if $certs_path != ""
+ #import os
+ #import os.path
+ #set filenames = $os.listdir($certs_path)
+ #for filename in $filenames
+ #if $filename.endswith('.crt')
+ #set filepath = $os.path.join($certs_path, $filename)
+ #set f = $open($filepath)
+cat << EOF > /etc/chef/trusted_certs/$filename
+ #echo $f.read()
+EOF
+ #silent $f.close()
+ #end if
+ #end for
+#end if
diff --git a/deploy/adapters/cobbler/snippets/kickstart_done b/deploy/adapters/cobbler/snippets/kickstart_done
new file mode 100644
index 00000000..2a936adb
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/kickstart_done
@@ -0,0 +1,84 @@
+#set system_name = $getVar('system_name','')
+#set profile_name = $getVar('profile_name','')
+#set breed = $getVar('breed','')
+#set os_version = $getVar('os_version','')
+#if $getVar("compass_server","") != ""
+#set srv = $getVar('compass_server','')
+#else
+#set srv = $getVar('server','')
+#end if
+#set kickstart = $getVar('kickstart','')
+#set run_install_triggers = $str($getVar('run_install_triggers',''))
+#set pxe_just_once = $str($getVar('pxe_just_once',''))
+#set nopxe = ""
+#set saveks = ""
+#set runpost = ""
+#if $system_name != ''
+ ## PXE JUST ONCE
+ #if $pxe_just_once in [ "1", "true", "yes", "y" ]
+ #if $breed == 'redhat'
+ #set nopxe = "\nwget \"http://%s/cblr/svc/op/nopxe/system/%s\" -O /var/log/nopxe" % (srv, system_name)
+ #else if $breed == 'vmware' and $os_version == 'esx4'
+ #set nopxe = "\ncurl \"http://%s/cblr/svc/op/nopxe/system/%s\" -o /var/log/nopxe" % (srv, system_name)
+ #else if $breed == 'vmware'
+ #set nopxe = "\nwget \"http://%s/cblr/svc/op/nopxe/system/%s\" -O /var/log/nopxe" % (srv, system_name)
+ #else if $breed == 'debian' or $breed == 'ubuntu'
+ #set nopxe = "\nwget \"http://%s/cblr/svc/op/nopxe/system/%s\" -O /var/log/nopxe" % (srv, system_name)
+ #else
+ ## default to wget
+ #set nopxe = "wget \"http://%s/cblr/svc/op/nopxe/system/%s\" -O /var/log/nopxe;" % (srv, system_name)
+ #end if
+ #end if
+ ## SAVE KICKSTART
+ #if $kickstart != ''
+ #if $breed == 'redhat'
+ #set saveks = "\nwget \"http://%s/cblr/svc/op/ks/%s/%s\" -O /root/cobbler.ks" % (srv, "system", system_name)
+ #else if $breed == 'vmware' and $os_version == 'esx4'
+ #set saveks = "\ncurl \"http://%s/cblr/svc/op/ks/%s/%s\" -o /root/cobbler.ks" % (srv, "system", system_name)
+ #else if $breed == 'vmware'
+ #set saveks = "\nwget \"http://%s/cblr/svc/op/ks/%s/%s\" -O /var/log/cobbler.ks" % (srv, "system", system_name)
+ #else if $breed == 'debian' or $breed == 'ubuntu'
+ #set saveks = "\nwget \"http://%s/cblr/svc/op/ks/%s/%s\" -O /var/log/cobbler.seed" % (srv, "system", system_name)
+ #end if
+ #end if
+ ## RUN POST TRIGGER
+ #if $run_install_triggers in [ "1", "true", "yes", "y" ]
+ #if $breed == 'redhat'
+ #set runpost = "\nwget \"http://%s/cblr/svc/op/trig/mode/post/%s/%s\" -O /dev/null" % (srv, "system", system_name)
+ #else if $breed == 'vmware' and $os_version == 'esx4'
+ #set runpost = "\ncurl \"http://%s/cblr/svc/op/trig/mode/post/%s/%s\" -o /dev/null" % (srv, "system", system_name)
+ #else if $breed == 'vmware'
+ #set runpost = "\nwget \"http://%s/cblr/svc/op/trig/mode/post/%s/%s\" -O /dev/null" % (srv, "system", system_name)
+ #else if $breed == 'debian' or $breed == 'ubuntu'
+ #set runpost = "\nwget \"http://%s/cblr/svc/op/trig/mode/post/%s/%s\" -O /dev/null" % (srv, "system", system_name)
+ #end if
+ #end if
+#else if $profile_name != ''
+ ## SAVE KICKSTART
+ #if $kickstart != ''
+ #if $breed == 'redhat'
+ #set saveks = "\nwget \"http://%s/cblr/svc/op/ks/%s/%s\" -O /root/cobbler.ks" % (srv, "profile", profile_name)
+ #else if $breed == 'vmware' and $os_version == 'esx4'
+ #set saveks = "\ncurl \"http://%s/cblr/svc/op/ks/%s/%s\" -o /root/cobbler.ks" % (srv, "profile", profile_name)
+ #else if $breed == 'vmware'
+ #set saveks = "\nwget \"http://%s/cblr/svc/op/ks/%s/%s\" -O /var/log/cobbler.ks" % (srv, "profile", profile_name)
+ #else if $breed == 'debian' or $breed == 'ubuntu'
+ #set saveks = "\nwget \"http://%s/cblr/svc/op/ks/%s/%s\" -O /var/log/cobbler.seed" % (srv, "profile", profile_name)
+ #end if
+ #end if
+ ## RUN POST TRIGGER
+ #if $run_install_triggers in [ "1", "true", "yes", "y" ]
+ #if $breed == 'redhat'
+ #set runpost = "\nwget \"http://%s/cblr/svc/op/trig/mode/post/%s/%s\" -O /dev/null" % (srv, "profile", profile_name)
+ #else if $breed == 'vmware' and $os_version == 'esx4'
+ #set runpost = "\ncurl \"http://%s/cblr/svc/op/trig/mode/post/%s/%s\" -o /dev/null" % (srv, "profile", profile_name)
+ #else if $breed == 'vmware'
+ #set runpost = "\nwget \"http://%s/cblr/svc/op/trig/mode/post/%s/%s\" -O /dev/null" % (srv, "profile", profile_name)
+ #else if $breed == 'debian' or $breed == 'ubuntu'
+ #set runpost = "\nwget \"http://%s/cblr/svc/op/trig/mode/post/%s/%s\" -O /dev/null" % (srv, "profile", profile_name)
+ #end if
+ #end if
+#end if
+#echo $saveks
+#echo $runpost
+#echo $nopxe
diff --git a/deploy/adapters/cobbler/snippets/kickstart_gem_local_repo b/deploy/adapters/cobbler/snippets/kickstart_gem_local_repo
new file mode 100644
index 00000000..ac779382
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/kickstart_gem_local_repo
@@ -0,0 +1,23 @@
+cat << EOF > /root/.gemrc
+#if $getVar('proxy', '') != ""
+gem: --no-ri --no-rdoc --http-proxy=$proxy
+#else
+gem: --no-ri --no-rdoc
+#end if
+:backtrace: false
+:benchmark: false
+:bulk_threshold: 1000
+:sources:
+#if $getVar("local_repo","") != ""
+- $local_repo/gem_repo/
+ #if $getVar("local_repo_only","1") == "0"
+- https://rubygems.org/
+ #end if
+#else
+- https://rubygems.org/
+#end if
+:update_sources: true
+:verbose: true
+EOF
+
+cp -f /root/.gemrc /etc/gemrc
diff --git a/deploy/adapters/cobbler/snippets/kickstart_hosts b/deploy/adapters/cobbler/snippets/kickstart_hosts
new file mode 100644
index 00000000..7a0866dc
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/kickstart_hosts
@@ -0,0 +1,19 @@
+cat << EOL > /etc/hosts
+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
+ #end if
+#end for
+#import os
+#set $server_name = $os.uname[1]
+#if $getVar("compass_server", "") != ""
+$compass_server $server_name
+#else
+$server $server_name
+#end if
+#if $getVar("chef_server_ip", "") != "" and $getVar("chef_server_dns", "") != ""
+$chef_server_ip $chef_server_dns
+#end if
+EOL
diff --git a/deploy/adapters/cobbler/snippets/kickstart_knife.rb b/deploy/adapters/cobbler/snippets/kickstart_knife.rb
new file mode 100644
index 00000000..e4ab081b
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/kickstart_knife.rb
@@ -0,0 +1,35 @@
+mkdir -p /root/.chef
+cat << EOL > /root/.chef/knife.rb
+log_level :info
+log_location '/dev/null'
+#if $getVar('chef_url', '') != ""
+chef_server_url '$chef_url'
+#end if
+node_name 'admin'
+client_key '/etc/chef/admin.pem'
+validation_client_name 'chef-validator'
+validation_key '/etc/chef/validation.pem'
+syntax_check_cache_path '/root/.chef/syntax_check_cache'
+ssl_verify_mode :verify_none
+#if $os_version == "rhel7"
+verify_api_cert false
+#end if
+EOL
+
+mkdir -p /root/.chef/trusted_certs
+#set certs_path = $getVar("trusted_certs_path", "/var/opt/chef-server/nginx/ca")
+#if $certs_path != ""
+ #import os
+ #import os.path
+ #set filenames = $os.listdir($certs_path)
+ #for filename in $filenames
+ #if $filename.endswith('.crt')
+ #set filepath = $os.path.join($certs_path, $filename)
+ #set f = $open($filepath)
+cat << EOF > /root/.chef/trusted_certs/$filename
+ #echo $f.read()
+EOF
+ #silent $f.close()
+ #end if
+ #end for
+#end if
diff --git a/deploy/adapters/cobbler/snippets/kickstart_limits.conf b/deploy/adapters/cobbler/snippets/kickstart_limits.conf
new file mode 100644
index 00000000..00cf8610
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/kickstart_limits.conf
@@ -0,0 +1,54 @@
+cat << EOF > /etc/security/limits.conf
+#raw
+# /etc/security/limits.conf
+#
+# Each line describes a limit for a user in the form:
+#
+#<domain> <type> <item> <value>
+#
+#Where:
+#<domain> can be:
+# - an user name
+# - a group name, with @group syntax
+# - the wildcard *, for default entry
+# - the wildcard %, can be also used with %group syntax,
+# for maxlogin limit
+#
+#<type> can have the two values:
+# - "soft" for enforcing the soft limits
+# - "hard" for enforcing hard limits
+#
+#<item> can be one of the following:
+# - core - limits the core file size (KB)
+# - data - max data size (KB)
+# - fsize - maximum filesize (KB)
+# - memlock - max locked-in-memory address space (KB)
+# - nofile - max number of open files
+# - rss - max resident set size (KB)
+# - stack - max stack size (KB)
+# - cpu - max CPU time (MIN)
+# - nproc - max number of processes
+# - as - address space limit (KB)
+# - maxlogins - max number of logins for this user
+# - maxsyslogins - max number of logins on the system
+# - priority - the priority to run user process with
+# - locks - max number of file locks the user can hold
+# - sigpending - max number of pending signals
+# - msgqueue - max memory used by POSIX message queues (bytes)
+# - nice - max nice priority allowed to raise to values: [-20, 19]
+# - rtprio - max realtime priority
+#
+#<domain> <type> <item> <value>
+#
+
+#* soft core 0
+#* hard rss 10000
+#@student hard nproc 20
+#@faculty soft nproc 20
+#@faculty hard nproc 50
+#ftp hard nproc 0
+#@student - maxlogins 4
+* - nofile 100000
+# End of file
+#end raw
+EOF
diff --git a/deploy/adapters/cobbler/snippets/kickstart_network_config b/deploy/adapters/cobbler/snippets/kickstart_network_config
new file mode 100644
index 00000000..c4bb47ee
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/kickstart_network_config
@@ -0,0 +1,7 @@
+## 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
diff --git a/deploy/adapters/cobbler/snippets/kickstart_ntp b/deploy/adapters/cobbler/snippets/kickstart_ntp
new file mode 100644
index 00000000..2cbf75e5
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/kickstart_ntp
@@ -0,0 +1,70 @@
+#if $getVar('ntp_server', '') == ""
+ #set $ntp_server = '0.centos.pool.ntp.org'
+#end if
+chkconfig ntpd on
+
+cat << EOF > /etc/ntp.conf
+# 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).
+
+# Include the option tinker panic 0 at the top of your ntp.conf file.
+# By default, the NTP daemon sometimes panics and exits if the underlying clock
+# appears to be behaving erratically. This option causes the daemon to keep
+# running instead of panicking.
+tinker panic 0
+
+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
+server $ntp_server
+
+# 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
+
+# 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
+EOF
diff --git a/deploy/adapters/cobbler/snippets/kickstart_partition_disks b/deploy/adapters/cobbler/snippets/kickstart_partition_disks
new file mode 100644
index 00000000..6978d8f4
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/kickstart_partition_disks
@@ -0,0 +1,5 @@
+## start of cobbler network_config generated code
+#if $getVar("system_name","") != ""
+%include /tmp/part-include
+#end if
+## end of cobbler network_config generated code
diff --git a/deploy/adapters/cobbler/snippets/kickstart_post_anamon b/deploy/adapters/cobbler/snippets/kickstart_post_anamon
new file mode 100644
index 00000000..699e830f
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/kickstart_post_anamon
@@ -0,0 +1,91 @@
+#if $str($getVar('anamon_enabled','')) == "1"
+
+## install anamon script
+#if $getVar("compass_server","") != ""
+wget -O /usr/local/sbin/anamon "http://$compass_server:$http_port/cobbler/aux/anamon"
+#else
+wget -O /usr/local/sbin/anamon "http://$server:$http_port/cobbler/aux/anamon"
+#end if
+## install anamon system service
+cat << EOF > /etc/init.d/anamon.init
+#raw
+#!/bin/bash
+## BEGIN INIT INFO
+# Provides: anamon.init
+# Default-Start: 3 5
+# Default-Stop: 0 1 2 4 6
+# Required-Start: $network
+# Short-Description: Starts the cobbler anamon boot notification program
+# Description: anamon runs the first time a machine is booted after
+# installation.
+## END INIT INFO
+
+#
+# anamon.init: Starts the cobbler post-install boot notification program
+#
+# chkconfig: 35 95 95
+#
+# description: anamon runs the first time a machine is booted after
+# installation.
+#
+#end raw
+#if $getVar("compass_server","") != ""
+/usr/local/sbin/anamon --watchfile "/var/log/anaconda.log" --name $name --server $compass_server --port $http_port --exit
+#else
+/usr/local/sbin/anamon --watchfile "/var/log/anaconda.log" --name $name --server $server --port $http_port --exit
+#end if
+chkconfig anamon.init off
+mv /etc/init.d/anamon.init /tmp/anamon.init
+EOF
+
+## adjust permissions
+chmod 755 /etc/init.d/anamon.init /usr/local/sbin/anamon
+test -d /selinux && restorecon /etc/init.d/anamon.init /usr/local/sbin/anamon
+
+## enable the script
+chkconfig anamon.init on
+
+#end if
+
+## place start-up script for updating os state
+#if $getVar('compass_server', '') != ""
+ #set srv = $getVar('compass_server','')
+#else
+ #set srv = $getVar('server','')
+#end if
+cat << EOF > /etc/init.d/set_state
+#raw
+#!/bin/bash
+## BEGIN INIT INFO
+# chkconfig: 2345 99 15
+# Provides: set_state
+# Default-Start: 3 5
+# Default-Stop: 0 1 2 4 6
+# Required-Start: $network $sshd
+# Short-Description: Notifies the os installation is finished
+# Description: set_state runs the first time a machine is booted after
+# installation.
+## END INIT INFO
+#
+# set_state: Notify compass server the os installation is finished
+#
+# chkconfig: 35 99 99
+#
+# description: set_state runs the first time a machine is booted after
+# installation.
+#
+#end raw
+
+wget -O /tmp/os_state --post-data='{"ready": true}' --header=Content-Type:application/json "http://$srv/api/hosts/${hostname}/state_internal"
+chkconfig set_state off
+mv /etc/init.d/set_state /tmp/set_state
+EOF
+
+## adjust permissions
+chmod 755 /etc/init.d/set_state
+test -d /selinux && restorecon /etc/init.d/set_state
+
+## enable the script
+chkconfig set_state on
+
+echo "compass_server=$server" >> /etc/compass.conf
diff --git a/deploy/adapters/cobbler/snippets/kickstart_post_install_kernel_options b/deploy/adapters/cobbler/snippets/kickstart_post_install_kernel_options
new file mode 100644
index 00000000..1cff9c99
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/kickstart_post_install_kernel_options
@@ -0,0 +1,14 @@
+#if $getVar('kernel_options_post','') != ''
+# Start post install kernel options update
+if [ -f /etc/default/grub ]; then
+ TMP_GRUB=\$(gawk 'match(\$0,/^GRUB_CMDLINE_LINUX="([^"]+)"/,a) {printf("%s\n",a[1])}' /etc/default/grub)
+ sed -i '/^GRUB_CMDLINE_LINUX=/d' /etc/default/grub
+ echo "GRUB_CMDLINE_LINUX=\"\$TMP_GRUB $kernel_options_post\"" >> /etc/default/grub
+ grub2-mkconfig -o /boot/grub2/grub.cfg
+else
+ /sbin/grubby --update-kernel=\$(/sbin/grubby --default-kernel) --args="$kernel_options_post"
+fi
+# End post install kernel options update
+#end if
+
+
diff --git a/deploy/adapters/cobbler/snippets/kickstart_post_install_network_config b/deploy/adapters/cobbler/snippets/kickstart_post_install_network_config
new file mode 100644
index 00000000..2c089f92
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/kickstart_post_install_network_config
@@ -0,0 +1,603 @@
+# 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 $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 -f /etc/sysconfig/network.cobbler /etc/sysconfig/network
+#end if
+
+cat << EOF > /sbin/ifup-local
+#raw
+#!/bin/bash
+RC=0
+PROM=\$(egrep -i 'promisc' /etc/sysconfig/network-scripts/ifcfg-\$1 | awk -F"=" '{ print \$2 }')
+if [[ "\$PROM" == "yes" ]]; then
+ ip link set dev \$1 promisc on
+ RC=\$?
+fi
+exit \$RC
+#end raw
+EOF
+chmod +x /sbin/ifup-local
+
+#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 -f /etc/sysconfig/network.cobbler /etc/sysconfig/network
+/bin/hostname $hostname
+#end if
+
+$SNIPPET('kickstart_hosts')
+
+#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
+
+#set $num_ns = $len($name_servers)
+#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
+
+# get physical interfaces
+declare -A physical_interfaces
+set \$(ip -o link | grep -v lo | awk '{print \$2}' | sed 's/://')
+let physical_interface_num=\$#;
+let physical_interface_offset=0
+echo "network interface numbers: \$physical_interface_num" > /tmp/network_log
+while [ \$physical_interface_offset -lt \$physical_interface_num ];
+do
+ physical_interfaces[\$1]=\$1
+ let physical_interface_offset=\$physical_interface_offset+1
+ shift 1
+done
+
+echo "interfaces: \${physical_interfaces[@]}" >> /tmp/network_log
+
+# map physical interface to mac address
+declare -A physical_interface_mac
+declare -A physical_mac_interface
+for physical_interface in \${physical_interfaces[@]}; do
+ mac=\$(cat /sys/class/net/\${physical_interface}/address)
+ mac=\${mac^^}
+ physical_interface_mac[\${physical_interface}]=\$mac
+ physical_mac_interface[\$mac]=\${physical_interface}
+done
+for key in \${!physical_interface_mac[@]}; do
+ echo "interface to mac: $key => \${physical_interface_mac[\$key]}" >> /tmp/network_log
+done
+for key in \${!physical_mac_interface[@]}; do
+ echo "mac to interface: $key => \${physical_mac_interface[\$key]}" >> /tmp/network_log
+done
+
+declare -A logical_interfaces
+declare -A logical_interface_mapping
+declare -A physical_interface_mapping
+
+#set ikeys = $interfaces.keys()
+#set osversion = $getVar("os_version","")
+#import re
+#set $vlanpattern = $re.compile("([a-zA-Z0-9]+)[\.][0-9]+")
+#set $subinterfacepattern = $re.compile("([a-zA-Z0-9]+)[:][0-9]+")
+#set $numbondingdevs = 0
+#for $iname in $ikeys
+ #set $idata = $interfaces[$iname]
+ #set $mac = $idata.get("mac_address", "").upper()
+ #set $interface_type = $idata.get("interface_type", "").lower()
+ #if $interface_type in ("master","bond","bonded_bridge_slave")
+ #set $numbondingdevs += 1
+ #end if
+ #if $interface_type in ("master","bond","bridge","bonded_bridge_slave")
+ #continue
+ #end if
+ #if $vlanpattern.match($iname)
+ #set $interface_matched = $vlanpattern.match($iname)
+ #set $interface_name = $interface_matched.group(1)
+logical_interface=${interface_name}
+ #elif $subinterfacepattern.match($iname)
+ #set $interface_matched = $subinterfacepattern.match($iname)
+ #set $interface_name = $interface_matched.group(1)
+logical_interface=${interface_name}
+ #else
+logical_interface=$iname
+ #end if
+logical_interfaces[\${logical_interface}]=\${logical_interface}
+ #if $mac != ""
+physical_interface=\${physical_mac_interface[$mac]}
+logical_interface_mapping[\${logical_interface}]=\${physical_interface}
+if [ ! -z "\$physical_interface" ]; then
+ physical_interface_mapping[\${physical_interface}]=\${logical_interface}
+fi
+ #else
+if [ -z "\${logical_interface_mapping[\${logical_interface}]}" ]; then
+ logical_interface_mapping[\${logical_interface}]=""
+fi
+ #end if
+#end for
+
+echo "finish mapping logical interfaces in network config to physical interfaces" >> /tmp/network_log
+for key in \${!logical_interface_mapping[@]}; do
+ echo "map logical interface to physical interface: \$key => \${logical_interface_mapping[\$key]}" >> /tmp/network_log
+done
+
+for key in \${!physical_interface_mapping[@]}; do
+ echo "map physical interface to logical interface: \$key => \${physical_interface_mapping[\$key]}" >> /tmp/network_log
+done
+
+# map unmapped logical interface to the same name physical interface
+echo "mapping unmapped logical interfaces to the same name physical interfaces" >> /tmp/network_log
+for logical_interface in \${!logical_interface_mapping[@]}; do
+ physical_interface=\${logical_interface_mapping[\${logical_interface}]}
+ if [ -z "\${physical_interface}" ]; then
+ # check if the same name physical interface is mapped
+ mapped_logical_interface=\${physical_interface_mapping[\${logical_interface}]}
+ if [ -z "\${mapped_logical_interface}" ]; then
+ # check if the same name physical interface exists
+ if [ ! -z "\${physical_interfaces[\${logical_interface}]}" ]; then
+ logical_interface_mapping[\${logical_interface}]=\${logical_interface}
+ physical_interface_mapping[\${logical_interface}]=\${logical_interface}
+ else
+ echo "ignore logical interface \${logical_interface} since the same name physical interface does not exist" >> /tmp/network_log
+ fi
+ else
+ echo "ignore logical interface \${logical_interface} since the same name physical interface is mapped by logical interface \${mapped_logical_interface}" >> /tmp/network_log
+ fi
+ else
+ echo "ignore logical interface \${logical_interface} since it is mapped to physical interface \${physical_interface}" >> /tmp/network_log
+ fi
+done
+
+echo "finish mapping unmapped logical interfaces in network config to the same name physical interfaces" >> /tmp/network_log
+for key in \${!logical_interface_mapping[@]}; do
+ echo "map logical interface to physical interface: \$key => \${logical_interface_mapping[\$key]}" >> /tmp/network_log
+done
+
+for key in \${!physical_interface_mapping[@]}; do
+ echo "map physical interface to logical interface: \$key => \${physical_interface_mapping[\$key]}" >> /tmp/network_log
+done
+
+declare -A unset_logical_interfaces
+declare -A unset_physical_interfaces
+
+echo "get unset logical interfaces from \${logical_interfaces[@]}" >> /tmp/network_log
+for logical_interface in \${logical_interfaces[@]}; do
+ physical_interface=\${logical_interface_mapping[\${logical_interface}]}
+ if [ -z "\${physical_interface}" ]; then
+ unset_logical_interfaces[\${logical_interface}]=\${logical_interface}
+ else
+ echo "ignore logical interface \${logical_interface} => \${physical_interface}" >> /tmp/network_log
+ fi
+done
+echo "got unset logical interfaces: \${unset_logical_interfaces[@]}" >> /tmp/network_log
+
+echo "get unset physical interfaces" >> /tmp/network_log
+for physical_interface in \${physical_interfaces[@]}; do
+ logical_interface=\${physical_interface_mapping[\${physical_interface}]}
+ if [ -z "\${logical_interface}" ]; then
+ unset_physical_interfaces[\${physical_interface}]=\${physical_interface}
+ else
+ echo "ignore physical interface \${physical_interface} => \${logical_interface}" >> /tmp/network_log
+ fi
+done
+echo "got unset physical interfaces: \${unset_physical_interfaces[@]}" >> /tmp/network_log
+
+sorted_unset_physical_interfaces=(\$(printf '%s\n' \${unset_physical_interfaces[@]} | sort))
+echo "sorted unset physical interfaces: \${sorted_unset_physical_interfaces[@]}" >> /tmp/network_log
+sorted_unset_logical_interfaces=(\$(printf '%s\n' \${unset_logical_interfaces[@]} | sort))
+echo "sorted unset logical interfaces: \${sorted_unset_logical_interfaces[@]}" >> /tmp/network_log
+
+# map unset logical interface to unset physical interface
+while [ \${#sorted_unset_physical_interfaces[@]} -gt 0 -a \${#sorted_unset_logical_interfaces[@]} -gt 0 ]; do
+ physical_interface=\${sorted_unset_physical_interfaces[0]}
+ logical_interface=\${sorted_unset_logical_interfaces[0]}
+ echo "map unset logical interface \${logical_interface} to unset physical interface \${physical_interface}" >> /tmp/network_log
+ unset sorted_unset_physical_interfaces[0]
+ unset sorted_unset_logical_interfaces[0]
+ unset unset_physical_interfaces[\${physical_interface}]
+ unset unset_logical_interfaces[\${logical_interface}]
+ logical_interface_mapping[\${logical_interface}]=\${physical_interface}
+ physical_interface_mapping[\${physical_interface}]=\${logical_interface}
+done
+
+echo "finish mapping unmapped logical interfaces in network config to unmapped physical interfaces" >> /tmp/network_log
+for key in \${!logical_interface_mapping[@]}; do
+ echo "map logical interface to physical interface: \$key => \${logical_interface_mapping[\$key]}" >> /tmp/network_log
+done
+
+for key in \${!physical_interface_mapping[@]}; do
+ echo "map physical interface to logical interface: \$key => \${physical_interface_mapping[\$key]}" >> /tmp/network_log
+done
+
+echo "unset logical interfaces: \${unset_logical_interfaces[@]}" >> /tmp/network_log
+echo "unset physical interfaces: \${unset_physical_interfaces[@]}" >> /tmp/network_log
+
+# map any unmapped logical interfaces
+echo "map unmapped logical interfaces" >> /tmp/network_log
+if [ \${#sorted_unset_logical_interfaces[@]} -gt 0 ]; then
+ declare -A available_logical_interfaces
+ # get all available logical interfaces which the same name physical interface is not used
+ for logical_interface in \${logical_interfaces[@]}; do
+ mapped_logical_interface=\${physical_interface_mapping[\${logical_interface}]}
+ if [ -z "\${mapped_logical_interface}" ]; then
+ available_logical_interfaces[\${logical_interface}]=\${logical_interface}
+ else
+ echo "ignore logical interface \${logical_interface} since the same name physical interface mapped to logical interface \${mapped_logical_interface}" >> /tmp/network_log
+ fi
+ done
+
+ #first map logical interface to the same name physical interface if that physical interface name is not used
+ for logical_interface in \${sorted_unset_logical_interfaces[@]}; do
+ available_logical_interface=\${available_logical_interfaces[\${logical_interface}]}
+ if [ ! -z "\${available_logical_interface}" ]; then
+ unset unset_logical_interfaces[\${logical_interface}]
+ unset available_logical_interfaces[\${available_logical_interface}]
+ logical_interface_mapping[\${logical_interface}]=\${available_logical_interface}
+ physical_interface_mapping[\${available_logical_interface}]=\${logical_interface}
+ fi
+ done
+
+ echo "finish mapping ramaining unmapped logical interfaces to the same name physical interface" >> /tmp/network_log
+ for key in \${!logical_interface_mapping[@]}; do
+ echo "map logical interface to physical interface: \$key => \${logical_interface_mapping[\$key]}" >> /tmp/network_log
+ done
+
+ for key in \${!physical_interface_mapping[@]}; do
+ echo "map physical interface to logical interface: \$key => \${physical_interface_mapping[\$key]}" >> /tmp/network_log
+ done
+
+ echo "unset logical interfaces: \${unset_logical_interfaces[@]}" >> /tmp/network_log
+ echo "unset physical interfaces: \${unset_physical_interfaces[@]}" >> /tmp/network_log
+
+ # map remain unset logical interfaces to available logical interface names
+ sorted_unset_logical_interfaces=(\$(printf '%s\n' \${unset_logical_interfaces[@]} | sort))
+ echo "sorted unset logical interfaces: \${sorted_unset_logical_interfaces[@]}" >> /tmp/network_log
+ sorted_available_logical_interfaces=(\$(printf '%s\n' \${available_logical_interfaces[@]} | sort))
+ echo "sorted available logical interfaces: \${sorted_available_logical_interfaces[@]}" >> /tmp/network_log
+ while [ \${#sorted_unset_logical_interfaces[@]} -gt 0 -a \${#sorted_available_logical_interfaces[@]} -gt 0 ]; do
+ logical_interface=\${sorted_unset_logical_interfaces[0]}
+ available_logical_interface=\${sorted_available_logical_interfaces[0]}
+ echo "map logical interface \${logical_interface} to unused physical interface \${available_logical_interface}" >> /tmp/network_log
+ unset sorted_unset_logical_interfaces[0]
+ unset unset_logical_interfaces[\${logical_interface}]
+ unset sorted_available_logical_interfaces[0]
+ unset available_logical_interfaces[\${available_logical_interface}]
+ logical_interface_mapping[\${logical_interface}]=\${available_logical_interface}
+ physical_interface_mapping[\${available_logical_interface}]=\${logical_interface}
+ done
+fi
+
+echo "finish mapping ramaining unmapped logical interfaces" >> /tmp/network_log
+for key in \${!logical_interface_mapping[@]}; do
+ echo "map logical interface to physical interface: \$key => \${logical_interface_mapping[\$key]}" >> /tmp/network_log
+done
+
+for key in \${!physical_interface_mapping[@]}; do
+ echo "map physical interface to logical interface: \$key => \${physical_interface_mapping[\$key]}" >> /tmp/network_log
+done
+
+echo "unset logical interfaces: \${unset_logical_interfaces[@]}" >> /tmp/network_log
+echo "unset physical interfaces: \${unset_physical_interfaces[@]}" >> /tmp/network_log
+
+# map any unmapped physical interfaces
+echo "map unmapped physical interfaces" >> /tmp/network_log
+if [ \${#sorted_unset_physical_interfaces[@]} -gt 0 ]; then
+ declare -A available_physical_interfaces
+ # get all available physical interfaces which the same name logical interface is not used
+ for physical_interface in \${physical_interfaces[@]}; do
+ mapped_physical_interface=\${logical_interface_mapping[\${physical_interface}]}
+ if [ -z "\${mapped_physical_interface}" ]; then
+ available_physical_interfaces[\${physical_interface}]=\${physical_interface}
+ else
+ echo "ignore physical interface \${physical_interface} since the same name logical interface mapped to physical interface \${mapped_physical_interface}" >> /tmp/network_log
+ fi
+ done
+
+ #first map physical interface to the same name logical interface if that logical interface name is not used
+ for physical_interface in \${sorted_unset_physical_interfaces[@]}; do
+ available_physical_interface=\${available_physical_interfaces[\${physical_interface}]}
+ if [ ! -z "\${available_physical_interface}" ]; then
+ unset unset_physical_interfaces[\${physical_interface}]
+ unset available_physical_interfaces[\${available_physical_interface}]
+ logical_interface_mapping[\${available_physical_interface}]=\${physical_interface}
+ physical_interface_mapping[\${physical_interface}]=\${available_physical_interface}
+ fi
+ done
+ echo "finish mapping ramaining unmapped physical interfaces to the same name logical interface" >> /tmp/network_log
+ for key in \${!logical_interface_mapping[@]}; do
+ echo "map logical interface to physical interface: \$key => \${logical_interface_mapping[\$key]}" >> /tmp/network_log
+ done
+
+ for key in \${!physical_interface_mapping[@]}; do
+ echo "map physical interface to logical interface: \$key => \${physical_interface_mapping[\$key]}" >> /tmp/network_log
+ done
+
+ echo "unset logical interfaces: \${unset_logical_interfaces[@]}" >> /tmp/network_log
+ echo "unset physical interfaces: \${unset_physical_interfaces[@]}" >> /tmp/network_log
+
+ # map remain unset physical interfaces to logical interface name as available physical interface names
+ sorted_unset_physical_interfaces=(\$(printf '%s\n' \${unset_physical_interfaces[@]} | sort))
+ echo "sorted unset physical interfaces: \${sorted_unset_physical_interfaces[@]}" >> /tmp/network_log
+ sorted_available_physical_interfaces=(\$(printf '%s\n' \${available_physical_interfaces[@]} | sort))
+ echo "sorted available physical interfaces: \${sorted_available_physical_interfaces[@]}" >> /tmp/network_log
+ while [ \${#sorted_unset_physical_interfaces[@]} -gt 0 -a \${#sorted_available_physical_interfaces[@]} -gt 0 ]; do
+ physical_interface=\${sorted_unset_physical_interfaces[0]}
+ available_physical_interface=\${sorted_available_physical_interfaces[0]}
+ echo "map physical interface \${physical_interface} to unused logical interface \${available_physical_interface}" >> /tmp/network_log
+ unset sorted_unset_physical_interfaces[0]
+ unset unset_physical_interfaces[\${physical_interface}]
+ unset sorted_available_physical_interfaces[0]
+ unset available_physical_interfaces[\${available_physical_interface}]
+ physical_interface_mapping[\${available_physical_interface}]=\${physical_interface}
+ logical_interface_mapping[\${physical_interface}]=\${available_physical_interface}
+ done
+fi
+
+echo "finish mapping ramaining unmapped physical interfaces" >> /tmp/network_log
+for key in \${!logical_interface_mapping[@]}; do
+ echo "map logical interface to physical interface: \$key => \${logical_interface_mapping[\$key]}" >> /tmp/network_log
+done
+
+for key in \${!physical_interface_mapping[@]}; do
+ echo "map physical interface to logical interface: \$key => \${physical_interface_mapping[\$key]}" >> /tmp/network_log
+done
+
+echo "unset logical interfaces: \${unset_logical_interfaces[@]}" >> /tmp/network_log
+echo "unset physical interfaces: \${unset_physical_interfaces[@]}" >> /tmp/network_log
+
+for key in \${!logical_interface_mapping[@]}; do
+ echo "map logical interface to physical interface: \$key => \${logical_interface_mapping[\$key]}" >> /tmp/network_log
+done
+
+for key in \${!physical_interface_mapping[@]}; do
+ echo "map physical interface to logical interface: \$key => \${physical_interface_mapping[\$key]}" >> /tmp/network_log
+done
+
+# generate udev network rules
+#if $osversion == "rhel7"
+udev_network_rule_filename=80-net-name-slot.rules
+#else
+udev_network_rule_filename=70-persistent-net.rules
+#end if
+for key in \${!logical_interface_mapping[@]}; do
+ physical_interface=\${logical_interface_mapping[\$key]}
+ if [ ! -z "\${physical_interface}" ]; then
+ physical_mac=\${physical_interface_mac[\${physical_interface}]}
+ else
+ physical_mac=""
+ fi
+ if [ ! -z "\${physical_mac}" ]; then
+ physical_mac=\${physical_mac,,}
+ echo "SUBSYSTEM==\"net\", ACTION==\"add\", DRIVERS==\"?*\", ATTR{address}==\"\${physical_mac}\", ATTR{type}==\"1\", KERNEL==\"eth*\", NAME=\"\$key\"" >> /etc/udev/rules.d/\${udev_network_rule_filename}.new
+ echo "add network interface \$key mac \$physical_mac into udev rules" >> /tmp/network_log
+ else
+ echo "network interface \$key does not find mac address to add to udev rules" >> /tmp/network_log
+ fi
+done
+
+#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 working directory for interface scripts
+mkdir /etc/sysconfig/network-scripts/cobbler
+cp /etc/sysconfig/network-scripts/ifcfg-lo /etc/sysconfig/network-scripts/cobbler/
+
+declare -A used_logical_interfaces
+
+#set $nameserver_set = 0
+
+#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 $devfile = "/etc/sysconfig/network-scripts/cobbler/ifcfg-" + $iname
+ #set $routesfile = "/etc/sysconfig/network-scripts/cobbler/route-" + $iname
+
+used_logical_interfaces[$iname]=$iname
+
+ #if $iface_type in ("slave","bond_slave","bridge_slave","bonded_bridge_slave")
+ #set $static = 1
+ #end if
+echo "DEVICE=$iname" > $devfile
+echo "ONBOOT=yes" >> $devfile
+
+ #if $iface_type not in ("master","bond","bridge","bonded_bridge_slave")
+ #if $vlanpattern.match($iname)
+ #pass
+ #else
+ #set $interface_matched = $subinterfacepattern.match($iname)
+ #if $interface_matched
+ #set $interface_name = $interface_matched.group(1)
+logical_interface=$interface_name
+ #else
+logical_interface=$iname
+ #end if
+physical_interface=\${logical_interface_mapping[\$logical_interface]}
+if [ ! -z "\$physical_interface" ]; then
+ physical_mac=\${physical_interface_mac[\$physical_interface]}
+fi
+if [ ! -z "\$physical_mac" ]; then
+ echo "HWADDR=\$physical_mac" >> $devfile
+fi
+ #if not $subinterfacepattern.match($iname)
+if [ -f "/etc/modprobe.conf" ] && [ ! -z "\${physical_interface}" ]; then
+ grep \$physical_interface /etc/modprobe.conf | sed "s/\${physical_interface}/$iname/" >> /etc/modprobe.conf.cobbler
+ grep -v \$physical_interface /etc/modprobe.conf >> /etc/modprobe.conf.new
+ rm -f /etc/modprobe.conf
+ mv -f /etc/modprobe.conf.new /etc/modprobe.conf
+fi
+ #end if
+ #end if
+ #end if
+
+ #if $iface_type in ("master","bond","bonded_bridge_slave")
+ ## if this is a bonded interface, configure it in modprobe.conf
+if [ -f "/etc/modprobe.conf" ]; then
+ #if $osversion == "rhel4"
+ echo "install $iname /sbin/modprobe bonding -o $iname $bonding_opts" >> /etc/modprobe.conf.cobbler
+ #else
+ echo "alias $iname bonding" >> /etc/modprobe.conf.cobbler
+ #end if
+fi
+ #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 in ["bridge_slave", "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
+
+ #if $static
+echo "BOOTPROTO=static" >> $devfile
+ #if $iname in $promisc_interfaces
+echo "PROMISC=yes" >> $devfile
+ #elif $ip != ""
+echo "IPADDR=$ip" >> $devfile
+ #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
+ #else
+echo "BOOTPROTO=dhcp" >> $devfile
+ #if $len($name_servers) > 0
+echo "PEERDNS=no" >> $devfile
+ #end if
+ #end if
+
+ #if $vlanpattern.match($iname)
+echo "VLAN=yes" >> $devfile
+echo "ONPARENT=yes" >> $devfile
+ #elif $subinterfacepattern.match($iname)
+echo "ONPARENT=yes" >> $devfile
+ #end if
+
+ #if $mtu != ""
+echo "MTU=$mtu" >> $devfile
+ #end if
+
+ #if not $nameserver_set
+ #if $iface_type 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
+ #set $nameserver_set = 1
+ #end if
+ #end if
+
+ #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
+#end for
+
+for logical_interface in \${!logical_interface_mapping[@]}; do
+ if [ ! -z "\${used_logical_interfaces[\${logical_interface}]}" ]; then
+ # ignore logical interface that is already generated in above
+ continue
+ fi
+ physical_interface=\${logical_interface_mapping[\${logical_interface}]}
+ if [ ! -z "\${physical_interface}" ]; then
+ devfile="/etc/sysconfig/network-scripts/cobbler/ifcfg-"\${logical_interface}
+ mac=\${physical_interface_mac[\${physical_interface}]}
+ echo "DEVICE=\${logical_interface}" > \$devfile
+ echo "ONBOOT=yes" >> \$devfile
+ echo "BOOTPROTO=static" >> \$devfile
+ if [ ! -z "\$mac" ]; then
+ echo "HWADDR=\$mac" >> \$devfile
+ fi
+ echo "TYPE=Ethernet" >> \$devfile
+ if [ -f "/etc/modprobe.conf" ] && [ ! -z "\${physical_interface}" ]; then
+ grep \${physical_interface} /etc/modprobe.conf | sed "s/\${physical_interface}/\${logical_interface}/" >> /etc/modprobe.conf.cobbler
+ grep -v \${physical_interface} /etc/modprobe.conf >> /etc/modprobe.conf.new
+ rm -f /etc/modprobe.conf
+ mv -f /etc/modprobe.conf.new /etc/modprobe.conf
+ fi
+ fi
+done
+
+## 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-*
+
+## Move all staged files to their final location
+rm -f /etc/sysconfig/network-scripts/ifcfg-*
+mv -f /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
+if [ -f "/etc/udev/rules.d/\${udev_network_rule_filename}" ]; then
+ rm -f /etc/udev/rules.d/\${udev_network_rule_filename}
+fi
+
+if [ -f "/etc/udev/rules.d/\${udev_network_rule_filename}.new" ]; then
+ mv -f /etc/udev/rules.d/\${udev_network_rule_filename}.new /etc/udev/rules.d/\${udev_network_rule_filename}
+fi
+# End post_install_network_config generated code
diff --git a/deploy/adapters/cobbler/snippets/kickstart_post_log b/deploy/adapters/cobbler/snippets/kickstart_post_log
new file mode 100644
index 00000000..d1df0265
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/kickstart_post_log
@@ -0,0 +1,2 @@
+set -x -v
+exec 1>/root/ks-post.log 2>&1
diff --git a/deploy/adapters/cobbler/snippets/kickstart_post_partition_disks b/deploy/adapters/cobbler/snippets/kickstart_post_partition_disks
new file mode 100644
index 00000000..ded9e961
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/kickstart_post_partition_disks
@@ -0,0 +1,33 @@
+partitions=\$(pvs --noheadings --separator :| cut -d: -f1,2)
+vg_remove=0
+remove_partitions=''
+echo "partitions \$partitions" >> /tmp/post_partition.log
+
+for partition in \$partitions; do
+ partition_vg=(\${partition//:/ })
+ partition=\${partition_vg[0]}
+ vg=\${partition_vg[1]}
+ if [[ "\$vg" == "reserved" ]]; then
+ echo "prepare remove partition \$partition" >> /tmp/post_partition.log
+ remove_partitions="\${remove_partitions} \$partition"
+ vg_remove=1
+ else
+ echo "ignore \$vg since it is not reserved" >> /tmp/post_partition.log
+ fi
+done
+
+if [[ "\${vg_remove}" != "0" ]]; then
+ vgremove -f reserved
+fi
+
+for remove_partition in \${remove_partitions}; do
+ echo "remove partition \${remove_partition}" >> /tmp/post_partition.log
+ pvremove -ff -y \${remove_partition}
+ set \$(echo \${remove_partition} | sed -e 's/^\(.*\)\([0-9]\+\)\$/\1 \2/g')
+ partition_disk=\$1
+ partition_number=\$2
+ if [ -z "\${partition_disk}" -o -z "\${partition_number}" ]; then
+ continue
+ fi
+ parted \${partition_disk} --script -- rm \${partition_number}
+done
diff --git a/deploy/adapters/cobbler/snippets/kickstart_pre_anamon b/deploy/adapters/cobbler/snippets/kickstart_pre_anamon
new file mode 100644
index 00000000..70b84690
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/kickstart_pre_anamon
@@ -0,0 +1,9 @@
+#if $str($getVar('anamon_enabled','')) == "1"
+ #if $getVar("compass_server", "") != ""
+wget -O /tmp/anamon "http://$compass_server:$http_port/cobbler/aux/anamon"
+python /tmp/anamon --name "$name" --server "$compass_server" --port "$http_port"
+ #else
+wget -O /tmp/anamon "http://$server:$http_port/cobbler/aux/anamon"
+python /tmp/anamon --name "$name" --server "$server" --port "$http_port"
+ #end if
+#end if
diff --git a/deploy/adapters/cobbler/snippets/kickstart_pre_install_network_config b/deploy/adapters/cobbler/snippets/kickstart_pre_install_network_config
new file mode 100644
index 00000000..34d670f8
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/kickstart_pre_install_network_config
@@ -0,0 +1,99 @@
+#if $getVar("system_name","") != ""
+# Start pre_install_network_config generated code
+ #if $getVar('management_nic', '') == ""
+ #set $management_nic=''
+ #end if
+#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()
+ #for $iname in $ikeys
+ #set $idata = $interfaces[$iname]
+ #set $management = $idata["management"]
+ #if $management
+ #set $management_nic = $iname
+ #end if
+ #end for
+ #for $iname in $ikeys
+ #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"]
+ #if $management_nic != ''
+ #if $iname != $management_nic
+ #continue
+ #end if
+ #end if
+ #if $mac == ""
+ #continue
+ #end if
+# Configuring $iname ($mac)
+if mac_exists $mac
+then
+ get_ifname $mac
+ #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
+ 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
diff --git a/deploy/adapters/cobbler/snippets/kickstart_pre_log b/deploy/adapters/cobbler/snippets/kickstart_pre_log
new file mode 100644
index 00000000..fe71c592
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/kickstart_pre_log
@@ -0,0 +1,12 @@
+set -x -v
+exec 1>/tmp/ks-pre.log 2>&1
+
+# Once root's homedir is there, copy over the log.
+while : ; do
+ sleep 10
+ if [ -d /mnt/sysimage/root ]; then
+ cp /tmp/ks-pre.log /mnt/sysimage/root/
+ logger "Copied %pre section log to system"
+ break
+ fi
+done &
diff --git a/deploy/adapters/cobbler/snippets/kickstart_pre_partition_disks b/deploy/adapters/cobbler/snippets/kickstart_pre_partition_disks
new file mode 100644
index 00000000..6b1c9ce3
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/kickstart_pre_partition_disks
@@ -0,0 +1,542 @@
+#set hostname=$getVar('hostname',None)
+#set partition = $getVar('partition', None)
+#set partition_size = $getVar('partition_size', None)
+#set partition_maxsize = $getVar('partition_maxsize', None)
+#set disk_reserve_size = $getVar('disk_reserve_size', None)
+#set disk_max_size = $getVar('disk_max_size', None)
+#set default_disk_reserve_size = $getVar('default_disk_reserve_size', '0')
+#set default_disk_max_size = $getVar('default_disk_max_size', '0')
+
+#if $hostname == None
+#set $vgname = "VolGroup00"
+#else
+#set $vgname = $hostname.split('.')[0]
+#end if
+
+declare -A disk_mapping
+declare -A disk_path_mapping
+declare -A ignore_disk_mapping
+declare -A ignore_disk_path_mapping
+if [ -e /dev/disk/by-path ]; then
+ set \$(ls -s -l /dev/disk/by-path | awk '{print \$10, \$12}')
+ let disk_mapping_nums=\$#/2
+ let disk_mapping_offset=0
+ echo "disk_mapping_nums: \$disk_mapping_nums" > /tmp/log
+ echo "disk_mapping: \$*" >> /tmp/log
+ while [ \$disk_mapping_offset -lt \$disk_mapping_nums ]; do
+ let found_disk_type=0
+#if $getVar('disk_type_only','') != ""
+ if expr match "\$1" ".*-${disk_type_only}-.*"; then
+ let found_disk_type=1
+ fi
+#else
+ let found_disk_type=1
+#end if
+ path_name=\$(basename \$1)
+ disk_name=\$(basename \$2)
+ let disk_mapping_offset=\$disk_mapping_offset+1
+ shift 2
+
+ if [ \$found_disk_type -gt 0 ]; then
+ disk_mapping[\${disk_name}]="/dev/disk/by-path/\${path_name}"
+ disk_mapping[\${path_name}]="/dev/disk/by-path/\${path_name}"
+ disk_path_mapping[\${disk_name}]="/dev/\${disk_name}"
+ disk_path_mapping[\${path_name}]="/dev/\${disk_name}"
+ else
+ ignore_disk_mapping[\${disk_name}]="/dev/disk/by-path/\${path_name}"
+ ignore_disk_mapping[\${path_name}]="/dev/disk/by-path/\${path_name}"
+ ignore_disk_path_mapping[\${disk_name}]="/dev/\${disk_name}"
+ ignore_disk_path_mapping[\${path_name}]="/dev/\${disk_name}"
+ fi
+ done
+
+ for key in \${!disk_mapping[@]}; do
+ echo "disk mapping \$key => \${disk_mapping[\$key]}" >> /tmp/log
+ done
+
+ for key in \${!disk_path_mapping[@]}; do
+ echo "disk path mapping \$key => \${disk_path_mapping[\$key]}" >> /tmp/log
+ done
+else
+ echo "/dev/disk/by-path does not exist" >> /tmp/log
+fi
+
+declare -A partition_disks
+declare -A disks
+set \$(list-harddrives)
+let disk_nums=\$#/2
+let disk_offset=0
+let found_disk_offset=0
+while [ \$disk_offset -lt \$disk_nums ]; do
+ disk=\$1
+ disk_name=\$(basename \$disk)
+ let offset=\${disk_offset}
+ let disk_offset=\${disk_offset}+1
+ shift 2
+ if [[ x"\${disk_mapping[\${disk_name}]}" == x"" ]]; then
+ if [[ x"\${ignore_disk_mapping[\${disk_name}]}" != x"" ]]; then
+ echo "ignore disk \${disk_name} since it is not in disk_mapping" >> /tmp/log
+ continue
+ else
+ echo "did not found disk path for \$disk but it is not ignored" >> /tmp/log
+ disk_mapping[\${disk_name}]="/dev/\${disk_name}"
+ disk_path_mapping[\${disk_name}]="/dev/\${disk_name}"
+ fi
+ fi
+ let found_disk=0
+
+#if $getVar('partition_by_path', '0') != "0"
+ disk=\${disk_mapping[\${disk_name}]}
+#end if
+ disks[\$offset]=\$disk
+
+#if $getVar('partitions_only', '') != ""
+ #for $partition_only in $partitions_only.split(',')
+ #if not $partition_only
+ #continue
+ #end if
+ if expr match "\${disk_name}" "$partition_only"; then
+ let found_disk=1
+ else
+ echo "disk \${disk_name} does not match $partition_only" >> /tmp/log
+ fi
+ #end for
+#else
+ let found_disk=1
+#end if
+
+ if [ \${found_disk} -gt 0 ]; then
+ echo "add disk \${disk_name} in partitioning list" >> /tmp/log
+ partition_disks[\${found_disk_offset}]=\$disk
+ let found_disk_offset=\${found_disk_offset}+1
+ fi
+done
+echo "partition disks \${partition_disks[@]}" >> /tmp/log
+echo "disks \${disks[@]}" >> /tmp/log
+
+#if $getVar('sort_disks', '0') != "0"
+sorted_disks=(\$(printf '%s\n' \${partition_disks[@]} | sort))
+#else
+sorted_disks=(\${partition_disks[@]})
+#end if
+echo "sorted disks \${sorted_disks[@]}" >> /tmp/log
+
+#if $getVar('start_from_disk', '') != ""
+ #set $start_from_disk = $int($start_from_disk)
+ #if $start_from_disk > 0
+ #set $disk_start_offset = $start_from_disk - 1
+ #else
+ #set $disk_start_offset = 0
+ #end if
+set \${sorted_disks[@]}
+shift $disk_start_offset
+unset sorted_disks
+sorted_disks=(\$@)
+echo "sorted disks begin from the $start_from_disk: \${sorted_disks[@]}" >> /tmp/log
+#end if
+
+#if $getVar('disk_num', '') != ""
+set \${sorted_disks[@]}
+unset sorted_disks
+sorted_disks=(\$(printf '%s\n' \$@ | head -n${disk_num}))
+echo "sorted disks for $disk_num disks: \${sorted_disks[@]}" >> /tmp/log
+#end if
+
+first_disk=""
+for disk in \${sorted_disks}; do
+ if [ -z "\${first_disk}" ]; then
+ first_disk=\${disk}
+ break
+ fi
+done
+echo "first disk \${first_disk}" >> /tmp/log
+
+let disk_nums=\${#sorted_disks[@]}
+sorted_disks_str=""
+for disk in \${sorted_disks[@]}; do
+ if [ -z "${sorted_disks_str}" ]; then
+ sorted_disks_str="\${disk}"
+ else
+ sorted_disks_str="\${sorted_disks_str},\${disk}"
+ fi
+done
+
+echo "clearpart --all --initlabel" > /tmp/part-include
+
+declare -A remove_disks
+let remove_disk_offset=0
+#if $getVar('keep_old_partitions', '0') != "0"
+for disk in \${sorted_disks[@]}; do
+ dd if=/dev/zero of=\${disk} bs=512 count=1
+ remove_disks[\${remove_disk_offset}]=\$disk
+ let remove_disk_offset=\${remove_disk_offset}+1
+done
+echo "only partition \$sorted_disks_str" >> /tmp/log
+echo "ignoredisk --only-use=\$sorted_disks_str" >> /tmp/part-include
+#else
+for disk in \${disks[@]}; do
+ dd if=/dev/zero of=\${disk} bs=512 count=1
+ remove_disks[\${remove_disk_offset}]=\$disk
+ let remove_disk_offset=\${remove_disk_offset}+1
+done
+#end if
+echo "remove disks \${remove_disks[@]}" >> /tmp/log
+
+disk_partitions=\$(pvs --noheadings --separator :| cut -d: -f1)
+remove_partitions=""
+remove_vgs=""
+for disk_partition in \${disk_partitions}; do
+ vg=\$(pvs --noheadings --separator : \${disk_partition} | cut -d: -f2)
+ remove_vg=""
+ remove_partition=""
+ for remove_disk in \${remove_disks[@]}; do
+#if $getVar('partition_by_path', '0') != "0"
+ path_name=\$(basename \${remove_disk})
+ remove_disk_path=\${remove_disk}
+ remove_disk=\${disk_path_mapping[\${path_name}]}
+#else
+ disk_name=\$(basename \${remove_disk})
+ remove_disk_path=\${disk_mapping[\${disk_name}]}
+#end if
+ if [ -z "\${remove_disk}" ]; then
+ continue
+ fi
+ if [ -z "\${remove_disk_path}" ]; then
+ continue
+ fi
+ if expr match "\${disk_partition}" "\${remove_disk_path}.*"; then
+ remove_vg="\$vg"
+ remove_partition="\${disk_partition}"
+ else
+ echo "partition \${disk_partition} does not match \${remove_disk_path}.*" >> /tmp/log
+ fi
+ if expr match "\${disk_partition}" "\${remove_disk}.*"; then
+ remove_vg="\$vg"
+ remove_partition="\${disk_partition}"
+ else
+ echo "partition \${disk_partition} does not match \${remove_disk}.*" >> /tmp/log
+ fi
+ if [[ "\$vg" == "$vgname" ]]; then
+ remove_vg="\$vg"
+ remove_partition="\${disk_partition}"
+ fi
+ done
+ if [ ! -z "\${remove_vg}" ]; then
+ if [ -z "\${remove_vgs}" ]; then
+ remove_vgs="\${remove_vg}"
+ else
+ vg_removed=0
+ for vg in \${remove_vgs}; do
+ if [[ "\$vg" == "\${remove_vg}" ]]; then
+ vg_removed=1
+ fi
+ done
+ if [ \${vg_removed} -eq 0 ]; then
+ remove_vgs="\${remove_vgs} \${remove_vg}"
+ fi
+ fi
+ fi
+ if [ ! -z "\${remove_partition}" ]; then
+ if [ -z "\${remove_partitions}" ]; then
+ remove_partitions="\${remove_partition}"
+ else
+ pv_removed=0
+ for pv in ${remove_partitions}; do
+ if [[ "\$pv" == "\${remove_partition}" ]]; then
+ pv_removed=1
+ fi
+ done
+ if [ \${pv_removed} -eq 0 ]; then
+ remove_partitions="\${remove_partitions} \${remove_partition}"
+ fi
+ fi
+ fi
+done
+
+echo "remove vgs \${remove_vgs}" >> /tmp/log
+for remove_vg in \${remove_vgs}; do
+ vgremove -f \${remove_vg}
+done
+
+echo "remove partitions \${remove_partitions} from \${remove_vgs}" >> /tmp/log
+for remove_partition in \${remove_partitions}; do
+ pvremove -ff -y \${remove_partition}
+done
+
+declare -A reserve_disks_size
+#if $disk_reserve_size != None
+ #set disk_sizes = [disk_size.strip() for disk_size in $disk_reserve_size.split(';') if disk_size.strip()]
+ #for disk_and_size in $disk_sizes
+ #set disk_name, size = $disk_and_size.split(' ', 1)
+ #set disk_name = $disk_name.strip()
+ #if $size.endswith('K')
+ #set disk_size = $int($size[:-1]) / 1000
+ #elif size.endswith('M')
+ #set disk_size = $int($size[:-1])
+ #elif $size.endswith('G')
+ #set disk_size = $int($size[:-1]) * 1000
+ #elif $size.endswith('T')
+ #set disk_size = $int($size[:-1]) * 1000000
+ #else
+ #set disk_size = $int($size)
+ #end if
+reserve_disks_size[${disk_name}]=${disk_size}
+ #end for
+#end if
+
+#if $default_disk_reserve_size.endswith('K')
+ #set disk_size = $int($default_disk_reserve_size[:-1]) / 1000
+#elif $default_disk_reserve_size.endswith('M')
+ #set disk_size = $int($default_disk_reserve_size[:-1])
+#elif $default_disk_reserve_size.endswith('G')
+ #set disk_size = $int($default_disk_reserve_size[:-1]) * 1000
+#elif $default_disk_reserve_size.endswith('T')
+ #set disk_size = $int($default_disk_reserve_size[:-1]) * 1000000
+#else
+ #set disk_size = $int($default_disk_reserve_size)
+#end if
+default_reserve_disk_size=${disk_size}
+
+declare -A max_disks_size
+#if $disk_max_size != None
+ #set disk_sizes = [disk_size.strip() for disk_size in $disk_max_size.split(';') if disk_size.strip()]
+ #for disk_and_size in $disk_sizes
+ #set disk_name, size = $disk_and_size.split(' ', 1)
+ #set disk_name = $disk_name.strip()
+ #if $size.endswith('K')
+ #set disk_size = $int($size[:-1]) / 1000
+ #elif $size.endswith('M')
+ #set disk_size = $int($size[:-1])
+ #elif $size.endswith('G')
+ #set disk_size = $int($size[:-1]) * 1000
+ #elif $size.endswith('T')
+ #set disk_size = $int($size[:-1]) * 1000000
+ #else
+ #set disk_size = $int($size)
+ #end if
+max_disks_size[${disk_name}]=${disk_size}
+ #end for
+#end if
+
+#if $default_disk_max_size.endswith('K')
+ #set disk_size = $int($default_disk_max_size[:-1]) / 1000
+#elif $default_disk_max_size.endswith('M')
+ #set disk_size = $int($default_disk_max_size[:-1])
+#elif $default_disk_max_size.endswith('G')
+ #set disk_size = $int($default_disk_max_size[:-1]) * 1000
+#elif $default_disk_max_size.endswith('T')
+ #set disk_size = $int($default_disk_max_size[:-1]) * 1000000
+#else
+ #set disk_size = $int($default_disk_max_size)
+#end if
+default_max_disk_size=${disk_size}
+
+declare -A partitions_percentage
+declare -A partitions_name
+declare -A partitions_size
+declare -A partitions_maxsize
+
+#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()
+ #if $vol == '/'
+ #set volname = 'root'
+ #elif $vol == 'swap'
+ #set volname = 'swap'
+ #elif $vol.startswith('/')
+ #set volname = $vol[1:].replace('/', '_')
+ #else
+ #set volname = ''
+# $vol is not starts with /
+ #continue
+ #end if
+partitions_name[$vol]=$volname
+ #set vol_size = $vol_size.strip()
+ #if $vol_size.endswith('%'):
+ #set vol_percent = $vol_size[:-1]
+partitions_percentage[$vol]=${vol_percent}
+ #else
+ #if $vol_size.endswith('K')
+ #set vol_min_size = $int($vol_size[:-1]) / 1000
+ #elif $vol_size.endswith('M')
+ #set vol_min_size = $int($vol_size[:-1])
+ #elif $vol_size.endswith('G')
+ #set vol_min_size = $int($vol_size[:-1]) * 1000
+ #elif $vol_size.endswith('T')
+ #set vol_min_size = $int($vol_size[:-1]) * 1000000
+ #else
+ #set vol_min_size = $int($vol_size)
+ #end if
+partitions_size[$vol]=${vol_min_size}
+ #end if
+ #end for
+#end if
+
+#if $partition_size != None
+ #set vol_sizes = [part.strip() for part in $partition_size.split(';') if part.strip()]
+ #for vol_and_size in $vol_sizes
+ #set vol, vol_size = $vol_and_size.split(' ', 1)
+ #set vol = $vol.strip()
+ #if $vol_size.endswith('K')
+ #set vol_min_size = $int($vol_size[:-1]) / 1000
+ #elif $vol_size.endswith('M')
+ #set vol_min_size = $int($vol_size[:-1])
+ #elif $vol_size.endswith('G')
+ #set vol_min_size = $int($vol_size[:-1]) * 1000
+ #elif $vol_size.endswith('T')
+ #set vol_min_size = $int($vol_size[:-1]) * 1000000
+ #else
+ #set vol_min_size = $int($vol_size)
+ #end if
+partitions_size[$vol]=${vol_min_size}
+ #end for
+#end if
+
+#if $partition_maxsize != None
+ #set vol_sizes = [part.strip() for part in $partition_maxsize.split(';') if part.strip()]
+ #for vol_and_size in $vol_sizes
+ #set vol, vol_size = $vol_and_size.split(' ', 1)
+ #set vol = $vol.strip()
+ #if $vol_size.endswith('K')
+ #set vol_max_size = $int($vol_size[:-1]) / 1000
+ #elif $vol_size.endswith('M')
+ #set vol_max_size = $int($vol_size[:-1])
+ #elif $vol_size.endswith('G')
+ #set vol_max_size = $int($vol_size[:-1]) * 1000
+ #elif $vol_size.endswith('T')
+ #set vol_max_size = $int($vol_size[:-1]) * 1000000
+ #else
+ #set vol_max_size = $int($vol_size)
+ #end if
+partitions_maxsize[$vol]=${vol_max_size}
+ #end for
+#end if
+
+default_partition=$getVar('default_partition', '/')
+partition_fstype=$getVar('partition_fstype', 'ext3')
+
+for key in \${!partitions_name[@]}; do
+ echo "partition names \$key => \${partitions_name[\$key]}" >> /tmp/log
+done
+
+for key in \${!partitions_percentage[@]}; do
+echo "partition percentage \$key => \${partitions_percentage[\$key]}" >> /tmp/log
+done
+
+for key in \${!partitions_size[@]}; do
+ echo "partition min size \$key => \${partitions_size[\$key]}" >> /tmp/log
+done
+
+echo "default partition \${default_partition}" >> /tmp/log
+echo "partition fstype \${partition_fstype}" >> /tmp/log
+
+for key in \${!partitions_maxsize[@]}; do
+ echo "partition max size \$key => \${partitions_maxsize[\$key]}" >> /tmp/log
+done
+
+partition_size=\${partitions_size[/boot]:-500}
+unset \${partitions_name[/boot]}
+#if $os_version == "rhel7"
+echo "bootloader --location=mbr --boot-drive=\${sorted_disks[0]}" >> /tmp/part-include
+#else
+echo "bootloader --location=mbr --driveorder=\${sorted_disks[0]}" >> /tmp/part-include
+#end if
+echo "zerombr" >> /tmp/part-include
+echo "part biosboot --fstype=biosboot --size=1 --ondisk=\${sorted_disks[0]} --asprimary" >> /tmp/part-include
+echo "part /boot --fstype=\${partition_fstype} --size=\${partition_size} --ondisk=\${sorted_disks[0]} --asprimary" >> /tmp/part-include
+partition_size=\${partitions_size[swap]:-0}
+if [[ "\$partition_size" == "0" ]]; then
+ partition_maxsize=\${partitions_maxsize[swap]:-128000}
+ echo "part swap --recommended --maxsize=\${partition_maxsize} --ondisk=\${sorted_disks[0]} --asprimary" >> /tmp/part-include
+else
+ echo "part swap --size=\${partition_size} --ondisk=\${sorted_disks[0]}" >> /tmp/part-include
+fi
+unset \${partitions_name[swap]}
+
+if [[ x"\${partitions_name[/]}" == x"" ]]; then
+ partitions_name[/]="root"
+fi
+
+echo "partition disks" >> /tmp/log
+
+vggroup=''
+let disk_nums=\${#sorted_disks[@]}
+let disk_offset=0
+while [ \${disk_offset} -lt \${disk_nums} ]; do
+ disk=\${sorted_disks[\${disk_offset}]}
+ let disk_offset=\$disk_offset+1;
+ let pv_id=\${disk_offset}
+ partname="pv.0\${pv_id}"
+ if [ ! -z "\${max_disks_size[\${disk}]}" ]; then
+ max_disk_size=\${max_disks_size[\${disk}]}
+ else
+ max_disk_size=\${default_max_disk_size}
+ fi
+ echo "partition \${disk} max size \${max_disk_size}" >> /tmp/log
+ if [ \${max_disk_size} -gt 0 ]; then
+ maxsize_param="--maxsize=\${max_disk_size}"
+ else
+ maxsize_param=""
+ fi
+ echo "part \$partname --size=1 --grow \${maxsize_param} --ondisk=\${disk}" >> /tmp/part-include
+ vggroup="\$vggroup \$partname"
+ if [ ! -z "\${reserve_disks_size[\$disk]}" ]; then
+ reserve_disk_size=\${reserve_disks_size[\$disk]}
+ else
+ reserve_disk_size=\${default_reserve_disk_size}
+ fi
+ echo "reserve \${reserve_disk_size} on \${disk}" >> /tmp/log
+ if [ \${reserve_disk_size} -gt 0 ]; then
+ reserve_partname="pv.1\${pv_id}"
+ echo "part \${reserve_partname} --size=\${reserve_disk_size} --ondisk=\${disk}" >> /tmp/part-include
+ reserve_vggroup="\${reserve_vggroup} \${reserve_partname}"
+ fi
+done
+
+if [ ! -z "\$vggroup" ]; then
+ echo "volgroup $vgname \$vggroup" >> /tmp/part-include
+fi
+if [ ! -z "\${reserve_vggroup}" ]; then
+ echo "volgroup reserved \${reserve_vggroup}" >> /tmp/part-include
+fi
+
+declare -A sorted_partitions
+sorted_partitions[0]=\${default_partition}
+let sorted_partition_offset=1
+for key in \${!partitions_name[@]}; do
+ if [[ "\$key" != "\${default_partition}" ]]; then
+ sorted_partitions[\${sorted_partition_offset}]=\$key
+ let sorted_partition_offset=\${sorted_partition_offset}+1
+ fi
+done
+
+for key in \${sorted_partitions[@]}; do
+ partition_name=\${partitions_name[\$key]}
+ if [[ "\$key" == "\${default_partition}" ]]; then
+ grow_param="--grow"
+ else
+ grow_param=""
+ fi
+ partition_percentage=\${partitions_percentage[\$key]}
+ if [[ x"\${partition_percentage}" != x"" ]]; then
+ percentage_param="--percent=\${partition_percentage}"
+ grow_param="--grow"
+ else
+ percentage_param=""
+ fi
+ partition_size=\${partitions_size[\$key]}
+ if [[ x"\${partition_size}" != x"" ]]; then
+ size_param="--size=\${partition_size}"
+ else
+ size_param=""
+ fi
+ partition_maxsize=\${partitions_maxsize[\$key]}
+ if [[ x"\${partition_maxsize}" != x"" ]]; then
+ maxsize_param="--maxsize=\${partition_maxsize}"
+ else
+ maxsize_param=""
+ fi
+ echo "logvol \$key --fstype=\${partition_fstype} --vgname=$vgname \${percentage_param} \${size_param} \${maxsize_param} \${grow_param} --name=\${partition_name}vol" >> /tmp/part-include
+done
diff --git a/deploy/adapters/cobbler/snippets/kickstart_rsyslog.conf b/deploy/adapters/cobbler/snippets/kickstart_rsyslog.conf
new file mode 100644
index 00000000..33af044a
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/kickstart_rsyslog.conf
@@ -0,0 +1,66 @@
+cat << EOL > /etc/rsyslog.conf
+\#\#\#\# MODULES \#\#\#\##
+
+\\$ModLoad imuxsock # provides support for local system logging (e.g. via logger command)
+\\$ModLoad imfile
+
+\\$WorkDirectory /var/lib/rsyslog
+\\$ActionQueueType LinkedList
+\\$ActionQueueFileName srvrfwd
+\\$ActionResumeRetryCount -1
+\\$ActionQueueSaveOnShutDown on
+#if $getVar("compass_server", "") != ""
+\# *.* @@$compass_server:514
+#else
+\# *.* @@$server:514
+#end if
+
+\# Provides UDP syslog reception
+\#\\$ModLoad imudp
+\#\\$UDPServerRun 514
+
+\# Provides TCP syslog reception
+\\$ModLoad imtcp
+\\$InputTCPServerRun 514
+#set system_name = $getVar('system_name','')
+\\$LocalHostName $system_name
+
+\#\#\#\# 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 anything (except mail) of level info or higher.
+\# Don't log private authentication messages!
+syslog.*,daemon.* /var/log/messages
+
+\# The authpriv file has restricted access.
+authpriv.* /var/log/secure
+
+\# 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
+
+EOL
+chkconfig rsyslog on
diff --git a/deploy/adapters/cobbler/snippets/kickstart_software_chef b/deploy/adapters/cobbler/snippets/kickstart_software_chef
new file mode 100644
index 00000000..398ae94a
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/kickstart_software_chef
@@ -0,0 +1 @@
+chef
diff --git a/deploy/adapters/cobbler/snippets/kickstart_ssh b/deploy/adapters/cobbler/snippets/kickstart_ssh
new file mode 100644
index 00000000..2ffedaae
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/kickstart_ssh
@@ -0,0 +1,34 @@
+#set ssh_keys = $getVar("push_ssh_keys", "/root/.ssh/id_rsa.pub")
+#if $ssh_keys != ""
+ #set user_name = $getVar("username", "root")
+ #if $user_name == "root"
+ #set home = "/root"
+ #else
+ #set home = "/home/%s" % $user_name
+ #end if
+mkdir -p $home/.ssh
+chmod 700 -R $home/.ssh
+ #set $firstline = True
+ #for $ssh_key in $ssh_keys.split(',')
+ #if not $ssh_key
+ #continue
+ #end if
+ #try
+ #set f = $open($ssh_key)
+ #if $firstline
+cat << EOL > $home/.ssh/authorized_keys
+ #echo $f.read()
+EOL
+ #else
+cat << EOL >> $home/.ssh/authorized_keys
+ #echo $f.read()
+EOL
+ #end if
+ #set $firstline = False
+ #silent $f.close()
+ #except
+# failed to read from $ssh_key
+ #end try
+ #end for
+chmod 600 $home/.ssh/authorized_keys
+#end if
diff --git a/deploy/adapters/cobbler/snippets/kickstart_start b/deploy/adapters/cobbler/snippets/kickstart_start
new file mode 100644
index 00000000..13705c88
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/kickstart_start
@@ -0,0 +1,30 @@
+#set system_name = $getVar('system_name','')
+#set profile_name = $getVar('profile_name','')
+#set breed = $getVar('breed','')
+#set srv = $getVar('http_server','')
+#set run_install_triggers = $str($getVar('run_install_triggers',''))
+#set runpre = ""
+#if $system_name != ''
+ ## RUN PRE TRIGGER
+ #if $run_install_triggers in [ "1", "true", "yes", "y" ]
+ #if $breed == 'redhat'
+ #set runpre = "\nwget \"http://%s/cblr/svc/op/trig/mode/pre/%s/%s\" -O /dev/null" % (srv, "system", system_name)
+ #else if $breed == 'vmware'
+ #set runpre = "\nwget \"http://%s/cblr/svc/op/trig/mode/pre/%s/%s\" -O /dev/null" % (srv, "system", system_name)
+ #else if $breed == 'debian' or $breed == 'ubuntu'
+ #set runpre = "wget \"http://%s/cblr/svc/op/trig/mode/pre/%s/%s\" -O /dev/null" % (srv, "system", system_name)
+ #else if $breed == 'vmware'
+ #set runpre = "wget \"http://%s/cblr/svc/op/trig/mode/pre/%s/%s\" -O /dev/null" % (srv, "system", system_name)
+ #end if
+ #end if
+#else if $profile_name != ''
+ ## RUN PRE TRIGGER
+ #if $run_install_triggers in [ "1", "true", "yes", "y" ]
+ #if $breed == 'redhat'
+ #set runpre = "\nwget \"http://%s/cblr/svc/op/trig/mode/pre/%s/%s\" -O /dev/null" % (srv, "profile", profile_name)
+ #else if $breed == 'vmware'
+ #set runpre = "\nwget \"http://%s/cblr/svc/op/trig/mode/pre/%s/%s\" -O /dev/null" % (srv, "profile", profile_name)
+ #end if
+ #end if
+#end if
+#echo $runpre
diff --git a/deploy/adapters/cobbler/snippets/kickstart_sysctl.conf b/deploy/adapters/cobbler/snippets/kickstart_sysctl.conf
new file mode 100644
index 00000000..c227ecfa
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/kickstart_sysctl.conf
@@ -0,0 +1,72 @@
+cat << EOF > /etc/sysctl.conf
+#raw
+# Kernel sysctl configuration file for Red Hat Linux
+#
+# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
+# sysctl.conf(5) for more details.
+
+# Controls IP packet forwarding
+net.ipv4.ip_forward = 0
+
+# Controls source route verification
+net.ipv4.conf.default.rp_filter = 1
+
+# Do not accept source routing
+net.ipv4.conf.default.accept_source_route = 0
+
+# Controls the System Request debugging functionality of the kernel
+kernel.sysrq = 0
+
+# Controls whether core dumps will append the PID to the core filename.
+# Useful for debugging multi-threaded applications.
+kernel.core_uses_pid = 1
+
+# Controls the use of TCP syncookies
+net.ipv4.tcp_syncookies = 1
+
+# Controls the default maxmimum size of a mesage queue
+kernel.msgmnb = 65536
+
+# Controls the maximum size of a message, in bytes
+kernel.msgmax = 65536
+
+# Controls the maximum shared segment size, in bytes
+kernel.shmmax = 68719476736
+
+# Controls the maximum number of shared memory segments, in pages
+kernel.shmall = 4294967296
+
+# increase TCP max buffer size settable using setsockopt()
+net.core.rmem_max = 16777216
+net.core.wmem_max = 16777216
+
+# increase Linux autotuning TCP buffer limit
+net.ipv4.tcp_rmem = 4096 87380 16777216
+net.ipv4.tcp_wmem = 4096 65536 16777216
+
+# increase the length of the processor input queue
+net.core.netdev_max_backlog = 30000
+net.ipv4.tcp_max_syn_backlog = 4096
+
+# recommended default congestion control is htcp
+net.ipv4.tcp_congestion_control=htcp
+
+# recommended for hosts with jumbo frames enabled
+net.ipv4.tcp_mtu_probing=1
+
+# increase client parallel connections
+net.ipv4.ip_local_port_range = 15000 61000
+net.ipv4.tcp_fin_timeout=30
+
+# fast cycling of sockets in time_wait state and re-using them
+net.ipv4.tcp_tw_recycle = 1
+net.ipv4.tcp_tw_reuse = 1
+
+# increase the maximum number of requests queued to a listen socket
+net.core.somaxconn = 8192
+
+# avoid caching tcp network transfer statistics
+net.ipv4.route.flush=1
+#end raw
+EOF
+sysctl -p
diff --git a/deploy/adapters/cobbler/snippets/kickstart_yum b/deploy/adapters/cobbler/snippets/kickstart_yum
new file mode 100644
index 00000000..c33ba0f1
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/kickstart_yum
@@ -0,0 +1,91 @@
+cat << EOF > /etc/yum.conf
+[main]
+cachedir=/var/cache/yum/\\$basearch/\\$releasever
+#if $getVar('proxy', '') != ""
+proxy=$proxy
+#end if
+keepcache=1
+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
+EOF
+
+mkdir -p /root/repo_backup
+mv -f /etc/yum.repos.d/* /root/repo_backup/
+
+#set profile_name = $getVar('profile_name','')
+#set os_info = $profile_name.split('-')
+#set osname = $os_info[0].lower()
+#set osversion = $os_info[1]
+#set osversion_flat = $osversion.replace('.', '_')
+
+cat << EOF > /etc/yum.repos.d/${osname}_${osversion_flat}_os_repo.repo
+[${osname}_${osversion_flat}_os_repo]
+name=${osname} - ${osname}_${osversion_flat}_os_repo
+proxy=_none_
+baseurl=$tree
+enabled=1
+gpgcheck=0
+skip_if_unavailable=1
+EOF
+
+#set $repo_data = $getVar("repo_data",[])
+#for $repo in $repo_data
+cat << EOF > /etc/yum.repos.d/${repo.name}.repo
+[$repo.name]
+name=${osname} - $repo.name
+ #if $repo.mirror_locally
+baseurl=http://$http_server/cblr/repo_mirror/${repo.name}
+proxy=_none_
+ #else
+baseurl=${repo.mirror}
+ #end if
+enabled=1
+gpgcheck=0
+priority=${repo.priority}
+skip_if_unavailable=1
+EOF
+#end for
+
+#if $getVar("local_repo", "") == "" or $getVar("local_repo_only","1") == "0"
+ #set repos_snippet = 'yum.repos.d/%s/%s/kickstart_repos' % ($osname, $osversion)
+$SNIPPET($repos_snippet)
+#end if
+
+#if $getVar("local_repo","") != ""
+ #set repo = 'yum.repos.d/%s/%s/centos_repo' % ($osname, $osversion)
+cat << EOF > /etc/yum.repos.d/Compass.repo
+[compass_repo]
+name=Compass yum repo
+baseurl=$local_repo/$repo
+enabled=1
+gpgcheck=0
+priority=1
+proxy=_none_
+skip_if_unavailable=1
+EOF
+
+ #if $getVar("local_repo_only","1") != "0"
+yum -y update
+rm -rf /etc/yum.repos.d/CentOS-*.repo
+ #end if
+#end if
diff --git a/deploy/adapters/cobbler/snippets/kickstart_yum_repo_config b/deploy/adapters/cobbler/snippets/kickstart_yum_repo_config
new file mode 100644
index 00000000..9aae52ee
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/kickstart_yum_repo_config
@@ -0,0 +1,11 @@
+# Repository Config
+#set $repo_data = $getVar("repo_data",[])
+#for $repo in $repo_data
+#if $repo.mirror_locally
+repo --name=${repo.name} --baseurl=http://$http_server/cobbler/repo_mirror/${repo.name}/
+#else
+repo --name=${repo.name} --baseurl=${repo.mirror}
+#end if
+#end for
+
+
diff --git a/deploy/adapters/cobbler/snippets/preseed_chef_run.sh b/deploy/adapters/cobbler/snippets/preseed_chef_run.sh
index ade6215f..19d7eee3 100644
--- a/deploy/adapters/cobbler/snippets/preseed_chef_run.sh
+++ b/deploy/adapters/cobbler/snippets/preseed_chef_run.sh
@@ -32,8 +32,8 @@ PIDFILE=/tmp/chef_client_run.pid
if [ -f \\$PIDFILE ]; then
pid=\\$(cat \\$PIDFILE)
if [ -f /proc/\\$pid/exe ]; then
- echo "there are chef_client_run.sh running with pid \\$pid" >> /var/log/chef.log 2>&1
- exit 1
+ echo "there are chef_client_run.sh running with pid \\$pid" >> /var/log/chef.log 2>&1
+ exit 1
fi
fi
echo \\$$ > \\$PIDFILE
diff --git a/deploy/adapters/cobbler/snippets/preseed_pre_install_network_config b/deploy/adapters/cobbler/snippets/preseed_pre_install_network_config
index 2ea74799..e2d45df7 100644
--- a/deploy/adapters/cobbler/snippets/preseed_pre_install_network_config
+++ b/deploy/adapters/cobbler/snippets/preseed_pre_install_network_config
@@ -34,7 +34,7 @@ get_ifname() {
#set ikeys = $interfaces.keys()
#for $iname in $ikeys
#set $idata = $interfaces[$iname]
- #set $management = $idata["management"]
+ #set $management = $idata["management"]
#if $management
#set $management_nic = $iname
#end if
diff --git a/deploy/adapters/cobbler/snippets/sysctl.xml b/deploy/adapters/cobbler/snippets/sysctl.xml
new file mode 100644
index 00000000..fe13bf7f
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/sysctl.xml
@@ -0,0 +1,78 @@
+<file>
+ <file_path>/etc/sysctl.conf</file_path>
+ <file_contents>
+<![CDATA[
+#raw
+# Kernel sysctl configuration file for Red Hat Linux
+#
+# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
+# sysctl.conf(5) for more details.
+
+# Controls IP packet forwarding
+net.ipv4.ip_forward = 0
+
+# Controls source route verification
+net.ipv4.conf.default.rp_filter = 1
+
+# Do not accept source routing
+net.ipv4.conf.default.accept_source_route = 0
+
+# Controls the System Request debugging functionality of the kernel
+kernel.sysrq = 0
+
+# Controls whether core dumps will append the PID to the core filename.
+# Useful for debugging multi-threaded applications.
+kernel.core_uses_pid = 1
+
+# Controls the use of TCP syncookies
+net.ipv4.tcp_syncookies = 1
+
+# Controls the default maxmimum size of a mesage queue
+kernel.msgmnb = 65536
+
+# Controls the maximum size of a message, in bytes
+kernel.msgmax = 65536
+
+# Controls the maximum shared segment size, in bytes
+kernel.shmmax = 68719476736
+
+# Controls the maximum number of shared memory segments, in pages
+kernel.shmall = 4294967296
+
+# increase TCP max buffer size settable using setsockopt()
+net.core.rmem_max = 16777216
+net.core.wmem_max = 16777216
+
+# increase Linux autotuning TCP buffer limit
+net.ipv4.tcp_rmem = 4096 87380 16777216
+net.ipv4.tcp_wmem = 4096 65536 16777216
+
+# increase the length of the processor input queue
+net.core.netdev_max_backlog = 30000
+net.ipv4.tcp_max_syn_backlog = 4096
+
+# recommended default congestion control is htcp
+net.ipv4.tcp_congestion_control=htcp
+
+# recommended for hosts with jumbo frames enabled
+net.ipv4.tcp_mtu_probing=1
+
+# increase client parallel connections
+net.ipv4.ip_local_port_range = 15000 61000
+net.ipv4.tcp_fin_timeout=30
+
+# fast cycling of sockets in time_wait state and re-using them
+net.ipv4.tcp_tw_recycle = 1
+net.ipv4.tcp_tw_reuse = 1
+
+# increase the maximum number of requests queued to a listen socket
+net.core.somaxconn = 8192
+
+# avoid caching tcp network transfer statistics
+net.ipv4.route.flush=1
+#end raw
+]]>
+ </file_contents>
+ <file_owner>root.root</file_owner>
+ <file_permissions>644</file_permissions>
+</file>
diff --git a/deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.5/kickstart_centos_base_repo b/deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.5/kickstart_centos_base_repo
new file mode 100644
index 00000000..ee01aa32
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.5/kickstart_centos_base_repo
@@ -0,0 +1,59 @@
+cat << EOF > /etc/yum.repos.d/CentOS-Base.repo
+# CentOS-Base.repo
+#
+# The mirror system uses the connecting IP address of the client and the
+# update status of each mirror to pick mirrors that are updated to and
+# geographically close to the client. You should use this for CentOS updates
+# unless you are manually picking other mirrors.
+#
+# If the mirrorlist= does not work for you, as a fall back you can try the
+# remarked out baseurl= line instead.
+#
+#
+
+[base]
+name=CentOS-6.5 - Base
+mirrorlist=http://mirrorlist.centos.org/?release=6&arch=\\$basearch&repo=os
+baseurl=http://mirror.centos.org/centos/6/os/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+skip_if_unavailable=1
+
+# released updates
+[updates]
+name=CentOS-6.5 - Updates
+mirrorlist=http://mirrorlist.centos.org/?release=6&arch=\\$basearch&repo=updates
+baseurl=http://mirror.centos.org/centos/6/updates/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+skip_if_unavailable=1
+
+# additional packages that may be useful
+[extras]
+name=CentOS-6.5 - Extras
+mirrorlist=http://mirrorlist.centos.org/?release=6&arch=\\$basearch&repo=extras
+baseurl=http://mirror.centos.org/centos/6/extras/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+skip_if_unavailable=1
+
+#additional packages that extend functionality of existing packages
+[centosplus]
+name=CentOS-6.5 - Plus
+mirrorlist=http://mirrorlist.centos.org/?release=6&arch=\\$basearch&repo=centosplus
+baseurl=http://mirror.centos.org/centos/6/centosplus/\\$basearch/
+gpgcheck=1
+enabled=0
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+skip_if_unavailable=1
+
+#contrib - packages by Centos Users
+[contrib]
+name=CentOS-6.5 - Contrib
+mirrorlist=http://mirrorlist.centos.org/?release=6&arch=\\$basearch&repo=contrib
+baseurl=http://mirror.centos.org/centos/6/contrib/\\$basearch/
+gpgcheck=1
+enabled=0
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+skip_if_unavailable=1
+EOF
diff --git a/deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.5/kickstart_centos_debuginfo_repo b/deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.5/kickstart_centos_debuginfo_repo
new file mode 100644
index 00000000..a8e8853e
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.5/kickstart_centos_debuginfo_repo
@@ -0,0 +1,23 @@
+cat << EOF > /etc/yum.repos.d/CentOS-Debuginfo.repo
+# CentOS-Debug.repo
+#
+# The mirror system uses the connecting IP address of the client and the
+# update status of each mirror to pick mirrors that are updated to and
+# geographically close to the client. You should use this for CentOS updates
+# unless you are manually picking other mirrors.
+#
+
+# All debug packages from all the various CentOS-5 releases
+# are merged into a single repo, split by BaseArch
+#
+# Note: packages in the debuginfo repo are currently not signed
+#
+
+[debug]
+name=CentOS-6 - Debuginfo
+baseurl=http://debuginfo.centos.org/6/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-Debug-6
+enabled=0
+skip_if_unavailable=1
+EOF
diff --git a/deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.5/kickstart_centos_epel_repo b/deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.5/kickstart_centos_epel_repo
new file mode 100644
index 00000000..ce139eab
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.5/kickstart_centos_epel_repo
@@ -0,0 +1,25 @@
+cat << EOF > /etc/yum.repos.d/epel.repo
+[epel]
+name=Extra Packages for Enterprise Linux 6 - \\$basearch
+baseurl=http://download.fedoraproject.org/pub/epel/6/\\$basearch
+mirrorlist=http://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=\\$basearch
+failovermethod=priority
+enabled=1
+gpgcheck=0
+
+[epel-debuginfo]
+name=Extra Packages for Enterprise Linux 6 - \\$basearch - Debug
+baseurl=http://download.fedoraproject.org/pub/epel/6/\\$basearch/debug
+mirrorlist=http://mirrors.fedoraproject.org/metalink?repo=epel-debug-6&arch=\\$basearch
+failovermethod=priority
+enabled=0
+gpgcheck=0
+
+[epel-source]
+name=Extra Packages for Enterprise Linux 6 - \\$basearch - Source
+baseurl=http://download.fedoraproject.org/pub/epel/6/SRPMS
+mirrorlist=http://mirrors.fedoraproject.org/metalink?repo=epel-source-6&arch=\\$basearch
+failovermethod=priority
+enabled=0
+gpgcheck=0
+EOF
diff --git a/deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.5/kickstart_centos_epel_testing_repo b/deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.5/kickstart_centos_epel_testing_repo
new file mode 100644
index 00000000..c09468a0
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.5/kickstart_centos_epel_testing_repo
@@ -0,0 +1,25 @@
+cat << EOF > /etc/yum.repos.d/epel-testing.repo
+[epel-testing]
+name=Extra Packages for Enterprise Linux 6 - Testing - \\$basearch
+baseurl=http://download.fedoraproject.org/pub/epel/testing/6/\\$basearch
+mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=testing-epel6&arch=\\$basearch
+failovermethod=priority
+enabled=0
+gpgcheck=0
+
+[epel-testing-debuginfo]
+name=Extra Packages for Enterprise Linux 6 - Testing - \\$basearch - Debug
+baseurl=http://download.fedoraproject.org/pub/epel/testing/6/\\$basearch/debug
+mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=testing-debug-epel6&arch=\\$basearch
+failovermethod=priority
+enabled=0
+gpgcheck=0
+
+[epel-testing-source]
+name=Extra Packages for Enterprise Linux 6 - Testing - \\$basearch - Source
+baseurl=http://download.fedoraproject.org/pub/epel/testing/6/SRPMS
+mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=testing-source-epel6&arch=\\$basearch
+failovermethod=priority
+enabled=0
+gpgcheck=0
+EOF
diff --git a/deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.5/kickstart_centos_vault_repo b/deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.5/kickstart_centos_vault_repo
new file mode 100644
index 00000000..310736d4
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.5/kickstart_centos_vault_repo
@@ -0,0 +1,213 @@
+cat << EOF > /etc/yum.repos.d/CentOS-Vault.repo
+# CentOS-Vault.repo
+#
+# CentOS Vault holds packages from previous releases within the same CentOS Version
+# these are packages obsoleted by the current release and should usually not
+# be used in production
+#-----------------
+
+[C6.0-base]
+name=CentOS-6.0 - Base
+baseurl=http://vault.centos.org/6.0/os/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+[C6.0-updates]
+name=CentOS-6.0 - Updates
+baseurl=http://vault.centos.org/6.0/updates/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+[C6.0-extras]
+name=CentOS-6.0 - Extras
+baseurl=http://vault.centos.org/6.0/extras/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+[C6.0-contrib]
+name=CentOS-6.0 - Contrib
+baseurl=http://vault.centos.org/6.0/contrib/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+[C6.0-centosplus]
+name=CentOS-6.0 - CentOSPlus
+baseurl=http://vault.centos.org/6.0/centosplus/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+#-----------------
+
+[C6.1-base]
+name=CentOS-6.1 - Base
+baseurl=http://vault.centos.org/6.1/os/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+[C6.1-updates]
+name=CentOS-6.1 - Updates
+baseurl=http://vault.centos.org/6.1/updates/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+[C6.1-extras]
+name=CentOS-6.1 - Extras
+baseurl=http://vault.centos.org/6.1/extras/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+[C6.1-contrib]
+name=CentOS-6.1 - Contrib
+baseurl=http://vault.centos.org/6.1/contrib/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+[C6.1-centosplus]
+name=CentOS-6.1 - CentOSPlus
+baseurl=http://vault.centos.org/6.1/centosplus/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+#-----------------
+
+[C6.2-base]
+name=CentOS-6.2 - Base
+baseurl=http://vault.centos.org/6.2/os/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+[C6.2-updates]
+name=CentOS-6.2 - Updates
+baseurl=http://vault.centos.org/6.2/updates/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+[C6.2-extras]
+name=CentOS-6.2 - Extras
+baseurl=http://vault.centos.org/6.2/extras/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+[C6.2-contrib]
+name=CentOS-6.2 - Contrib
+baseurl=http://vault.centos.org/6.2/contrib/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+[C6.2-centosplus]
+name=CentOS-6.2 - CentOSPlus
+baseurl=http://vault.centos.org/6.2/centosplus/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+#-----------------
+
+[C6.3-base]
+name=CentOS-6.3 - Base
+baseurl=http://vault.centos.org/6.3/os/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+[C6.3-updates]
+name=CentOS-6.3 - Updates
+baseurl=http://vault.centos.org/6.3/updates/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+[C6.3-extras]
+name=CentOS-6.3 - Extras
+baseurl=http://vault.centos.org/6.3/extras/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+[C6.3-contrib]
+name=CentOS-6.3 - Contrib
+baseurl=http://vault.centos.org/6.3/contrib/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+[C6.3-centosplus]
+name=CentOS-6.3 - CentOSPlus
+baseurl=http://vault.centos.org/6.3/centosplus/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+#-----------------
+
+[C6.4-base]
+name=CentOS-6.4 - Base
+baseurl=http://vault.centos.org/6.4/os/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+[C6.4-updates]
+name=CentOS-6.4 - Updates
+baseurl=http://vault.centos.org/6.4/updates/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+[C6.4-extras]
+name=CentOS-6.4 - Extras
+baseurl=http://vault.centos.org/6.4/extras/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+[C6.4-contrib]
+name=CentOS-6.4 - Contrib
+baseurl=http://vault.centos.org/6.4/contrib/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+[C6.4-centosplus]
+name=CentOS-6.4 - CentOSPlus
+baseurl=http://vault.centos.org/6.4/centosplus/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+EOF
diff --git a/deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.5/kickstart_repos b/deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.5/kickstart_repos
new file mode 100644
index 00000000..d7914337
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.5/kickstart_repos
@@ -0,0 +1,5 @@
+$SNIPPET('yum.repos.d/centos/6.5/kickstart_centos_base_repo')
+$SNIPPET('yum.repos.d/centos/6.5/kickstart_centos_debuginfo_repo')
+$SNIPPET('yum.repos.d/centos/6.5/kickstart_centos_vault_repo')
+$SNIPPET('yum.repos.d/centos/6.5/kickstart_centos_epel_repo')
+$SNIPPET('yum.repos.d/centos/6.5/kickstart_centos_epel_testing_repo')
diff --git a/deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.6/kickstart_centos_base_repo b/deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.6/kickstart_centos_base_repo
new file mode 100644
index 00000000..7116ade2
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.6/kickstart_centos_base_repo
@@ -0,0 +1,59 @@
+cat << EOF > /etc/yum.repos.d/CentOS-Base.repo
+# CentOS-Base.repo
+#
+# The mirror system uses the connecting IP address of the client and the
+# update status of each mirror to pick mirrors that are updated to and
+# geographically close to the client. You should use this for CentOS updates
+# unless you are manually picking other mirrors.
+#
+# If the mirrorlist= does not work for you, as a fall back you can try the
+# remarked out baseurl= line instead.
+#
+#
+
+[base]
+name=CentOS-6.6 - Base
+mirrorlist=http://mirrorlist.centos.org/?release=6&arch=\\$basearch&repo=os
+baseurl=http://mirror.centos.org/centos/6/os/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+skip_if_unavailable=1
+
+# released updates
+[updates]
+name=CentOS-6.6 - Updates
+mirrorlist=http://mirrorlist.centos.org/?release=6&arch=\\$basearch&repo=updates
+baseurl=http://mirror.centos.org/centos/6/updates/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+skip_if_unavailable=1
+
+# additional packages that may be useful
+[extras]
+name=CentOS-6.6 - Extras
+mirrorlist=http://mirrorlist.centos.org/?release=6&arch=\\$basearch&repo=extras
+baseurl=http://mirror.centos.org/centos/6/extras/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+skip_if_unavailable=1
+
+#additional packages that extend functionality of existing packages
+[centosplus]
+name=CentOS-6.6 - Plus
+mirrorlist=http://mirrorlist.centos.org/?release=6&arch=\\$basearch&repo=centosplus
+baseurl=http://mirror.centos.org/centos/6/centosplus/\\$basearch/
+gpgcheck=1
+enabled=0
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+skip_if_unavailable=1
+
+#contrib - packages by Centos Users
+[contrib]
+name=CentOS-6.6 - Contrib
+mirrorlist=http://mirrorlist.centos.org/?release=6&arch=\\$basearch&repo=contrib
+baseurl=http://mirror.centos.org/centos/6/contrib/\\$basearch/
+gpgcheck=1
+enabled=0
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+skip_if_unavailable=1
+EOF
diff --git a/deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.6/kickstart_centos_debuginfo_repo b/deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.6/kickstart_centos_debuginfo_repo
new file mode 100644
index 00000000..a8e8853e
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.6/kickstart_centos_debuginfo_repo
@@ -0,0 +1,23 @@
+cat << EOF > /etc/yum.repos.d/CentOS-Debuginfo.repo
+# CentOS-Debug.repo
+#
+# The mirror system uses the connecting IP address of the client and the
+# update status of each mirror to pick mirrors that are updated to and
+# geographically close to the client. You should use this for CentOS updates
+# unless you are manually picking other mirrors.
+#
+
+# All debug packages from all the various CentOS-5 releases
+# are merged into a single repo, split by BaseArch
+#
+# Note: packages in the debuginfo repo are currently not signed
+#
+
+[debug]
+name=CentOS-6 - Debuginfo
+baseurl=http://debuginfo.centos.org/6/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-Debug-6
+enabled=0
+skip_if_unavailable=1
+EOF
diff --git a/deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.6/kickstart_centos_epel_repo b/deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.6/kickstart_centos_epel_repo
new file mode 100644
index 00000000..ce139eab
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.6/kickstart_centos_epel_repo
@@ -0,0 +1,25 @@
+cat << EOF > /etc/yum.repos.d/epel.repo
+[epel]
+name=Extra Packages for Enterprise Linux 6 - \\$basearch
+baseurl=http://download.fedoraproject.org/pub/epel/6/\\$basearch
+mirrorlist=http://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=\\$basearch
+failovermethod=priority
+enabled=1
+gpgcheck=0
+
+[epel-debuginfo]
+name=Extra Packages for Enterprise Linux 6 - \\$basearch - Debug
+baseurl=http://download.fedoraproject.org/pub/epel/6/\\$basearch/debug
+mirrorlist=http://mirrors.fedoraproject.org/metalink?repo=epel-debug-6&arch=\\$basearch
+failovermethod=priority
+enabled=0
+gpgcheck=0
+
+[epel-source]
+name=Extra Packages for Enterprise Linux 6 - \\$basearch - Source
+baseurl=http://download.fedoraproject.org/pub/epel/6/SRPMS
+mirrorlist=http://mirrors.fedoraproject.org/metalink?repo=epel-source-6&arch=\\$basearch
+failovermethod=priority
+enabled=0
+gpgcheck=0
+EOF
diff --git a/deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.6/kickstart_centos_epel_testing_repo b/deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.6/kickstart_centos_epel_testing_repo
new file mode 100644
index 00000000..c09468a0
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.6/kickstart_centos_epel_testing_repo
@@ -0,0 +1,25 @@
+cat << EOF > /etc/yum.repos.d/epel-testing.repo
+[epel-testing]
+name=Extra Packages for Enterprise Linux 6 - Testing - \\$basearch
+baseurl=http://download.fedoraproject.org/pub/epel/testing/6/\\$basearch
+mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=testing-epel6&arch=\\$basearch
+failovermethod=priority
+enabled=0
+gpgcheck=0
+
+[epel-testing-debuginfo]
+name=Extra Packages for Enterprise Linux 6 - Testing - \\$basearch - Debug
+baseurl=http://download.fedoraproject.org/pub/epel/testing/6/\\$basearch/debug
+mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=testing-debug-epel6&arch=\\$basearch
+failovermethod=priority
+enabled=0
+gpgcheck=0
+
+[epel-testing-source]
+name=Extra Packages for Enterprise Linux 6 - Testing - \\$basearch - Source
+baseurl=http://download.fedoraproject.org/pub/epel/testing/6/SRPMS
+mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=testing-source-epel6&arch=\\$basearch
+failovermethod=priority
+enabled=0
+gpgcheck=0
+EOF
diff --git a/deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.6/kickstart_centos_fasttrack_repo b/deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.6/kickstart_centos_fasttrack_repo
new file mode 100644
index 00000000..5a4a7eae
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.6/kickstart_centos_fasttrack_repo
@@ -0,0 +1,10 @@
+cat << EOF > /etc/yum.repos.d/CentOS-Fasttrack.repo
+[fasttrack]
+name=CentOS-6.6 - fasttrack
+mirrorlist=http://mirrorlist.centos.org/?release=6&arch=\\$basearch&repo=fasttrack&infra=\\$infra
+baseurl=http://mirror.centos.org/centos/6/fasttrack/\\$basearch/
+gpgcheck=1
+enabled=0
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+skip_if_unavailable=1
+EOF
diff --git a/deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.6/kickstart_centos_vault_repo b/deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.6/kickstart_centos_vault_repo
new file mode 100644
index 00000000..065fa43e
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.6/kickstart_centos_vault_repo
@@ -0,0 +1,256 @@
+cat << EOF > /etc/yum.repos.d/CentOS-Vault.repo
+# CentOS-Vault.repo
+#
+# CentOS Vault holds packages from previous releases within the same CentOS Version
+# these are packages obsoleted by the current release and should usually not
+# be used in production
+#-----------------
+
+[C6.0-base]
+name=CentOS-6.0 - Base
+baseurl=http://vault.centos.org/6.0/os/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+[C6.0-updates]
+name=CentOS-6.0 - Updates
+baseurl=http://vault.centos.org/6.0/updates/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+[C6.0-extras]
+name=CentOS-6.0 - Extras
+baseurl=http://vault.centos.org/6.0/extras/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+[C6.0-contrib]
+name=CentOS-6.0 - Contrib
+baseurl=http://vault.centos.org/6.0/contrib/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+[C6.0-centosplus]
+name=CentOS-6.0 - CentOSPlus
+baseurl=http://vault.centos.org/6.0/centosplus/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+#-----------------
+
+[C6.1-base]
+name=CentOS-6.1 - Base
+baseurl=http://vault.centos.org/6.1/os/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+[C6.1-updates]
+name=CentOS-6.1 - Updates
+baseurl=http://vault.centos.org/6.1/updates/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+[C6.1-extras]
+name=CentOS-6.1 - Extras
+baseurl=http://vault.centos.org/6.1/extras/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+[C6.1-contrib]
+name=CentOS-6.1 - Contrib
+baseurl=http://vault.centos.org/6.1/contrib/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+[C6.1-centosplus]
+name=CentOS-6.1 - CentOSPlus
+baseurl=http://vault.centos.org/6.1/centosplus/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+#-----------------
+
+[C6.2-base]
+name=CentOS-6.2 - Base
+baseurl=http://vault.centos.org/6.2/os/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+[C6.2-updates]
+name=CentOS-6.2 - Updates
+baseurl=http://vault.centos.org/6.2/updates/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+[C6.2-extras]
+name=CentOS-6.2 - Extras
+baseurl=http://vault.centos.org/6.2/extras/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+[C6.2-contrib]
+name=CentOS-6.2 - Contrib
+baseurl=http://vault.centos.org/6.2/contrib/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+[C6.2-centosplus]
+name=CentOS-6.2 - CentOSPlus
+baseurl=http://vault.centos.org/6.2/centosplus/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+#-----------------
+
+[C6.3-base]
+name=CentOS-6.3 - Base
+baseurl=http://vault.centos.org/6.3/os/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+[C6.3-updates]
+name=CentOS-6.3 - Updates
+baseurl=http://vault.centos.org/6.3/updates/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+[C6.3-extras]
+name=CentOS-6.3 - Extras
+baseurl=http://vault.centos.org/6.3/extras/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+[C6.3-contrib]
+name=CentOS-6.3 - Contrib
+baseurl=http://vault.centos.org/6.3/contrib/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+[C6.3-centosplus]
+name=CentOS-6.3 - CentOSPlus
+baseurl=http://vault.centos.org/6.3/centosplus/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+#-----------------
+
+[C6.4-base]
+name=CentOS-6.4 - Base
+baseurl=http://vault.centos.org/6.4/os/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+[C6.4-updates]
+name=CentOS-6.4 - Updates
+baseurl=http://vault.centos.org/6.4/updates/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+[C6.4-extras]
+name=CentOS-6.4 - Extras
+baseurl=http://vault.centos.org/6.4/extras/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+[C6.4-contrib]
+name=CentOS-6.4 - Contrib
+baseurl=http://vault.centos.org/6.4/contrib/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+[C6.4-centosplus]
+name=CentOS-6.4 - CentOSPlus
+baseurl=http://vault.centos.org/6.4/centosplus/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+#-----------------
+
+[C6.5-base]
+name=CentOS-6.5 - Base
+baseurl=http://vault.centos.org/6.5/os/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+[C6.5-updates]
+name=CentOS-6.5 - Updates
+baseurl=http://vault.centos.org/6.5/updates/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+[C6.5-extras]
+name=CentOS-6.5 - Extras
+baseurl=http://vault.centos.org/6.5/extras/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+[C6.5-contrib]
+name=CentOS-6.5 - Contrib
+baseurl=http://vault.centos.org/6.5/contrib/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+[C6.5-centosplus]
+name=CentOS-6.5 - CentOSPlus
+baseurl=http://vault.centos.org/6.5/centosplus/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+enabled=0
+skip_if_unavailable=1
+
+EOF
diff --git a/deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.6/kickstart_repos b/deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.6/kickstart_repos
new file mode 100644
index 00000000..a6ff23b5
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/yum.repos.d/centos/6.6/kickstart_repos
@@ -0,0 +1,6 @@
+$SNIPPET('yum.repos.d/centos/6.6/kickstart_centos_base_repo')
+$SNIPPET('yum.repos.d/centos/6.6/kickstart_centos_debuginfo_repo')
+$SNIPPET('yum.repos.d/centos/6.6/kickstart_centos_vault_repo')
+$SNIPPET('yum.repos.d/centos/6.6/kickstart_centos_fasttrack_repo')
+$SNIPPET('yum.repos.d/centos/6.6/kickstart_centos_epel_repo')
+$SNIPPET('yum.repos.d/centos/6.6/kickstart_centos_epel_testing_repo')
diff --git a/deploy/adapters/cobbler/snippets/yum.repos.d/centos/7.0/kickstart_centos_base_repo b/deploy/adapters/cobbler/snippets/yum.repos.d/centos/7.0/kickstart_centos_base_repo
new file mode 100644
index 00000000..2462aa87
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/yum.repos.d/centos/7.0/kickstart_centos_base_repo
@@ -0,0 +1,59 @@
+cat << EOF > /etc/yum.repos.d/CentOS-Base.repo
+# CentOS-Base.repo
+#
+# The mirror system uses the connecting IP address of the client and the
+# update status of each mirror to pick mirrors that are updated to and
+# geographically close to the client. You should use this for CentOS updates
+# unless you are manually picking other mirrors.
+#
+# If the mirrorlist= does not work for you, as a fall back you can try the
+# remarked out baseurl= line instead.
+#
+#
+
+[base]
+name=CentOS-7.0 - Base
+mirrorlist=http://mirrorlist.centos.org/?release=7&arch=\\$basearch&repo=os
+baseurl=http://mirror.centos.org/centos/7/os/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
+skip_if_unavailable=1
+
+# released updates
+[updates]
+name=CentOS-7.0 - Updates
+mirrorlist=http://mirrorlist.centos.org/?release=7&arch=\\$basearch&repo=updates
+baseurl=http://mirror.centos.org/centos/7/updates/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
+skip_if_unavailable=1
+
+# additional packages that may be useful
+[extras]
+name=CentOS-7.0 - Extras
+mirrorlist=http://mirrorlist.centos.org/?release=7&arch=\\$basearch&repo=extras
+baseurl=http://mirror.centos.org/centos/7/extras/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
+skip_if_unavailable=1
+
+#additional packages that extend functionality of existing packages
+[centosplus]
+name=CentOS-7.0 - Plus
+mirrorlist=http://mirrorlist.centos.org/?release=7&arch=\\$basearch&repo=centosplus
+baseurl=http://mirror.centos.org/centos/7/centosplus/\\$basearch/
+gpgcheck=1
+enabled=0
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
+skip_if_unavailable=1
+
+#contrib - packages by Centos Users
+[contrib]
+name=CentOS-7.0 - Contrib
+mirrorlist=http://mirrorlist.centos.org/?release=7&arch=\\$basearch&repo=contrib
+baseurl=http://mirror.centos.org/centos/7/contrib/\\$basearch/
+gpgcheck=1
+enabled=0
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
+skip_if_unavailable=1
+EOF
diff --git a/deploy/adapters/cobbler/snippets/yum.repos.d/centos/7.0/kickstart_centos_debuginfo_repo b/deploy/adapters/cobbler/snippets/yum.repos.d/centos/7.0/kickstart_centos_debuginfo_repo
new file mode 100644
index 00000000..78554b6a
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/yum.repos.d/centos/7.0/kickstart_centos_debuginfo_repo
@@ -0,0 +1,23 @@
+cat << EOF > /etc/yum.repos.d/CentOS-Debuginfo.repo
+# CentOS-Debug.repo
+#
+# The mirror system uses the connecting IP address of the client and the
+# update status of each mirror to pick mirrors that are updated to and
+# geographically close to the client. You should use this for CentOS updates
+# unless you are manually picking other mirrors.
+#
+
+# All debug packages from all the various CentOS-5 releases
+# are merged into a single repo, split by BaseArch
+#
+# Note: packages in the debuginfo repo are currently not signed
+#
+
+[debug]
+name=CentOS-7 - Debuginfo
+baseurl=http://debuginfo.centos.org/7/\\$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-Debug-7
+enabled=0
+skip_if_unavailable=1
+EOF
diff --git a/deploy/adapters/cobbler/snippets/yum.repos.d/centos/7.0/kickstart_centos_epel_repo b/deploy/adapters/cobbler/snippets/yum.repos.d/centos/7.0/kickstart_centos_epel_repo
new file mode 100644
index 00000000..ca684c34
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/yum.repos.d/centos/7.0/kickstart_centos_epel_repo
@@ -0,0 +1,25 @@
+cat << EOF > /etc/yum.repos.d/epel.repo
+[epel]
+name=Extra Packages for Enterprise Linux 7 - \\$basearch
+baseurl=http://download.fedoraproject.org/pub/epel/7/\\$basearch
+mirrorlist=http://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=\\$basearch
+failovermethod=priority
+enabled=1
+gpgcheck=0
+
+[epel-debuginfo]
+name=Extra Packages for Enterprise Linux 7 - \\$basearch - Debug
+baseurl=http://download.fedoraproject.org/pub/epel/7/\\$basearch/debug
+mirrorlist=http://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=\\$basearch
+failovermethod=priority
+enabled=0
+gpgcheck=0
+
+[epel-source]
+name=Extra Packages for Enterprise Linux 7 - \\$basearch - Source
+baseurl=http://download.fedoraproject.org/pub/epel/7/SRPMS
+mirrorlist=http://mirrors.fedoraproject.org/metalink?repo=epel-source-7&arch=\\$basearch
+failovermethod=priority
+enabled=0
+gpgcheck=0
+EOF
diff --git a/deploy/adapters/cobbler/snippets/yum.repos.d/centos/7.0/kickstart_centos_epel_testing_repo b/deploy/adapters/cobbler/snippets/yum.repos.d/centos/7.0/kickstart_centos_epel_testing_repo
new file mode 100644
index 00000000..bc1d1970
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/yum.repos.d/centos/7.0/kickstart_centos_epel_testing_repo
@@ -0,0 +1,25 @@
+cat << EOF > /etc/yum.repos.d/epel-testing.repo
+[epel-testing]
+name=Extra Packages for Enterprise Linux 7.0 - Testing - \\$basearch
+baseurl=http://download.fedoraproject.org/pub/epel/testing/7/\\$basearch
+mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=testing-epel7&arch=\\$basearch
+failovermethod=priority
+enabled=0
+gpgcheck=0
+
+[epel-testing-debuginfo]
+name=Extra Packages for Enterprise Linux 7.0 - Testing - \\$basearch - Debug
+baseurl=http://download.fedoraproject.org/pub/epel/testing/7/\\$basearch/debug
+mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=testing-debug-epel7&arch=\\$basearch
+failovermethod=priority
+enabled=0
+gpgcheck=0
+
+[epel-testing-source]
+name=Extra Packages for Enterprise Linux 7 - Testing - \\$basearch - Source
+baseurl=http://download.fedoraproject.org/pub/epel/testing/7/SRPMS
+mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=testing-source-epel7&arch=\\$basearch
+failovermethod=priority
+enabled=0
+gpgcheck=0
+EOF
diff --git a/deploy/adapters/cobbler/snippets/yum.repos.d/centos/7.0/kickstart_centos_mysql_repo b/deploy/adapters/cobbler/snippets/yum.repos.d/centos/7.0/kickstart_centos_mysql_repo
new file mode 100644
index 00000000..1d2c3d73
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/yum.repos.d/centos/7.0/kickstart_centos_mysql_repo
@@ -0,0 +1,35 @@
+cat << EOF > /etc/yum.repos.d/mysql-community.repo
+[mysql-connectors-community]
+name=MySQL Connectors Community
+baseurl=http://repo.mysql.com/yum/mysql-connectors-community/el/7/\\$basearch/
+enabled=1
+gpgcheck=0
+
+[mysql-tools-community]
+name=MySQL Tools Community
+baseurl=http://repo.mysql.com/yum/mysql-tools-community/el/7/\\$basearch/
+enabled=1
+gpgcheck=0
+
+# Enable to use MySQL 5.5
+[mysql55-community]
+name=MySQL 5.5 Community Server
+baseurl=http://repo.mysql.com/yum/mysql-5.5-community/el/7/\\$basearch/
+enabled=0
+gpgcheck=0
+
+# Enable to use MySQL 5.6
+[mysql56-community]
+name=MySQL 5.6 Community Server
+baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/7/\\$basearch/
+enabled=1
+gpgcheck=0
+
+# Note: MySQL 5.7 is currently in development. For use at your own risk.
+# Please read with sub pages: https://dev.mysql.com/doc/relnotes/mysql/5.7/en/
+[mysql57-community-dmr]
+name=MySQL 5.7 Community Server Development Milestone Release
+baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/\\$basearch/
+enabled=0
+gpgcheck=0
+EOF
diff --git a/deploy/adapters/cobbler/snippets/yum.repos.d/centos/7.0/kickstart_centos_mysql_source_repo b/deploy/adapters/cobbler/snippets/yum.repos.d/centos/7.0/kickstart_centos_mysql_source_repo
new file mode 100644
index 00000000..b1c1be39
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/yum.repos.d/centos/7.0/kickstart_centos_mysql_source_repo
@@ -0,0 +1,31 @@
+cat << EOF > /etc/yum.repos.d/mysql-community-source.repo
+[mysql-connectors-community-source]
+name=MySQL Connectors Community - Source
+baseurl=http://repo.mysql.com/yum/mysql-connectors-community/el/7/SRPMS
+enabled=0
+gpgcheck=0
+
+[mysql-tools-community-source]
+name=MySQL Tools Community - Source
+baseurl=http://repo.mysql.com/yum/mysql-tools-community/el/7/SRPMS
+enabled=0
+gpgcheck=0
+
+[mysql55-community-source]
+name=MySQL 5.5 Community Server - Source
+baseurl=http://repo.mysql.com/yum/mysql-5.5-community/el/7/SRPMS
+enabled=0
+gpgcheck=0
+
+[mysql56-community-source]
+name=MySQL 5.6 Community Server - Source
+baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/7/SRPMS
+enabled=0
+gpgcheck=0
+
+[mysql57-community-dmr-source]
+name=MySQL 5.7 Community Server Development Milestone Release - Source
+baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/SRPMS
+enabled=0
+gpgcheck=0
+EOF
diff --git a/deploy/adapters/cobbler/snippets/yum.repos.d/centos/7.0/kickstart_repos b/deploy/adapters/cobbler/snippets/yum.repos.d/centos/7.0/kickstart_repos
new file mode 100644
index 00000000..6b85bcc1
--- /dev/null
+++ b/deploy/adapters/cobbler/snippets/yum.repos.d/centos/7.0/kickstart_repos
@@ -0,0 +1,7 @@
+$SNIPPET('yum.repos.d/centos/7.0/kickstart_centos_base_repo')
+$SNIPPET('yum.repos.d/centos/7.0/kickstart_centos_debuginfo_repo')
+$SNIPPET('yum.repos.d/centos/7.0/kickstart_centos_atomic_repo')
+$SNIPPET('yum.repos.d/centos/7.0/kickstart_centos_epel_repo')
+$SNIPPET('yum.repos.d/centos/7.0/kickstart_centos_epel_testing_repo')
+$SNIPPET('yum.repos.d/centos/7.0/kickstart_centos_mysql_repo')
+$SNIPPET('yum.repos.d/centos/7.0/kickstart_centos_mysql_source_repo')