update adapter config to support multi os versions
Change-Id: Icfd90d09ed55f3f0723a77642cc803d39440896d
This commit is contained in:
parent
67d09e782f
commit
20dcf7c257
@ -19,6 +19,12 @@
|
||||
|
||||
default['apache']['root_group'] = 'root'
|
||||
|
||||
default['apache']['version'] = '2.2'
|
||||
if node['platform_family'] == 'rhel' && node['platform_version'].to_i > 6
|
||||
# mysql version is 5.6 on el7
|
||||
default['apache']['version'] = '2.4'
|
||||
end
|
||||
|
||||
# Where the various parts of apache are
|
||||
case node['platform']
|
||||
when 'redhat', 'centos', 'scientific', 'fedora', 'suse', 'amazon', 'oracle'
|
||||
@ -181,6 +187,8 @@ default['apache']['default_modules'] = %w[
|
||||
dir env mime negotiation setenvif
|
||||
]
|
||||
|
||||
|
||||
|
||||
%w[log_config logio].each do |log_mod|
|
||||
default['apache']['default_modules'] << log_mod if %w[rhel fedora suse arch freebsd].include?(node['platform_family'])
|
||||
end
|
||||
|
@ -37,8 +37,9 @@ define :apache_module, :enable => true, :conf => false do
|
||||
execute "a2enmod #{params[:name]}" do
|
||||
command "/usr/sbin/a2enmod #{params[:name]}"
|
||||
notifies :restart, 'service[apache2]'
|
||||
only_if { ::File.exists?("#{node['apache']['dir']}/mods-available/#{params[:name]}.load") }
|
||||
not_if do
|
||||
::File.symlink?("#{node['apache']['dir']}/mods-enabled/#{params[:name]}.load") &&
|
||||
::File.symlink?("#{node['apache']['dir']}/mods-enabled/#{params[:name]}.load") &&
|
||||
(::File.exists?("#{node['apache']['dir']}/mods-available/#{params[:name]}.conf") ? ::File.symlink?("#{node['apache']['dir']}/mods-enabled/#{params[:name]}.conf") : true)
|
||||
end
|
||||
end
|
||||
|
@ -17,4 +17,6 @@
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
apache_module 'authz_default'
|
||||
if node['apache']['version'].to_f <= 2.2
|
||||
apache_module 'authz_default'
|
||||
end
|
||||
|
@ -9,7 +9,17 @@ ServerRoot "<%= node['apache']['dir'] %>"
|
||||
# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
|
||||
#
|
||||
<% if %w[debian].include?(node['platform_family']) -%>
|
||||
<% if node['platform_version'].split('.').first.to_i > 12 -%>
|
||||
Mutex file:/var/lock/apache2 default
|
||||
<% else %>
|
||||
LockFile /var/lock/apache2/accept.lock
|
||||
<% end -%>
|
||||
<% elsif %w[rhel].include?(node['platform_family']) -%>
|
||||
<% if node['platform_version'].split('.').first.to_i > 6 -%>
|
||||
Mutex file:logs default
|
||||
<% else %>
|
||||
LockFile logs/accept.lock
|
||||
<% end -%>
|
||||
<% elsif %w[freebsd].include?(node['platform_family']) -%>
|
||||
LockFile /var/log/accept.lock
|
||||
<% else %>
|
||||
@ -46,6 +56,12 @@ MaxKeepAliveRequests <%= node['apache']['keepaliverequests'] %>
|
||||
#
|
||||
KeepAliveTimeout <%= node['apache']['keepalivetimeout'] %>
|
||||
|
||||
<% if %w[rhel].include?(node['platform_family']) -%>
|
||||
<% if node['platform_version'].split('.').first.to_i > 6 -%>
|
||||
Include conf.modules.d/*.conf
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
|
||||
##
|
||||
## Server-Pool Size Regulation (MPM specific)
|
||||
##
|
||||
|
@ -51,10 +51,22 @@
|
||||
# Semaphore:
|
||||
# Configure the path to the mutual exclusion semaphore the
|
||||
# SSL engine uses internally for inter-process synchronization.
|
||||
<% if %w[rhel fedora suse].include?(node['platform_family']) -%>
|
||||
<% if %w[fedora suse].include?(node['platform_family']) -%>
|
||||
SSLMutex default
|
||||
<% elsif %w[rhel].include?(node['platform_family']) -%>
|
||||
<% if node['platform_version'].split('.').first.to_i > 6 -%>
|
||||
Mutex file:/var/run/httpd default
|
||||
<% else %>
|
||||
SSLMutex default
|
||||
<% end -%>
|
||||
<% elsif %w[freebsd].include?(node['platform_family']) -%>
|
||||
SSLMutex file:/var/run/ssl_mutex
|
||||
<% elsif %w[debian].include?(node['platform_family']) -%>
|
||||
<% if node['platform_version'].split('.').first.to_i > 12 -%>
|
||||
Mutex file:/var/run/apache2 default
|
||||
<% else %>
|
||||
SSLMutex file:/var/run/apache2/ssl_mutex
|
||||
<% end -%>
|
||||
<% else -%>
|
||||
SSLMutex file:/var/run/apache2/ssl_mutex
|
||||
<% end -%>
|
||||
|
@ -40,9 +40,12 @@ if platform_family?("rhel")
|
||||
"collectd-snmp",
|
||||
"collectd-varnish"
|
||||
]
|
||||
default[:collectd][:yum][:uri] = "http://12.133.183.203/repos/collectd/epel-6"
|
||||
default[:collectd][:yum][:uri] = "http://12.133.183.203/repos/collectd/epel-$releasever"
|
||||
default[:collectd][:plugin_dir] = "/usr/lib64/collectd"
|
||||
default[:collectd][:config_file] = "/etc/collectd.conf"
|
||||
if platform_version.to_i > 6
|
||||
default[:collectd][:service_file] = "/usr/lib/systemd/system/collectd.service"
|
||||
end
|
||||
elsif platform_family?("debian")
|
||||
default[:collectd][:package_name] = ["collectd-core"]
|
||||
default[:collectd][:plugin_dir] = "/usr/lib/collectd"
|
||||
|
@ -45,6 +45,15 @@ node[:collectd][:package_name].each do |pkg|
|
||||
end
|
||||
end
|
||||
|
||||
unless node[:collectd][:service_file].nil? or node[:collectd][:service_file].empty?
|
||||
template node[:collectd][:service_file] do
|
||||
source "collectd_service.erb"
|
||||
owner "root"
|
||||
group "root"
|
||||
mode "644"
|
||||
end
|
||||
end
|
||||
|
||||
service "collectd" do
|
||||
supports :restart => true, :status => true
|
||||
end
|
||||
|
@ -0,0 +1,25 @@
|
||||
[Unit]
|
||||
Description=Collectd - statistics collection daemon
|
||||
After=local-fs.target network.target
|
||||
Requires=local-fs.target network.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/sbin/collectdmon
|
||||
|
||||
# Tell systemd it will receive a notification from collectd over it's control
|
||||
# socket once the daemon is ready. See systemd.service(5) for more details.
|
||||
#Type=notify
|
||||
#NotifyAccess=main
|
||||
Type=forking
|
||||
RemainAfterExit=yes
|
||||
|
||||
# Restart the collectd daemon after a 10 seconds delay, in case it crashes.
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
|
||||
# Send all console messages to syslog.
|
||||
StandardOutput=syslog
|
||||
StandardError=syslog
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -23,7 +23,7 @@
|
||||
|
||||
case node['platform_family']
|
||||
when 'rhel', 'fedora'
|
||||
default['mysql']['client']['packages'] = %w[mysql mysql-devel]
|
||||
default['mysql']['client']['packages'] = %w[postfix mysql mysql-devel]
|
||||
when 'suse'
|
||||
default['mysql']['client']['packages'] = %w[mysql-community-server-client libmysqlclient-devel]
|
||||
when 'debian'
|
||||
|
@ -150,6 +150,12 @@ unless node['platform_family'] == 'rhel' && node['platform_version'].to_i < 6
|
||||
default['mysql']['tunable']['binlog_format'] = 'statement' if node['mysql']['tunable']['log_bin']
|
||||
end
|
||||
|
||||
default['mysql']['version'] = '5.1'
|
||||
if node['platform_family'] == 'rhel' && node['platform_version'].to_i > 6
|
||||
# mysql version is 5.6 on el7
|
||||
default['mysql']['version'] = '5.6'
|
||||
end
|
||||
|
||||
# security options
|
||||
# @see http://www.symantec.com/connect/articles/securing-mysql-step-step
|
||||
# @see http://dev.mysql.com/doc/refman/5.7/en/server-options.html#option_mysqld_chroot
|
||||
|
@ -15,6 +15,10 @@ when 'rhel'
|
||||
default['mysql']['server']['packages'] = ['mysql-server']
|
||||
default['mysql']['server']['slow_query_log'] = 1
|
||||
default['mysql']['server']['slow_query_log_file'] = '/var/log/mysql/slow.log'
|
||||
when 7
|
||||
default['mysql']['server']['packages'] = ['mysql-server']
|
||||
default['mysql']['server']['slow_query_log'] = 1
|
||||
default['mysql']['server']['slow_query_log_file'] = '/var/log/mysql/slow.log'
|
||||
when 2013 # amazon linux
|
||||
default['mysql']['server']['packages'] = ['mysql-server']
|
||||
default['mysql']['server']['slow_query_log'] = 1
|
||||
|
@ -91,7 +91,7 @@ default['openstack']['zypp']['repo-key'] = 'd85f9316' # 32 bit key ID
|
||||
default['openstack']['zypp']['uri'] = 'http://download.opensuse.org/repositories/Cloud:/OpenStack:/%release%/%suse-release%/'
|
||||
|
||||
default['openstack']['yum']['rdo_enabled'] = true
|
||||
default['openstack']['yum']['uri'] = 'http://repos.fedorapeople.org/repos/openstack/openstack-icehouse/epel-6'
|
||||
default['openstack']['yum']['uri'] = 'http://repos.fedorapeople.org/repos/openstack/openstack-icehouse/epel-$releasever'
|
||||
#default['openstack']['yum']['repo-key'] = 'https://raw.githubusercontent.com/redhat-openstack/rdo-release/master/RPM-GPG-KEY-RDO-Icehouse'
|
||||
default['openstack']['yum']['repo-key'] = 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-RDO-Icehouse'
|
||||
|
||||
|
@ -126,11 +126,12 @@ when 'debian'
|
||||
}
|
||||
# lessc became node-less in 12.10
|
||||
if node['lsb']['release'] > '12.04'
|
||||
default['openstack']['dashboard']['apache']['sites-path'] = "#{node["apache"]["dir"]}/sites-available/openstack-dashboard.conf"
|
||||
default['openstack']['dashboard']['platform']['horizon_packages'] = ['node-less', 'openstack-dashboard']
|
||||
else
|
||||
default['openstack']['dashboard']['apache']['sites-path'] = "#{node["apache"]["dir"]}/sites-available/openstack-dashboard"
|
||||
default['openstack']['dashboard']['platform']['horizon_packages'] = ['lessc', 'openstack-dashboard']
|
||||
end
|
||||
default['openstack']['dashboard']['apache']['sites-path'] = "#{node["apache"]["dir"]}/sites-available/openstack-dashboard"
|
||||
end
|
||||
|
||||
default['openstack']['dashboard']['dash_path'] = "#{node['openstack']['dashboard']['django_path']}/openstack_dashboard"
|
||||
|
@ -3,6 +3,10 @@ default['rabbitmq']['version'] = '3.1.5'
|
||||
# The distro versions may be more stable and have back-ported patches
|
||||
default['rabbitmq']['use_distro_version'] = true
|
||||
|
||||
if node['platform_family'] == 'rhel' && node['platform_version'].to_i > 6
|
||||
default['rabbitmq']['use_distro_version'] = false
|
||||
end
|
||||
|
||||
# being nil, the rabbitmq defaults will be used
|
||||
default['rabbitmq']['nodename'] = nil
|
||||
default['rabbitmq']['address'] = nil
|
||||
|
@ -39,6 +39,7 @@ action :enable do
|
||||
execute "rabbitmq-plugins enable #{new_resource.plugin}" do
|
||||
Chef::Log.info "Enabling RabbitMQ plugin '#{new_resource.plugin}'."
|
||||
path plugins_bin_path(true)
|
||||
environment "PATH" => plugins_bin_path
|
||||
new_resource.updated_by_last_action(true)
|
||||
end
|
||||
end
|
||||
@ -49,6 +50,7 @@ action :disable do
|
||||
execute "rabbitmq-plugins disable #{new_resource.plugin}" do
|
||||
Chef::Log.info "Disabling RabbitMQ plugin '#{new_resource.plugin}'."
|
||||
path plugins_bin_path(true)
|
||||
environment "PATH" => plugins_bin_path
|
||||
new_resource.updated_by_last_action(true)
|
||||
end
|
||||
end
|
||||
|
@ -1,25 +1,25 @@
|
||||
[epel]
|
||||
name=Extra Packages for Enterprise Linux 6 - $basearch
|
||||
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
|
||||
baseurl=http://<%= node['yum']['centos']['repo_host'] %>/epel-6/$basearch
|
||||
name=Extra Packages for Enterprise Linux $releasever - $basearch
|
||||
#baseurl=http://download.fedoraproject.org/pub/epel/$releasever/$basearch
|
||||
baseurl=http://<%= node['yum']['centos']['repo_host'] %>/epel-$releasever/$basearch
|
||||
failovermethod=priority
|
||||
enabled=1
|
||||
gpgcheck=0
|
||||
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
|
||||
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever
|
||||
|
||||
[epel-debuginfo]
|
||||
name=Extra Packages for Enterprise Linux 6 - $basearch - Debug
|
||||
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch/debug
|
||||
baseurl=http://<%= node['yum']['centos']['repo_host'] %>/epel-6/$basearch/debug
|
||||
name=Extra Packages for Enterprise Linux $releasever - $basearch - Debug
|
||||
#baseurl=http://download.fedoraproject.org/pub/epel/$releasever/$basearch/debug
|
||||
baseurl=http://<%= node['yum']['centos']['repo_host'] %>/epel-$releasever/$basearch/debug
|
||||
failovermethod=priority
|
||||
enabled=0
|
||||
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
|
||||
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever
|
||||
gpgcheck=0
|
||||
|
||||
[epel-source]
|
||||
name=Extra Packages for Enterprise Linux 6 - $basearch - Source
|
||||
#baseurl=http://download.fedoraproject.org/pub/epel/6/SRPMS
|
||||
baseurl=http://<%= node['yum']['centos']['repo_host'] %>/epel-6/SRPMS
|
||||
name=Extra Packages for Enterprise Linux $releasever - $basearch - Source
|
||||
#baseurl=http://download.fedoraproject.org/pub/epel/$releasever/SRPMS
|
||||
baseurl=http://<%= node['yum']['centos']['repo_host'] %>/epel-$releasever/SRPMS
|
||||
failovermethod=priority
|
||||
enabled=0
|
||||
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
|
||||
|
@ -1,6 +1,6 @@
|
||||
case node['platform_family']
|
||||
when 'rhel'
|
||||
default['yum']['erlang_solutions']['baseurl'] = 'http://packages.erlang-solutions.com/rpm/centos/6/$basearch'
|
||||
default['yum']['erlang_solutions']['baseurl'] = 'http://packages.erlang-solutions.com/rpm/centos/$releasever/$basearch'
|
||||
else
|
||||
default['yum']['erlang_solutions']['baseurl'] = 'http://packages.erlang-solutions.com/rpm/centos/$releasever/$basearch'
|
||||
end
|
||||
|
@ -36,30 +36,31 @@ action :create do
|
||||
# uniquely naming the execute[yum-makecache] resources. Set the
|
||||
# notifies timing to :immediately for the same reasons. Remove both
|
||||
# of these when dropping Chef 10 support.
|
||||
|
||||
template "/etc/yum.repos.d/#{new_resource.repositoryid}.repo" do
|
||||
if new_resource.source.nil?
|
||||
source 'repo.erb'
|
||||
cookbook 'yum'
|
||||
else
|
||||
source new_resource.source
|
||||
if !::File.exist?("/etc/yum.repos.d/#{new_resource.repositoryid}.repo")
|
||||
template "/etc/yum.repos.d/#{new_resource.repositoryid}.repo" do
|
||||
if new_resource.source.nil?
|
||||
source 'repo.erb'
|
||||
cookbook 'yum'
|
||||
else
|
||||
source new_resource.source
|
||||
end
|
||||
mode '0644'
|
||||
variables(:config => new_resource)
|
||||
notifies :run, "execute[yum-makecache-#{new_resource.repositoryid}]", :immediately
|
||||
notifies :create, "ruby_block[yum-cache-reload-#{new_resource.repositoryid}]", :immediately
|
||||
end
|
||||
mode '0644'
|
||||
variables(:config => new_resource)
|
||||
notifies :run, "execute[yum-makecache-#{new_resource.repositoryid}]", :immediately
|
||||
notifies :create, "ruby_block[yum-cache-reload-#{new_resource.repositoryid}]", :immediately
|
||||
end
|
||||
|
||||
# get the metadata for this repo only
|
||||
execute "yum-makecache-#{new_resource.repositoryid}" do
|
||||
command "yum -q makecache --disablerepo=* --enablerepo=#{new_resource.repositoryid}"
|
||||
action :nothing
|
||||
end
|
||||
# get the metadata for this repo only
|
||||
execute "yum-makecache-#{new_resource.repositoryid}" do
|
||||
command "yum -q makecache --disablerepo=* --enablerepo=#{new_resource.repositoryid}"
|
||||
action :nothing
|
||||
end
|
||||
|
||||
# reload internal Chef yum cache
|
||||
ruby_block "yum-cache-reload-#{new_resource.repositoryid}" do
|
||||
block { Chef::Provider::Package::Yum::YumCache.instance.reload }
|
||||
action :nothing
|
||||
# reload internal Chef yum cache
|
||||
ruby_block "yum-cache-reload-#{new_resource.repositoryid}" do
|
||||
block { Chef::Provider::Package::Yum::YumCache.instance.reload }
|
||||
action :nothing
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -4,7 +4,12 @@
|
||||
# System Authorization
|
||||
auth --useshadow --enablemd5
|
||||
|
||||
# Use Text Mode
|
||||
#if $os_version == "rhel7"
|
||||
eula --agreed
|
||||
services --enabled=NetworkManager,sshd
|
||||
#end if
|
||||
|
||||
# Use Graphic Mode
|
||||
text
|
||||
|
||||
# Disable Firewall
|
||||
@ -81,6 +86,9 @@ libgt
|
||||
liblogging
|
||||
rsyslog
|
||||
parted
|
||||
#if $os_version == "rhel7"
|
||||
net-tools
|
||||
#end if
|
||||
%end
|
||||
|
||||
%post --log=/var/log/post_install.log
|
||||
|
@ -108,4 +108,4 @@ d-i cdrom-detect/eject boolean false
|
||||
d-i preseed/late_command string \
|
||||
wget -O- \
|
||||
http://$http_server/cblr/svc/op/script/$what/$name/?script=preseed_late_default | \
|
||||
chroot /target /bin/sh -s
|
||||
chroot /target /bin/sh -s; cp /target/etc/network/interfaces /etc/network/interfaces
|
||||
|
8
cobbler/snippets/apt.repos.d/ubuntu/12.04/preseed_repos
Normal file
8
cobbler/snippets/apt.repos.d/ubuntu/12.04/preseed_repos
Normal file
@ -0,0 +1,8 @@
|
||||
cat << EOF >> /etc/apt/sources.list
|
||||
deb http://archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse
|
||||
deb http://archive.ubuntu.com/ubuntu/ precise-security main restricted universe multiverse
|
||||
deb http://archive.ubuntu.com/ubuntu/ precise-updates main restricted universe multiverse
|
||||
deb http://archive.ubuntu.com/ubuntu/ precise-proposed main restricted universe multiverse
|
||||
deb http://archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse
|
||||
EOF
|
||||
|
8
cobbler/snippets/apt.repos.d/ubuntu/14.04/preseed_repos
Normal file
8
cobbler/snippets/apt.repos.d/ubuntu/14.04/preseed_repos
Normal file
@ -0,0 +1,8 @@
|
||||
cat << EOF >> /etc/apt/sources.list
|
||||
deb http://archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse
|
||||
deb http://archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse
|
||||
deb http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse
|
||||
deb http://archive.ubuntu.com/ubuntu/ trusty-proposed main restricted universe multiverse
|
||||
deb http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
|
||||
EOF
|
||||
|
@ -11,13 +11,12 @@
|
||||
#end for
|
||||
|
||||
#set $proxy_url = ""
|
||||
#set $local_repo_url = ""
|
||||
#if $getVar("local_repo","") != ""
|
||||
#set $local_repo_url = $local_repo
|
||||
#else
|
||||
#set $local_repo_url = ""
|
||||
#if $getVar("proxy","") != ""
|
||||
#set $proxy_url = $proxy
|
||||
#end if
|
||||
#end if
|
||||
#if $getVar("proxy","") != ""
|
||||
#set $proxy_url = $proxy
|
||||
#end if
|
||||
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
mkdir -p /etc/chef
|
||||
cat << EOL > /etc/chef/client.rb
|
||||
log_level :info
|
||||
log_location '/dev/null'
|
||||
@ -9,4 +10,26 @@ 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
|
||||
|
@ -1,5 +1,5 @@
|
||||
cat << EOF > /root/.gemrc
|
||||
#if $getVar("local_repo","") == "" and $getVar('proxy', '') != ""
|
||||
#if $getVar('proxy', '') != ""
|
||||
gem: --no-ri --no-rdoc --http-proxy=$proxy
|
||||
#else
|
||||
gem: --no-ri --no-rdoc
|
||||
@ -10,6 +10,9 @@ gem: --no-ri --no-rdoc
|
||||
: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
|
||||
|
@ -10,4 +10,26 @@ 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
|
||||
|
@ -42,6 +42,7 @@ 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=\$#;
|
||||
@ -55,6 +56,8 @@ do
|
||||
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
|
||||
@ -70,9 +73,9 @@ 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 unset_logical_interfaces
|
||||
declare -A used_physical_interfaces
|
||||
declare -A physical_interface_mapping
|
||||
|
||||
#set ikeys = $interfaces.keys()
|
||||
#set osversion = $getVar("os_version","")
|
||||
@ -87,62 +90,293 @@ declare -A used_physical_interfaces
|
||||
#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[$iname]=\$physical_interface
|
||||
logical_interface_mapping[\${logical_interface}]=\${physical_interface}
|
||||
if [ ! -z "\$physical_interface" ]; then
|
||||
unset physical_interfaces[\$physical_interface]
|
||||
if [ "\$physical_interface" != "$iname" ]; then
|
||||
used_physical_interfaces[\$physical_interface]=\$physical_interface
|
||||
fi
|
||||
physical_interface_mapping[\${physical_interface}]=\${logical_interface}
|
||||
fi
|
||||
#else
|
||||
logical_interface_mapping[$iname]=""
|
||||
unset_logical_interfaces[$iname]=$iname
|
||||
if [ -z "\${logical_interface_mapping[\${logical_interface}]}" ]; then
|
||||
logical_interface_mapping[\${logical_interface}]=""
|
||||
fi
|
||||
#end if
|
||||
#end for
|
||||
|
||||
echo "unset logical interfaces: \${unset_logical_interfaces[@]}" >> /tmp/network_log
|
||||
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 logical_interface in \${unset_logical_interfaces[@]}; do
|
||||
if [ ! -z "\${physical_interfaces[\$logical_interface]}" ]; then
|
||||
logical_interface_mapping[\$logical_interface]=\$logical_interface
|
||||
unset unset_logical_interfaces[\$logical_interface]
|
||||
unset physical_interfaces[\$logical_interface]
|
||||
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
|
||||
|
||||
sorted_physical_interfaces=(\$(printf '%s\n' \${physical_interfaces[@]} | sort))
|
||||
echo "sorted physical interfaces: \${sorted_physical_interfaces[@]}" >> /tmp/network_log
|
||||
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 logical interfaces: \${sorted_unset_logical_interfaces[@]}" >> /tmp/network_log
|
||||
echo "sorted unset logical interfaces: \${sorted_unset_logical_interfaces[@]}" >> /tmp/network_log
|
||||
|
||||
while [ \${#sorted_physical_interfaces[@]} -gt 0 -a \${#sorted_unset_logical_interfaces[@]} -gt 0 ]; do
|
||||
physical_interface=\${sorted_physical_interfaces[0]}
|
||||
# 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]}
|
||||
unset sorted_physical_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 physical_interfaces[\$physical_interface]
|
||||
unset unset_logical_interfaces[\$logical_interface]
|
||||
logical_interface_mapping[\$logical_interface]=\$physical_interface
|
||||
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
|
||||
|
||||
sorted_used_physical_interfaces=(\$(printf '%s\n' \${used_physical_interfaces[@]} | sort))
|
||||
|
||||
while [ \${#sorted_physical_interfaces[@]} -gt 0 -a \${#sorted_used_physical_interfaces[@]} -gt 0 ]; do
|
||||
physical_interface=\${sorted_physical_interfaces[0]}
|
||||
logical_interface=\${sorted_used_physical_interfaces[0]}
|
||||
unset sorted_physical_interfaces[0]
|
||||
unset sorted_used_physical_interfaces[0]
|
||||
unset physical_interfaces[\$physical_interface]
|
||||
unset used_physical_interfaces[\$logical_interface]
|
||||
logical_interface_mapping[\$logical_interface]=\$physical_interface
|
||||
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
|
||||
@ -154,6 +388,10 @@ fi
|
||||
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
|
||||
@ -172,6 +410,8 @@ cp /etc/sysconfig/network-scripts/ifcfg-lo /etc/sysconfig/network-scripts/cobble
|
||||
#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
|
||||
@ -197,8 +437,8 @@ 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
|
||||
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 /etc/modprobe.conf.new /etc/modprobe.conf
|
||||
@ -243,24 +483,22 @@ echo "HOTPLUG=no" >> $devfile
|
||||
echo "TYPE=Ethernet" >> $devfile
|
||||
#end if
|
||||
|
||||
#if $iname in $promisc_interfaces
|
||||
echo "PROMISC=yes" >> $devfile
|
||||
#end if
|
||||
|
||||
#if $static
|
||||
echo "BOOTPROTO=static" >> $devfile
|
||||
#if $ip != "" and $iname not in $promisc_interfaces
|
||||
#if $iname in $promisc_interfaces
|
||||
echo "PROMISC=yes" >> $devfile
|
||||
#elif $ip != ""
|
||||
echo "IPADDR=$ip" >> $devfile
|
||||
#end if
|
||||
|
||||
#if $if_gateway != ""
|
||||
#if $if_gateway != ""
|
||||
echo "GATEWAY=$if_gateway" >> $devfile
|
||||
#end if
|
||||
#end if
|
||||
|
||||
#if $netmask == ""
|
||||
#set $netmask = "255.255.255.0"
|
||||
#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
|
||||
@ -279,13 +517,16 @@ echo "ONPARENT=yes" >> $devfile
|
||||
echo "MTU=$mtu" >> $devfile
|
||||
#end if
|
||||
|
||||
#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
|
||||
#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
|
||||
#end if
|
||||
#end for
|
||||
#set $nameserver_set = 1
|
||||
#end if
|
||||
#end if
|
||||
|
||||
#for $route in $static_routes
|
||||
#set routepattern = $re.compile("[0-9/.]+:[0-9.]+")
|
||||
@ -299,32 +540,25 @@ echo "$network via $router" >> $routesfile
|
||||
#end for
|
||||
#end for
|
||||
|
||||
#for $iname in $ikeys
|
||||
#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
|
||||
unset logical_interface_mapping[\$logical_interface]
|
||||
#end for
|
||||
|
||||
for logical_interface in \${!logical_interface_mapping[@]}; do
|
||||
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
|
||||
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
|
||||
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 /etc/modprobe.conf.new /etc/modprobe.conf
|
||||
fi
|
||||
@ -345,8 +579,11 @@ 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/70-persistent-net.rules" ]; then
|
||||
rm -f /etc/udev/rules.d/70-persistent-net.rules
|
||||
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 /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
|
||||
|
@ -14,11 +14,12 @@
|
||||
#end if
|
||||
|
||||
declare -A disk_mapping
|
||||
declare -A disk_path_mapping
|
||||
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
|
||||
echo "disk_mapping: \$*" >> /tmp/log
|
||||
while [ \$disk_mapping_offset -lt \$disk_mapping_nums ]; do
|
||||
let found_disk_type=0
|
||||
#if $getVar('disk_type_only','') != ""
|
||||
@ -28,34 +29,44 @@ while [ \$disk_mapping_offset -lt \$disk_mapping_nums ]; do
|
||||
#else
|
||||
let found_disk_type=1
|
||||
#end if
|
||||
if [ \$found_disk_type -gt 0 ]; then
|
||||
disk_name=\$(basename \$2)
|
||||
disk_mapping[\$disk_name]=\$1
|
||||
fi
|
||||
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}"
|
||||
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
|
||||
|
||||
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
|
||||
let found_disk=0
|
||||
disk=\$1
|
||||
disk_name=\$(basename \$1)
|
||||
#if $getVar('keep_old_partitions', '0') == "0"
|
||||
dd if=/dev/zero of=/dev/\${disk_name} bs=512 count=1
|
||||
#end if
|
||||
shift 2
|
||||
if [[ x"\${disk_mapping[\${disk_name}]}" == x"" ]]; then
|
||||
echo "ignore disk \$1 since it is not in disk_mapping" >> /tmp/log
|
||||
let disk_offset=\$disk_offset+1
|
||||
shift 2
|
||||
echo "ignore disk \${disk_name} since it is not in disk_mapping" >> /tmp/log
|
||||
let disk_offset=\$disk_offset+1
|
||||
continue
|
||||
fi
|
||||
let found_disk=0
|
||||
|
||||
#if $getVar('partitions_only', '') != ""
|
||||
#for $partition_only in $partitions_only.split(',')
|
||||
#if not $partition_only
|
||||
@ -70,52 +81,166 @@ while [ \$disk_offset -lt \$disk_nums ]; do
|
||||
#else
|
||||
let found_disk=1
|
||||
#end if
|
||||
if [ \$found_disk -gt 0 ]; then
|
||||
echo "add disk \${disk_name} in partitioning list" >> /tmp/log
|
||||
|
||||
#if $getVar('partition_by_path', '0') != "0"
|
||||
disks[\$found_disk_offset]=/dev/disk/by-path/\${disk_mapping[\${disk_name}]}
|
||||
#else
|
||||
disks[\$found_disk_offset]=/dev/\${disk_name}
|
||||
disk=\${disk_mapping[\${disk_name}]}
|
||||
#end if
|
||||
let found_disk_offset=\$found_disk_offset+1
|
||||
|
||||
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
|
||||
let disk_offset=\$disk_offset+1
|
||||
shift 2
|
||||
|
||||
disks[\${disk_offset}]=\$disk
|
||||
let disk_offset=\${disk_offset}+1
|
||||
done
|
||||
echo "partition disks \${partition_disks[@]}" >> /tmp/log
|
||||
echo "disks \${disks[@]}" >> /tmp/log
|
||||
|
||||
#if $getVar('sort_disks', '0') != "0"
|
||||
sorted_disks=(\$(printf '%s\n' \${disks[@]} | sort))
|
||||
sorted_disks=(\$(printf '%s\n' \${partition_disks[@]} | sort))
|
||||
#else
|
||||
sorted_disks=(\${disks[@]})
|
||||
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[@]}
|
||||
sorted_disks=(\${@:$start_from_disk})
|
||||
shift $disk_start_offset
|
||||
sorted_disks=(\$@)
|
||||
echo "sorted disks begin from the $start_from_disk: \${sorted_disks[@]}" >> /tmp/log
|
||||
#end if
|
||||
|
||||
#if $getVar('disk_num', '') != ""
|
||||
set \${sorted_disks[@]}
|
||||
sorted_disks=(\${@:1:$disk_num})
|
||||
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/preseed.log
|
||||
|
||||
let disk_nums=\${#sorted_disks[@]}
|
||||
sorted_disks_str=""
|
||||
for disk in \${sorted_disks[@]}; do
|
||||
sorted_disks_str="\${sorted_disks_str},\${disk}"
|
||||
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
|
||||
#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+=(\$disk)
|
||||
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+=(\$disk)
|
||||
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/preseed.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/preseed.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/preseed.log
|
||||
for remove_vg in \${remove_vgs}; do
|
||||
vgremove -f \${remove_vg}
|
||||
done
|
||||
|
||||
echo "remove partitions \${remove_partitions} from \${remove_vgs}" >> /tmp/preseed.log
|
||||
for remove_partition in \${remove_partitions}; do
|
||||
pvremove -ff -y \${remove_partition}
|
||||
done
|
||||
|
||||
declare -A reserve_disks_size
|
||||
#if $disk_reserve_size != None
|
||||
@ -134,14 +259,10 @@ declare -A reserve_disks_size
|
||||
#else
|
||||
#set disk_size = $int($size)
|
||||
#end if
|
||||
#if $getVar('partition_by_path', '0') != "0"
|
||||
disk=/dev/disk/by-path/\${disk_mapping[\${disk_name}]}
|
||||
#else
|
||||
disk=/dev/${disk_name}
|
||||
#end if
|
||||
reserve_disks_size[\$disk]=${disk_size}
|
||||
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')
|
||||
@ -172,12 +293,7 @@ declare -A max_disks_size
|
||||
#else
|
||||
#set disk_size = $int($size)
|
||||
#end if
|
||||
#if $getVar('partition_by_path', '0') != "0"
|
||||
disk=/dev/disk/by-path/\${disk_mapping[\${disk_name}]}
|
||||
#else
|
||||
disk=/dev/${disk_name}
|
||||
#end if
|
||||
max_disks_size[\$disk]=${disk_size}
|
||||
max_disks_size[\${disk_name}]=${disk_size}
|
||||
#end for
|
||||
#end if
|
||||
|
||||
@ -212,7 +328,8 @@ declare -A partitions_maxsize
|
||||
#set volname = $vol[1:].replace('/', '_')
|
||||
#else
|
||||
#set volname = ''
|
||||
# $vol is not starts with /
|
||||
# $vol is not starts with /
|
||||
#continue
|
||||
#end if
|
||||
partitions_name[$vol]=$volname
|
||||
#set vol_size = $vol_size.strip()
|
||||
@ -300,14 +417,18 @@ 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]}" >> /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]}" >> /tmp/part-include
|
||||
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
|
||||
@ -320,23 +441,11 @@ fi
|
||||
echo "partition disks" >> /tmp/log
|
||||
|
||||
vggroup=''
|
||||
reserve_vggroup=''
|
||||
let disk_nums=\${#sorted_disks[@]}
|
||||
let disk_offset=0
|
||||
while [ \${disk_offset} -lt \${disk_nums} ]; do
|
||||
let pv_id=\${disk_offset}+1
|
||||
disk=\${sorted_disks[\${disk_offset}]}
|
||||
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
|
||||
partname="pv.0\${pv_id}"
|
||||
if [ ! -z "\${max_disks_size[\${disk}]}" ]; then
|
||||
max_disk_size=\${max_disks_size[\${disk}]}
|
||||
@ -351,15 +460,26 @@ while [ \${disk_offset} -lt \${disk_nums} ]; do
|
||||
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
|
||||
let disk_offset=\$disk_offset+1;
|
||||
done
|
||||
|
||||
if [ ! -z "\${reserve_vggroup}" ]; then
|
||||
echo "volgroup reserved \${reserve_vggroup}" >> /tmp/part-include
|
||||
fi
|
||||
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}
|
||||
|
@ -1,20 +1,20 @@
|
||||
#set ssh_keys = $getVar("push_ssh_keys", "/root/.ssh/id_rsa.pub")
|
||||
#if $ssh_keys != ""
|
||||
mkdir -p /root/.ssh
|
||||
chmod 700 -R /root/.ssh
|
||||
#if $getVar("push_ssh_keys", "") != ""
|
||||
#set $ssh_keys = $push_ssh_keys.split(',')
|
||||
set $firstline = True
|
||||
#for $ssh_key in $ssh_keys
|
||||
#set $firstline = True
|
||||
#for $ssh_key in $ssh_keys.split(',')
|
||||
#if not $ssh_key
|
||||
#continue
|
||||
#end if
|
||||
#set f = open($ssh_key)
|
||||
#set f = $open($ssh_key)
|
||||
#if $firstline
|
||||
cat << EOL > /root/.ssh/authorized_keys
|
||||
#echo $f.read()
|
||||
#echo $f.read()
|
||||
EOL
|
||||
#else
|
||||
cat << EOL >> /root/.ssh/authorized_keys
|
||||
#echo $f.read()
|
||||
#echo $f.read()
|
||||
EOL
|
||||
#end if
|
||||
#silent $f.close()
|
||||
|
@ -1,6 +1,74 @@
|
||||
$SNIPPET('kickstart_yum.conf')
|
||||
$SNIPPET('kickstart_centos_base_repo')
|
||||
$SNIPPET('kickstart_centos_debuginfo_repo')
|
||||
$SNIPPET('kickstart_centos_vault_repo')
|
||||
$SNIPPET('kickstart_yum_local_repo')
|
||||
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 /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 $repo_data = $getVar("repo_data",[])
|
||||
#for $repo in $repo_data
|
||||
cat << EOF > /etc/yum.repos.d/${repo.name}.repo
|
||||
[$repo.name]
|
||||
name=CentOS - $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
|
||||
#end if
|
||||
|
@ -1,32 +0,0 @@
|
||||
cat << EOF > /etc/yum.conf
|
||||
[main]
|
||||
cachedir=/var/cache/yum/\\$basearch/\\$releasever
|
||||
#if $getVar("local_repo","") == ""
|
||||
#if $getVar('proxy', '') != ""
|
||||
proxy=$proxy
|
||||
#end if
|
||||
#end if
|
||||
keepcache=0
|
||||
debuglevel=2
|
||||
logfile=/var/log/yum.log
|
||||
exactarch=1
|
||||
obsoletes=1
|
||||
gpgcheck=1
|
||||
plugins=1
|
||||
installonly_limit=5
|
||||
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=16&ref=http://bugs.centos.org/bug_report_page.php?category=yum
|
||||
distroverpkg=centos-release
|
||||
|
||||
# This is the default, if you make this bigger yum won't see if the metadata
|
||||
# is newer on the remote and so you'll "gain" the bandwidth of not having to
|
||||
# download the new metadata and "pay" for it by yum not having correct
|
||||
# information.
|
||||
# It is esp. important, to have correct metadata, for distributions like
|
||||
# Fedora which don't keep old packages around. If you don't like this checking
|
||||
# interupting your command line usage, it's much better to have something
|
||||
# manually check the metadata once an hour (yum-updatesd will do this).
|
||||
# metadata_expire=90m
|
||||
|
||||
# PUT YOUR REPOS HERE OR IN separate files named file.repo
|
||||
# in /etc/yum.repos.d
|
||||
EOF
|
@ -1,31 +0,0 @@
|
||||
#if $getVar("local_repo","") != ""
|
||||
mkdir -p /tmp/repo_backup
|
||||
mv /etc/yum.repos.d/* /tmp/repo_backup/
|
||||
cat << EOF > /etc/yum.repos.d/Compass.repo
|
||||
[compass_repo]
|
||||
name=Compass yum repo
|
||||
baseurl=$local_repo/compass_repo/
|
||||
enabled=1
|
||||
gpgcheck=0
|
||||
priority=1
|
||||
proxy=_none_
|
||||
skip_if_unavailable=1
|
||||
|
||||
#set $repo_data = $getVar("repo_data",[])
|
||||
#for $repo in $repo_data
|
||||
[$repo.name]
|
||||
name=CentOS-6.5 - $repo.name
|
||||
#if $repo.mirror_locally
|
||||
baseurl=$http_server/cblr/repo_mirror/${repo.name}
|
||||
#else
|
||||
baseurl=${repo.mirror}
|
||||
#end if
|
||||
enabled=1
|
||||
gpgcheck=0
|
||||
priority=${repo.priority}
|
||||
skip_if_unavailable=1
|
||||
proxy=_none_
|
||||
|
||||
#end for
|
||||
EOF
|
||||
#end if
|
@ -11,13 +11,12 @@
|
||||
#end for
|
||||
|
||||
#set $proxy_url = ""
|
||||
#set $local_repo_url = ""
|
||||
#if $getVar("local_repo","") != ""
|
||||
#set $local_repo_url = $local_repo
|
||||
#else
|
||||
#set $local_repo_url = ""
|
||||
#if $getVar("proxy","") != ""
|
||||
#set $proxy_url = $proxy
|
||||
#end if
|
||||
#end if
|
||||
#if $getVar("proxy","") != ""
|
||||
#set $proxy_url = $proxy
|
||||
#end if
|
||||
|
||||
cat << EOF > /etc/chef/chef_client_run.sh
|
||||
|
@ -9,4 +9,23 @@ json_attribs nil
|
||||
pid_file '/var/run/chef-client.pid'
|
||||
# Using default node name (fqdn)
|
||||
no_lazy_load true
|
||||
ssl_verify_mode :verify_none
|
||||
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
|
||||
|
@ -1,5 +1,5 @@
|
||||
cat << EOF > /root/.gemrc
|
||||
#if $getVar("local_repo","") == "" and $getVar('proxy', '') != ""
|
||||
#if $getVar('proxy', '') != ""
|
||||
gem: --no-ri --no-rdoc --http-proxy=$proxy
|
||||
#else
|
||||
gem: --no-ri --no-rdoc
|
||||
@ -10,6 +10,9 @@ gem: --no-ri --no-rdoc
|
||||
: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
|
||||
|
@ -10,4 +10,23 @@ 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
|
||||
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
|
||||
|
@ -1,13 +1,45 @@
|
||||
#set profile_name = $getVar('profile_name','')
|
||||
#set os_info = $profile_name.split('-')
|
||||
#set osname = $os_info[0].lower()
|
||||
#set osversion = $os_info[1]
|
||||
|
||||
cat << EOF > /etc/apt/apt.conf
|
||||
#if $getVar("local_repo","") == ""
|
||||
#if $getVar('proxy', '') != ''
|
||||
APT::Get::Assume-Yes "true";
|
||||
APT::Get::force-yes "true";
|
||||
#if $getVar('proxy', '') != ''
|
||||
Acquire::http::Proxy "$proxy";
|
||||
#end if
|
||||
#end if
|
||||
#set $repo_data = $getVar("repo_data",[])
|
||||
#for $repo in $repo_data
|
||||
#for $dist in $repo.apt_dists
|
||||
#set $comps = " ".join($repo.apt_components)
|
||||
#if $repo.mirror_locally
|
||||
Acquire::http::Proxy::$http_server "DIRECT";
|
||||
#end if
|
||||
#end for
|
||||
#end for
|
||||
#if $getVar("local_repo","") != ""
|
||||
#import urlparse
|
||||
#set $local_repo_url = $urlparse.urlparse($local_repo)
|
||||
#set $local_repo_server = $local_repo_url.hostname
|
||||
Acquire::http::Proxy::${local_repo_server} DIRECT;
|
||||
#end if
|
||||
EOF
|
||||
|
||||
cat << EOF > /etc/apt/sources.list
|
||||
#if $getVar("local_repo","") != ""
|
||||
rm -f /etc/apt/sources.list
|
||||
|
||||
#if $getVar("local_repo", "") == "" or $getVar("local_repo_only","1") == "0"
|
||||
#set repos_snippet = 'apt.repos.d/%s/%s/preseed_repos' % ($osname, $osversion)
|
||||
$SNIPPET($repos_snippet)
|
||||
#end if
|
||||
|
||||
#if $arch == "x86_64"
|
||||
#set $rarch = "[arch=amd64]"
|
||||
#else
|
||||
#set $rarch = "[arch=%s]" % $arch
|
||||
#end if
|
||||
|
||||
cat << EOF >> /etc/apt/sources.list
|
||||
#set $repo_data = $getVar("repo_data",[])
|
||||
#for $repo in $repo_data
|
||||
#for $dist in $repo.apt_dists
|
||||
@ -15,11 +47,6 @@ cat << EOF > /etc/apt/sources.list
|
||||
#if $repo.comment != ""
|
||||
# ${repo.comment}
|
||||
#end if
|
||||
#if $repo.arch == "x86_64"
|
||||
#set $rarch = "[arch=amd64]"
|
||||
#else
|
||||
#set $rarch = "[arch=%s]" % $repo.arch
|
||||
#end if
|
||||
#if $repo.mirror_locally
|
||||
deb ${rarch} http://$http_server/cblr/repo_mirror/${repo.name} $dist $comps
|
||||
#else
|
||||
@ -27,19 +54,11 @@ deb ${rarch} ${repo.mirror} $dist $comps
|
||||
#end if
|
||||
#end for
|
||||
#end for
|
||||
#if $arch == "x86_64"
|
||||
#set $rarch = "[arch=amd64]"
|
||||
#else
|
||||
#set $rarch = "[arch=%s]" % $arch
|
||||
#end if
|
||||
deb ${rarch} $local_repo/apt_repo/ubuntu/$arch/12.04/ compass_repo main
|
||||
#else
|
||||
#if $getVar('os_version', '') != ''
|
||||
deb http://archive.ubuntu.com/ubuntu/ $os_version main restricted universe multiverse
|
||||
deb http://archive.ubuntu.com/ubuntu/ ${os_version}-security main restricted universe multiverse
|
||||
deb http://archive.ubuntu.com/ubuntu/ ${os_version}-updates main restricted universe multiverse
|
||||
deb http://archive.ubuntu.com/ubuntu/ ${os_version}-proposed main restricted universe multiverse
|
||||
deb http://archive.ubuntu.com/ubuntu/ ${os_version}-backports main restricted universe multiverse
|
||||
#end if
|
||||
#end if
|
||||
EOF
|
||||
|
||||
#if $getVar("local_repo","") != ""
|
||||
cat << EOF >> /etc/apt/sources.list
|
||||
#set compass_repo = 'apt.repos.d/%s/%s/ubuntu_repo' % ($osname, $osversion)
|
||||
deb ${rarch} $local_repo/$compass_repo/ local_repo main
|
||||
EOF
|
||||
#end if
|
||||
|
@ -10,6 +10,8 @@ echo "$hostname" > /etc/hostname
|
||||
/bin/hostname $hostname
|
||||
#end if
|
||||
|
||||
#set osversion = $getVar("os_version","")
|
||||
|
||||
$SNIPPET('preseed_hosts')
|
||||
|
||||
#set $num_ns_search = $len($name_servers_search)
|
||||
@ -32,6 +34,7 @@ echo "nameserver $nameserver" >>/etc/resolv.conf
|
||||
|
||||
echo '' > /tmp/network_log
|
||||
|
||||
# get physical interfaces
|
||||
physical_interfaces=""
|
||||
for physical_interface in \$(ip -o link | cut -d: -f2 | grep -v lo); do
|
||||
echo "processing physical interface \${physical_interface}" >> /tmp/network_log
|
||||
@ -40,24 +43,46 @@ for physical_interface in \$(ip -o link | cut -d: -f2 | grep -v lo); do
|
||||
else
|
||||
physical_interfaces="\${physical_interfaces} \${physical_interface}"
|
||||
fi
|
||||
eval "physical_interface_\${physical_interface}=\${physical_interface}"
|
||||
done
|
||||
echo "physical interfaces \${physical_interfaces}" >> /tmp/network_log
|
||||
echo "physical interfaces: \${physical_interfaces}" >> /tmp/network_log
|
||||
|
||||
# map physical interface to mac address
|
||||
mac_names=""
|
||||
for physical_interface in \${physical_interfaces}; do
|
||||
mac=\$(cat /sys/class/net/\${physical_interface}/address)
|
||||
mac=\$(echo \${mac} |tr 'a-z' 'A-Z' | tr ':' '_')
|
||||
set \$(ip link show \${physical_interface})
|
||||
#if $osversion == "trusty"
|
||||
mac=\$(echo \$@ | cut -d' ' -f17)
|
||||
#else
|
||||
mac=\$(echo \$@ | cut -d' ' -f13)
|
||||
#end if
|
||||
mac_name=\$(echo \${mac} |tr 'a-z' 'A-Z' | tr ':' '_')
|
||||
if [ -z "\${mac_name}" ]; then
|
||||
mac_names="\${mac_name}"
|
||||
else
|
||||
mac_names="\${mac_names} \${mac_name}"
|
||||
fi
|
||||
echo "mapping physical interface \${physical_interface} to mac \${mac}" >> /tmp/network_log
|
||||
eval "physical_interface_mac_\${physical_interface}=\$mac"
|
||||
eval "physical_mac_interface_\${mac}=\${physical_interface}"
|
||||
eval "physical_mac_interface_\${mac_name}=\${physical_interface}"
|
||||
eval "mac_name_\${mac_name}=\$mac"
|
||||
done
|
||||
|
||||
for physcial_interface in \${physical_interfaces}; do
|
||||
echo "list physical interfaces to mac" >> /tmp/network_log
|
||||
for physical_interface in \${physical_interfaces}; do
|
||||
eval "mac=\\${physical_interface_mac_\${physical_interface}}"
|
||||
echo "physical interface to mac: \${physcial_interface} => \${mac}" >> /tmp/network_log
|
||||
echo "physical interface to mac: \${physical_interface} => \${mac}" >> /tmp/network_log
|
||||
done
|
||||
|
||||
echo "list mac to physical interface mapping" >> /tmp/network_log
|
||||
for mac_name in \${mac_names}; do
|
||||
eval "mac=\\${mac_name_\${mac_name}}"
|
||||
eval "physical_interface=\\${physical_mac_interface_\${mac_name}}"
|
||||
echo "mac to physical interface: \${mac} => \${physical_interface}" >> /tmp/network_log
|
||||
done
|
||||
|
||||
logical_interfaces=""
|
||||
#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]+")
|
||||
@ -69,46 +94,95 @@ logical_interfaces=""
|
||||
#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
|
||||
if [ -z "\${logical_interfaces}" ]; then
|
||||
logical_interfaces="$iname"
|
||||
logical_interfaces="\${logical_interface}"
|
||||
else
|
||||
logical_interfaces="\${logical_interfaces} $iname"
|
||||
logical_interfaces="\${logical_interfaces} \${logical_interface}"
|
||||
fi
|
||||
eval "logical_interface_\${logical_interface}=\${logical_interface}"
|
||||
#if $mac != ""
|
||||
#set mac = $mac.replace(':', '_')
|
||||
physical_interface=\${physical_mac_interface_$mac}
|
||||
#set mac_name = $mac.replace(':', '_')
|
||||
physical_interface=\${physical_mac_interface_${mac_name}}
|
||||
eval "logical_interface_mapping_\${logical_interface}=\${physical_interface}"
|
||||
if [ ! -z "\${physical_interface}" ]; then
|
||||
logical_interface_mapping_$iname=\${physical_interface}
|
||||
eval "physical_interface_mapping_\${physical_interface}=$iname"
|
||||
echo "set logical interface $iname map to physical interface \${physical_interface}" >> /tmp/network_log
|
||||
else
|
||||
logical_interface_mapping_$iname=$iname
|
||||
physical_interface_mapping_$iname=$iname
|
||||
echo "force set logical interface $iname to the same physical interface" >> /tmp/network_log
|
||||
eval "physical_interface_mapping_\${physical_interface}=\${logical_interface}"
|
||||
fi
|
||||
#else
|
||||
eval "physical_interface=\\${logical_interface_mapping_\${logical_interface}}"
|
||||
if [ -z "\${physical_interface}" ]; then
|
||||
eval "logical_interface_mapping_\${logical_interface}="
|
||||
fi
|
||||
#end if
|
||||
#end for
|
||||
|
||||
echo "logical interfaces \${logical_interfaces}" >> /tmp/network_log
|
||||
echo "logical interfaces: \${logical_interfaces}" >> /tmp/network_log
|
||||
|
||||
echo "finish mapping logical interfaces in network config to physical interfaces" >> /tmp/network_log
|
||||
for key in \${logical_interfaces}; do
|
||||
eval "physical_interface=\\${logical_interface_mapping_\${key}}"
|
||||
echo "map logical interface \${key} to physical interface \${physical_interface}" >> /tmp/network_log
|
||||
done
|
||||
for key in \${physical_interfaces}; do
|
||||
eval "logical_interface=\\${physical_interface_mapping_\${key}}"
|
||||
echo "map physical interface \${key} to logical interface \${logical_interface}" >> /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_interfaces}; do
|
||||
eval "physical_interface=\\${logical_interface_mapping_\${logical_interface}}"
|
||||
if [ ! -z "\${physical_interface}" ]; then
|
||||
echo "ignore logical interface \${logical_interface} where its physical interface is \${physical_interface}" >> /tmp/network_log
|
||||
continue
|
||||
fi
|
||||
eval "physical_interface_mac=\\${physical_interface_mac_\${logical_interface}}"
|
||||
if [ -z "\${physical_interface_mac}" ]; then
|
||||
continue
|
||||
# check if the same name physical interface is mapped
|
||||
eval "mapped_logical_interface=\\${physical_interface_mapping_\${logical_interface}}"
|
||||
if [ ! -z "\${mapped_logical_interface}" ]; then
|
||||
echo "ignore logical interface \${logical_interface} since the same name physical interface is mapped by logical interface \${mapped_logical_interface}" >> /tmp/network_log
|
||||
continue
|
||||
fi
|
||||
# check if the same name physical interface exists
|
||||
eval "mapped_logical_interface=\\${physical_interface_\${logical_interface}}"
|
||||
if [ -z "\${mapped_logical_interface}" ]; then
|
||||
echo "ignore logical interface \${logical_interface} since the same name physical interface does not exist" >> /tmp/network_log
|
||||
continue
|
||||
fi
|
||||
eval "logical_interface_mapping_\${logical_interface}=\${logical_interface}"
|
||||
eval "physical_interface_mapping_\${logical_interface}=\${logical_interface}"
|
||||
echo "set logical interface \${logical_interface} to the same physical interface" >> /tmp/network_log
|
||||
done
|
||||
|
||||
echo "finish mapping unmapped logical interfaces in network config to the same name physical interfaces" >> /tmp/network_log
|
||||
for key in \${logical_interfaces}; do
|
||||
eval "physical_interface=\\${logical_interface_mapping_\${key}}"
|
||||
echo "map logical interface \${key} to physical interface \${physical_interface}" >> /tmp/network_log
|
||||
done
|
||||
for key in \${physical_interfaces}; do
|
||||
eval "logical_interface=\\${physical_interface_mapping_\${key}}"
|
||||
echo "map physical interface \${key} to logical interface \${logical_interface}" >> /tmp/network_log
|
||||
done
|
||||
|
||||
|
||||
unset_physical_interfaces=""
|
||||
echo "get unset physical interfaces from \${physical_interfaces}" >> /tmp/network_log
|
||||
for physical_interface in \${physical_interfaces}; do
|
||||
eval "logical_interface=\\${physical_interface_mapping_\${physical_interface}}"
|
||||
if [ ! -z "\${logical_interface}" ]; then
|
||||
echo "physical interface \${physical_interface} is already set to \${logical_interface}" >> /tmp/network_log
|
||||
continue
|
||||
fi
|
||||
if [ -z "\${unset_physical_interfaces}" ]; then
|
||||
@ -116,13 +190,16 @@ for physical_interface in \${physical_interfaces}; do
|
||||
else
|
||||
unset_physical_interfaces="\${unset_physical_interfaces} \${physical_interface}"
|
||||
fi
|
||||
eval "unset_physical_interface_\${physical_interface}=\${physical_interface}"
|
||||
done
|
||||
echo "unset phsycial interfaces \${unset_physiccal_interfaces}" >> /tmp/network_log
|
||||
echo "unset physical interfaces \${unset_physical_interfaces}" >> /tmp/network_log
|
||||
|
||||
unset_logical_interfaces=""
|
||||
echo "get unset logical interfaces from \${logical_interfaces}" >> /tmp/network_log
|
||||
for logical_interface in \${logical_interfaces}; do
|
||||
eval "physical_interface=\\${logical_interface_mapping_\${logical_interface}}"
|
||||
if [ ! -z "\${physical_interface}" ]; then
|
||||
echo "logical interface \${logical_interface} is already set to \${physical_interface}" >> /tmp/network_log
|
||||
continue
|
||||
fi
|
||||
if [ -z "\${unset_logical_interfaces}" ]; then
|
||||
@ -133,33 +210,227 @@ for logical_interface in \${logical_interfaces}; do
|
||||
done
|
||||
echo "unset logical interfaces \${unset_logical_interfaces}" >> /tmp/network_log
|
||||
|
||||
sorted_physical_interfaces=\$(printf '%s\n' \${unset_physical_interfaces} | sort)
|
||||
echo "sorted unset physical interfaces \${sorted_physical_interfaces}" >> /tmp/network_log
|
||||
sorted_logical_interfaces=\$(printf '%s\n' \${unset_logical_interfaces} | sort)
|
||||
echo "sorted unset logical interfaces \${sorted_logical_interfaces}" >> /tmp/network_log
|
||||
sorted_unset_physical_interfaces=\$(printf '%s\n' \${unset_physical_interfaces} | sort | xargs)
|
||||
echo "sorted unset physical interfaces \${sorted_unset_physical_interfaces}" >> /tmp/network_log
|
||||
sorted_unset_logical_interfaces=\$(printf '%s\n' \${unset_logical_interfaces} | sort | xargs)
|
||||
echo "sorted unset logical interfaces \${sorted_unset_logical_interfaces}" >> /tmp/network_log
|
||||
|
||||
for logical_interface in \${sorted_logical_interfaces}; do
|
||||
set \${sorted_physical_interfaces}
|
||||
# map unset logical interface to unset physical interface
|
||||
echo "map unset logical interfaces \${sorted_unset_logical_interfaces} to unset physical interfaces \${sorted_unset_physical_interfaces}" >> /tmp/network_log
|
||||
unset_logical_interfaces=""
|
||||
for logical_interface in \${sorted_unset_logical_interfaces}; do
|
||||
set \${sorted_unset_physical_interfaces}
|
||||
physical_interface_num=\$#;
|
||||
if [ \${phsycial_interface_num} -gt 0 ]; then
|
||||
if [ \${physical_interface_num} -gt 0 ]; then
|
||||
physical_interface=\$1
|
||||
shift 1
|
||||
sorted_physical_interfaces="\$@"
|
||||
sorted_unset_physical_interfaces="\$@"
|
||||
echo "map unset logical interface \${logical_interface} to unset physical interface \${physical_interface}" >> /tmp/network_log
|
||||
eval "physical_interface_mapping_\${physical_interface}=\${logical_interface}"
|
||||
eval "logical_interface_mapping_\${logical_interface}=\${physical_interface}"
|
||||
else
|
||||
physical_interface=\${logical_interface}
|
||||
echo "remain unset logical interface \${logical_interface} since there is no remain unset physical interfaces" >> /tmp/network_log
|
||||
if [ -z "\${unset_logical_interfaces}" ]; then
|
||||
unset_logical_interfaces="\${logical_interface}"
|
||||
else
|
||||
unset_logical_interfaces="\${unset_logical_interfaces} \${logical_interface}"
|
||||
fi
|
||||
fi
|
||||
eval "physical_interface_mapping_\${physical_interface}=\${logical_interface}"
|
||||
eval "logical_interface_mapping_\${logical_interface}=\${physical_interface}"
|
||||
done
|
||||
sorted_unset_logical_interfaces=\${unset_logical_interfaces}
|
||||
unset_physical_interfaces=\${sorted_unset_physical_interfaces}
|
||||
|
||||
echo "finish mapping unmapped logical interfaces in network config to unmapped physical interfaces" >> /tmp/network_log
|
||||
for key in \${logical_interfaces}; do
|
||||
eval "physical_interface=\\${logical_interface_mapping_\${key}}"
|
||||
echo "map logical interface \${key} to physical interface \${physical_interface}" >> /tmp/network_log
|
||||
done
|
||||
for key in \${physical_interfaces}; do
|
||||
eval "logical_interface=\\${physical_interface_mapping_\${key}}"
|
||||
echo "map physical interface \${key} to logical interface \${logical_interface}" >> /tmp/network_log
|
||||
done
|
||||
|
||||
for physical_interface in \${physical_interfaces}; do
|
||||
eval "logical_interface=\\${physical_interface_mapping_\${physical_interface}}"
|
||||
echo "physical interface \${physical_interface} map to logical interface \${logical_interface}" >> /tmp/network_log
|
||||
echo "unset physical interfaces \${sorted_unset_physical_interfaces}" >> /tmp/network_log
|
||||
echo "unset logical interfaces \${sorted_unset_logical_interfaces}" >> /tmp/network_log
|
||||
|
||||
# map any unmapped logical interfaces
|
||||
echo "map unmapped logical interfaces" >> /tmp/network_log
|
||||
if [ ! -z "\${sorted_unset_logical_interfaces}" ]; then
|
||||
# get all available logical interfaces which the same name physical interface is not used
|
||||
available_logical_interfaces=""
|
||||
for logical_interface in \${logical_interfaces}; do
|
||||
eval "mapped_logical_interface=\\${physical_interface_mapping_\${logical_interface}}"
|
||||
if [ -z "\${mapped_logical_interface}" ]; then
|
||||
eval "available_logical_interface_\${logical_interface}=\${logical_interface}"
|
||||
if [ -z "\${available_logical_interfaces}" ]; then
|
||||
available_logical_interfaces="\${logical_interface}"
|
||||
else
|
||||
available_logical_interfaces="\${available_logical_interfaces} \${logical_interface}"
|
||||
fi
|
||||
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
|
||||
|
||||
# add extra logical interfaces name to physical interfaces
|
||||
if [ -z "\${physical_interfaces}" ]; then
|
||||
physical_interfaces="\${available_logical_interfaces}"
|
||||
else
|
||||
physical_interfaces="\${physical_interfaces} \${available_logical_interfaces}"
|
||||
fi
|
||||
echo "updated physical interfaces: \${physical_interfaces}" >> /tmp/network_log
|
||||
|
||||
#first map logical interface to the same name physical interface if that physical interface name is not used
|
||||
unset_logical_interfaces=""
|
||||
for logical_interface in \${sorted_unset_logical_interfaces}; do
|
||||
eval "available_logical_interface=\\${available_logical_interface_\${logical_interface}}"
|
||||
if [ ! -z "\${available_logical_interface}" ]; then
|
||||
eval "physical_interface_mapping_\${available_logical_interface}=\${logical_interface}"
|
||||
eval "logical_interface_mapping_\${logical_interface}=\${available_logical_interface}"
|
||||
else
|
||||
if [ -z "\${unset_logical_interfaces}" ]; then
|
||||
unset_logical_interfaces="\${logical_interface}"
|
||||
else
|
||||
unset_logical_interfaces="\${unset_logical_interfaces} \${logical_interface}"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
sorted_unset_logical_interfaces=\${unset_logical_interfaces}
|
||||
|
||||
echo "finish mapping ramaining unmapped logical interfaces to the same name physical interface" >> /tmp/network_log
|
||||
for key in \${logical_interfaces}; do
|
||||
eval "physical_interface=\\${logical_interface_mapping_\${key}}"
|
||||
echo "map logical interface \${key} to physical interface \${physical_interface}" >> /tmp/network_log
|
||||
done
|
||||
for key in \${physical_interfaces}; do
|
||||
eval "logical_interface=\\${physical_interface_mapping_\${key}}"
|
||||
echo "map physical interface \${key} to logical interface \${logical_interface}" >> /tmp/network_log
|
||||
done
|
||||
|
||||
echo "unset physical interfaces \${sorted_unset_physical_interfaces}" >> /tmp/network_log
|
||||
echo "unset logical interfaces \${sorted_unset_logical_interfaces}" >> /tmp/network_log
|
||||
|
||||
# map remain unset logical interfaces to available logical interface names
|
||||
for logical_interface in \${sorted_unset_logical_interfaces}; do
|
||||
for available_logical_interface in \${available_logical_interfaces}; do
|
||||
eval "mapped_logical_interface=\\${physical_interface_mapping_\${available_logical_interface}}"
|
||||
if [ -z "\${mapped_logical_interface}" ]; then
|
||||
eval "physical_interface_mapping_\${available_logical_interface}=\${logical_interface}"
|
||||
eval "logical_interface_mapping_\${logical_interface}=\${available_logical_interface}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
done
|
||||
fi
|
||||
unset_logical_interfaces=""
|
||||
sorted_unset_logical_interfaces=""
|
||||
|
||||
echo "finish mapping ramaining unmapped logical interfaces" >> /tmp/network_log
|
||||
for key in \${logical_interfaces}; do
|
||||
eval "physical_interface=\\${logical_interface_mapping_\${key}}"
|
||||
echo "map logical interface \${key} to physical interface \${physical_interface}" >> /tmp/network_log
|
||||
done
|
||||
for key in \${physical_interfaces}; do
|
||||
eval "logical_interface=\\${physical_interface_mapping_\${key}}"
|
||||
echo "map physical interface \${key} to logical interface \${logical_interface}" >> /tmp/network_log
|
||||
done
|
||||
|
||||
for logical_interface in \${logical_interfaces}; do
|
||||
eval "physical_interface=\\${logical_interface_mapping_\${logical_interface}}"
|
||||
echo "logical interface \${logical_interface} map to physical interface \${physical_interface}" >> /tmp/network_log
|
||||
# map any unmapped physical interfaces
|
||||
echo "map unmapped physical interfaces" >> /tmp/network_log
|
||||
if [ ! -z "\${sorted_unset_physical_interfaces}" ]; then
|
||||
# get all available physical interfaces which the same name logical interface is not used
|
||||
available_physical_interfaces=""
|
||||
for physical_interface in \${physical_interfaces}; do
|
||||
eval "mapped_physical_interface=\\${logical_interface_mapping_\${physical_interface}}"
|
||||
if [ -z "\${mapped_physical_interface}" ]; then
|
||||
eval "available_physical_interface_\${physical_interface}=\${physical_interface}"
|
||||
if [ -z "\${available_physical_interfaces}" ]; then
|
||||
available_physical_interfaces="\${physical_interface}"
|
||||
else
|
||||
available_physical_interfaces="\${available_physical_interfaces} \${physical_interface}"
|
||||
fi
|
||||
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
|
||||
|
||||
# add extra physical interfaces name to logical interfaces
|
||||
if [ -z "\${logical_interfaces}" ]; then
|
||||
logical_interfaces="\${available_physical_interfaces}"
|
||||
else
|
||||
logical_interfaces="\${logical_interfaces} \${available_physical_interfaces}"
|
||||
fi
|
||||
echo "updated logical interfaces: \${logical_interfaces}" >> /tmp/network_log
|
||||
|
||||
#first map physical interface to the same name logical interface if that logical interface name is not used
|
||||
unset_physical_interfaces=""
|
||||
for physical_interface in \${sorted_unset_physical_interfaces}; do
|
||||
eval "available_physical_interface=\\${available_physical_interface_\${physical_interface}}"
|
||||
if [ ! -z "\${available_physical_interface}" ]; then
|
||||
eval "logical_interface_mapping_\${available_physical_interface}=\${physical_interface}"
|
||||
eval "physical_interface_mapping_\${physical_interface}=\${available_physical_interface}"
|
||||
else
|
||||
if [ -z "\${unset_physical_interfaces}" ]; then
|
||||
unset_physical_interfaces="\${physical_interface}"
|
||||
else
|
||||
unset_physical_interfaces="\${unset_physical_interfaces} \${physical_interface}"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
sorted_unset_physical_interfaces=\${unset_physical_interfaces}
|
||||
|
||||
echo "finish mapping ramaining unmapped physical interfaces to the same name logical interface" >> /tmp/network_log
|
||||
for key in \${logical_interfaces}; do
|
||||
eval "physical_interface=\\${logical_interface_mapping_\${key}}"
|
||||
echo "map logical interface \${key} to physical interface \${physical_interface}" >> /tmp/network_log
|
||||
done
|
||||
for key in \${physical_interfaces}; do
|
||||
eval "logical_interface=\\${physical_interface_mapping_\${key}}"
|
||||
echo "map physical interface \${key} to logical interface \${logical_interface}" >> /tmp/network_log
|
||||
done
|
||||
|
||||
echo "unset physical interfaces \${sorted_unset_physical_interfaces}" >> /tmp/network_log
|
||||
echo "unset logical interfaces \${sorted_unset_logical_interfaces}" >> /tmp/network_log
|
||||
|
||||
# map remain unset physical interfaces to logical interface name as available physical interface names
|
||||
for physical_interface in \${sorted_unset_physical_interfaces}; do
|
||||
for available_physical_interface in \${available_physical_interfaces}; do
|
||||
eval "mapped_physical_interface=\\${logical_interface_mapping_\${available_physical_interface}}"
|
||||
if [ -z "\${mapped_physical_interface}" ]; then
|
||||
eval "logical_interface_mapping_\${available_physical_interface}=\${physical_interface}"
|
||||
eval "physical_interface_mapping_\${physical_interface}=\${available_physical_interface}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
done
|
||||
fi
|
||||
unset_physical_interfaces=""
|
||||
sorted_unset_physical_interfaces=""
|
||||
|
||||
echo "finish mapping ramaining unmapped physical interfaces" >> /tmp/network_log
|
||||
for key in \${logical_interfaces}; do
|
||||
eval "physical_interface=\\${logical_interface_mapping_\${key}}"
|
||||
echo "map logical interface \${key} to physical interface \${physical_interface}" >> /tmp/network_log
|
||||
done
|
||||
for key in \${physical_interfaces}; do
|
||||
eval "logical_interface=\\${physical_interface_mapping_\${key}}"
|
||||
echo "map physical interface \${key} to logical interface \${logical_interface}" >> /tmp/network_log
|
||||
done
|
||||
|
||||
for key in \${logical_interfaces}; do
|
||||
eval "physical_interface=\\${logical_interface_mapping_\${key}}"
|
||||
if [ ! -z "\${physical_interface}" ]; then
|
||||
eval "physical_mac=\\${physical_interface_mac_\${physical_interface}}"
|
||||
else
|
||||
physical_mac=""
|
||||
fi
|
||||
if [ ! -z "\${physical_mac}" ]; then
|
||||
physical_mac=\$(echo \${physical_mac} | tr 'A-Z' 'a-z')
|
||||
echo "SUBSYSTEM==\"net\", ACTION==\"add\", DRIVERS==\"?*\", ATTR{address}==\"\${physical_mac}\", ATTR{type}==\"1\", KERNEL==\"eth*\", NAME=\"\$key\"" >> /etc/udev/rules.d/70-persistent-net.rules.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
|
||||
@ -191,50 +462,16 @@ echo "" >> /etc/network/interfaces
|
||||
#set $iface_master = $idata.get("interface_master", "")
|
||||
#set $bonding_opts = $idata.get("bonding_opts", "")
|
||||
#set $bridge_opts = $idata.get("bridge_opts", "")
|
||||
|
||||
used_logical_interface_$iname=$iname
|
||||
|
||||
#if $iface_type in ("slave","bond_slave","bridge_slave","bonded_bridge_slave")
|
||||
#set $static = 1
|
||||
#end if
|
||||
|
||||
## ===================================================================
|
||||
## Things every interface get, no matter what
|
||||
## ===================================================================
|
||||
echo "auto $iname" >> /etc/network/interfaces
|
||||
|
||||
#if $static
|
||||
#if $iface_type not in ("slave","bond_slave","bridge_slave","bonded_bridge_slave")
|
||||
echo "iface $iname inet static" >> /etc/network/interfaces
|
||||
#if $iname in $promisc_interfaces
|
||||
echo " address 0.0.0.0" >> /etc/network/interfaces
|
||||
echo " up ip link set $iname up" >> /etc/network/interfaces
|
||||
echo " up ip link set $iname promisc on" >> /etc/network/interfaces
|
||||
echo " down ip link set $iname promisc off" >> /etc/network/interfaces
|
||||
echo " down ip link set $iname down" >> /etc/network/interfaces
|
||||
#else
|
||||
#if $ip != ""
|
||||
echo " address $ip" >> /etc/network/interfaces
|
||||
#end if
|
||||
#if $if_gateway != ""
|
||||
echo " gateway $if_gateway" >> /etc/network/interfaces
|
||||
#end if
|
||||
#if $netmask == ""
|
||||
## Default to 255.255.255.0?
|
||||
#set $netmask = "255.255.255.0"
|
||||
#end if
|
||||
echo " netmask $netmask" >> /etc/network/interfaces
|
||||
#if $gateway != "" and $if_gateway == "" and $ip != ""
|
||||
#import netaddr
|
||||
#set interface_network = $netaddr.IPNetwork('%s/%s' % ($ip, $netmask))
|
||||
#set gateway_address = $netaddr.IPAddress($gateway)
|
||||
#if $gateway_address in $interface_network
|
||||
echo " gateway $gateway" >> /etc/network/interfaces
|
||||
#end if
|
||||
#end if
|
||||
#if $mtu != ""
|
||||
echo " mtu $mtu" >> /etc/network/interfaces
|
||||
#end if
|
||||
#end if
|
||||
#else
|
||||
echo "iface $iname inet manual" >> /etc/network/interfaces
|
||||
#end if
|
||||
#else
|
||||
echo "iface $iname inet dhcp" >> /etc/network/interfaces
|
||||
#end if
|
||||
@ -243,19 +480,23 @@ echo "iface $iname inet dhcp" >> /etc/network/interfaces
|
||||
#if $vlanpattern.match($iname)
|
||||
#pass
|
||||
#else
|
||||
#if $subinterfacepattern.match($iname)
|
||||
#pass
|
||||
#set $interface_matched = $subinterfacepattern.match($iname)
|
||||
#if $interface_matched
|
||||
#set $interface_name = $interface_matched.group(1)
|
||||
logical_interface=$interface_name
|
||||
#else
|
||||
physical_interface=\${logical_interface_mapping_$iname}
|
||||
logical_interface=$iname
|
||||
#end if
|
||||
eval "physical_interface=\\${logical_interface_mapping_\${logical_interface}}"
|
||||
if [ ! -z "\${physical_interface}" ]; then
|
||||
eval "physical_mac=\\${physical_interface_mac_\${physical_interface}}"
|
||||
fi
|
||||
if [ ! -z "\${physical_mac}" ]; then
|
||||
physical_mac=\$(echo \${physical_mac} | tr '_' ':')
|
||||
echo " hwaddress ether \${physical_mac}" >> /etc/network/interfaces
|
||||
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 \${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 /etc/modprobe.conf.new /etc/modprobe.conf
|
||||
@ -283,6 +524,7 @@ fi
|
||||
#end if
|
||||
#end for
|
||||
echo " bond-slaves $bondslaves" >> /etc/network/interfaces
|
||||
|
||||
#if $bonding_opts != ""
|
||||
#for $bondopts in $bonding_opts.split(" ")
|
||||
#set [$bondkey, $bondvalue] = $bondopts.split("=")
|
||||
@ -310,6 +552,42 @@ echo " bridge_ports $bridgeslaves" >> /etc/network/interfaces
|
||||
echo " bridge_$bridgekey $bridgevalue" >> /etc/network/interfaces
|
||||
#end for
|
||||
#end if
|
||||
#elif $iface_type in ["bridge_slave", "bonded_bridge_slave"] and $iface_master != ""
|
||||
#pass
|
||||
#end if
|
||||
|
||||
#if $static
|
||||
#if $iname in $promisc_interfaces
|
||||
echo " address 0.0.0.0" >> /etc/network/interfaces
|
||||
echo " up ip link set $iname up" >> /etc/network/interfaces
|
||||
echo " up ip link set $iname promisc on" >> /etc/network/interfaces
|
||||
echo " down ip link set $iname promisc off" >> /etc/network/interfaces
|
||||
echo " down ip link set $iname down" >> /etc/network/interfaces
|
||||
#elif $ip != ""
|
||||
echo " address $ip" >> /etc/network/interfaces
|
||||
#if $netmask == ""
|
||||
## Default to 255.255.255.0?
|
||||
#set $netmask = "255.255.255.0"
|
||||
#end if
|
||||
echo " netmask $netmask" >> /etc/network/interfaces
|
||||
#import netaddr
|
||||
#set interface_network = $netaddr.IPNetwork('%s/%s' % ($ip, $netmask))
|
||||
#set interface_network_str = $str($interface_network)
|
||||
#if $if_gateway != ""
|
||||
echo " gateway $if_gateway" >> /etc/network/interfaces
|
||||
#elif $gateway != ""
|
||||
#set gateway_address = $netaddr.IPAddress($gateway)
|
||||
#if $gateway_address in $interface_network
|
||||
echo " gateway $gateway" >> /etc/network/interfaces
|
||||
#end if
|
||||
#end if
|
||||
#end if
|
||||
#else
|
||||
#pass
|
||||
#end if
|
||||
|
||||
#if $mtu != ""
|
||||
echo " mtu $mtu" >> /etc/network/interfaces
|
||||
#end if
|
||||
|
||||
#if not $nameserver_set
|
||||
@ -337,20 +615,32 @@ echo " # Warning: invalid route: $route" >> /etc/network/interfaces
|
||||
#end for
|
||||
|
||||
echo "" >> /etc/network/interfaces
|
||||
## ===================================================================
|
||||
## Done with this interface
|
||||
## ===================================================================
|
||||
#end for
|
||||
|
||||
for physical_interface in \${sorted_physical_interfaces}; do
|
||||
echo "auto \${physical_interface}" >> /etc/network/interfaces
|
||||
echo "iface \${physical_interface} inet static" >> /etc/network/interfaces
|
||||
eval "physical_mac=\\${physical_interface_mac_\${physical_interface}}"
|
||||
if [ ! -z "\${physical_mac}" ]; then
|
||||
physical_mac=\$(echo \${physical_mac} | tr '_' ':')
|
||||
echo " hwaddress ether \${physical_mac}" >> /etc/network/interfaces
|
||||
for logical_interface in \${logical_interfaces}; do
|
||||
eval "used_logical_interface=\\${used_logical_interface_\${logical_interface}}"
|
||||
if [ ! -z "\${used_logical_interface}" ]; then
|
||||
# ignore logical interface that is already generated in above
|
||||
echo "ignore used logical interface \${logical_interface}" >> /tmp/network_log
|
||||
continue
|
||||
fi
|
||||
echo "add logical interface \${logical_interface} into network config since it is not set above" >> /tmp/network_log
|
||||
eval "physical_interface=\\${logical_interface_mapping_\${logical_interface}}"
|
||||
if [ ! -z "\${physical_interface}" ]; then
|
||||
echo "auto \${logical_interface}" >> /etc/network/interfaces
|
||||
echo "iface \${logical_interface} inet static" >> /etc/network/interfaces
|
||||
eval "mac=\\${physical_interface_mac_\${physical_interface}}"
|
||||
if [ ! -z "\$mac" ]; then
|
||||
echo " hwaddress ether \${mac}" >> /etc/network/interfaces
|
||||
fi
|
||||
echo "" >> /etc/network/interfaces
|
||||
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 /etc/modprobe.conf.new /etc/modprobe.conf
|
||||
fi
|
||||
fi
|
||||
echo "" >> /etc/network/interfaces
|
||||
done
|
||||
|
||||
if [ -f "/etc/modprobe.conf" ]; then
|
||||
@ -360,5 +650,7 @@ fi
|
||||
if [ -f "/etc/udev/rules.d/70-persistent-net.rules" ]; then
|
||||
rm -f /etc/udev/rules.d/70-persistent-net.rules
|
||||
fi
|
||||
|
||||
if [ -f "/etc/udev/rules.d/70-persistent-net.rules.new" ]; then
|
||||
mv /etc/udev/rules.d/70-persistent-net.rules.new /etc/udev/rules.d/70-persistent-net.rules
|
||||
fi
|
||||
## End post_install_network_config generated code
|
||||
|
@ -17,7 +17,9 @@ set \$(ls -s -l /dev/disk/by-path | tr -s '\t' ' ' | cut -d' ' -f11,13)
|
||||
disk_mapping_nums=\$((\$#/2))
|
||||
disk_mapping_offset=0
|
||||
echo "disk_mapping_nums: \$disk_mapping_nums" >> /tmp/preseed.log
|
||||
echo "disk_mapping: \$*" >> /tmp/preseed.log
|
||||
disk_mapping=""
|
||||
disk_path_mapping=""
|
||||
while [ \$disk_mapping_offset -lt \$disk_mapping_nums ]; do
|
||||
found_disk_type=0
|
||||
#if $getVar('disk_type_only','') != ""
|
||||
@ -27,7 +29,8 @@ while [ \$disk_mapping_offset -lt \$disk_mapping_nums ]; do
|
||||
#else
|
||||
found_disk_type=1
|
||||
#end if
|
||||
disk_path=\$(echo \$1 | tr '-' '_' | tr ':' '_' | tr '.' '_')
|
||||
path_name=\$(basename \$1)
|
||||
disk_path_name=\$(echo \${path_name} | tr '-' '_' | tr ':' '_' | tr '.' '_')
|
||||
disk_name=\$(basename \$2)
|
||||
disk_mapping_offset=\$((\${disk_mapping_offset}+1))
|
||||
shift 2
|
||||
@ -38,9 +41,14 @@ while [ \$disk_mapping_offset -lt \$disk_mapping_nums ]; do
|
||||
else
|
||||
disk_mapping="\${disk_mapping} \${disk_name}"
|
||||
fi
|
||||
eval "disk_\${disk_name}=\${disk_path}"
|
||||
eval "disk_\${disk_path}=\${disk_path}"
|
||||
eval "disk_path_\${disk_path}=/dev/\${disk_name}"
|
||||
if [ -z "\${disk_path_mapping}" ]; then
|
||||
disk_path_mapping="\${disk_path_name}"
|
||||
else
|
||||
disk_path_mapping="\${disk_path_mapping} \${disk_path_name}"
|
||||
fi
|
||||
eval "disk_\${disk_name}=/dev/disk/by-path/\${path_name}"
|
||||
eval "disk_\${disk_path_name}=/dev/disk/by-path/\${path_name}"
|
||||
eval "disk_path_\${disk_path_name}=/dev/\${disk_name}"
|
||||
eval "disk_path_\${disk_name}=/dev/\${disk_name}"
|
||||
fi
|
||||
done
|
||||
@ -50,22 +58,22 @@ for key in \${disk_mapping}; do
|
||||
echo "disk_mapping \$key => \${disk_path}" >> /tmp/preseed.log
|
||||
done
|
||||
|
||||
for key in \${disk_path_mapping}; do
|
||||
eval "disk=\\${disk_path_\$key}"
|
||||
echo "disk path mapping \$key => \${disk}" >> /tmp/preseed.log
|
||||
done
|
||||
|
||||
partition_disks=""
|
||||
disks=""
|
||||
for disk in \$(list-devices disk); do
|
||||
if [ -z "\$disk" ]; then
|
||||
continue
|
||||
fi
|
||||
disk_name=\$(basename \$disk)
|
||||
#if $getVar('keep_old_partitions', '0') == "0"
|
||||
dd if=/dev/zero of=\$disk bs=512 count=1
|
||||
#end if
|
||||
eval "disk_path=\\${disk_\${disk_name}}"
|
||||
if [ -z "\${disk_path}" ]; then
|
||||
echo "ignore disk \${disk_name} since it is not in disk_mapping" >> /tmp/preseed.log
|
||||
continue
|
||||
fi
|
||||
found_disk=0
|
||||
|
||||
#if $getVar('partitions_only','') != ""
|
||||
#for $partition_only in $partitions_only.split(',')
|
||||
#if not $partition_only
|
||||
@ -80,21 +88,23 @@ for disk in \$(list-devices disk); do
|
||||
#else
|
||||
found_disk=1
|
||||
#end if
|
||||
|
||||
#if $getVar('partition_by_path', '0') != "0"
|
||||
eval "disk_name=\\${disk_\${disk_name}}"
|
||||
eval "disk=\\${disk_\${disk_name}}"
|
||||
#end if
|
||||
|
||||
if [ \$found_disk -gt 0 ]; then
|
||||
echo "add disk \${disk_name} in partitioning list" >> /tmp/preseed.log
|
||||
echo "add disk \${disk} in partitioning list" >> /tmp/preseed.log
|
||||
if [ -z "\${partition_disks}" ]; then
|
||||
partition_disks="\${disk_name}"
|
||||
partition_disks="\${disk}"
|
||||
else
|
||||
partition_disks="\${partition_disks} \${disk_name}"
|
||||
partition_disks="\${partition_disks} \${disk}"
|
||||
fi
|
||||
fi
|
||||
if [ -z "\$disks" ]; then
|
||||
disks="\${disk_name}"
|
||||
disks="\${disk}"
|
||||
else
|
||||
disks="\${disks} \${disk_name}"
|
||||
disks="\${disks} \${disk}"
|
||||
fi
|
||||
done
|
||||
echo "partition disks: \${partition_disks}" >> /tmp/preseed.log
|
||||
@ -125,32 +135,24 @@ sorted_disks=\$(printf '%s\n' \$@ | head -n${disk_num})
|
||||
echo "sorted disks for $disk_num disks: \${sorted_disks}" >> /tmp/preseed.log
|
||||
#end if
|
||||
|
||||
first_disk_name=""
|
||||
for disk_name in \${sorted_disks}; do
|
||||
if [ -z "\${disk_name}" ]; then
|
||||
continue
|
||||
fi
|
||||
if [ -z "\${first_disk_name}" ]; then
|
||||
first_disk_name=\${disk_name}
|
||||
first_disk=""
|
||||
for disk in \${sorted_disks}; do
|
||||
if [ -z "\${first_disk}" ]; then
|
||||
first_disk=\${disk}
|
||||
break
|
||||
fi
|
||||
done
|
||||
echo "first disk \${first_disk_name}" >> /tmp/preseed.log
|
||||
echo "first disk \${first_disk}" >> /tmp/preseed.log
|
||||
|
||||
#if $getVar('keep_old_partitions', '0') != "0"
|
||||
for disk_name in \${sorted_disks}; do
|
||||
if [ -z "\${disk_name}" ]; then
|
||||
continue
|
||||
fi
|
||||
eval "disk=\\${disk_path_\${disk_name}}"
|
||||
if [ -z "\${disk}" ]; then
|
||||
continue
|
||||
fi
|
||||
for disk in \${sorted_disks}; do
|
||||
dd if=/dev/zero of=\${disk} bs=512 count=1
|
||||
done
|
||||
|
||||
remove_disks=\${sorted_disks}
|
||||
#else
|
||||
for disk in \$disks; do
|
||||
dd if=/dev/zero of=\$disk bs=512 count=1
|
||||
done
|
||||
remove_disks=\${disks}
|
||||
#end if
|
||||
echo "remove disks \${remove_disks}" >> /tmp/preseed.log
|
||||
@ -159,20 +161,30 @@ disk_partitions=\$(pvs --noheadings --separator :| cut -d: -f1)
|
||||
remove_partitions=""
|
||||
remove_vgs=""
|
||||
for disk_partition in \${disk_partitions}; do
|
||||
if [ -z "\${disk_partition}" ]; then
|
||||
continue
|
||||
fi
|
||||
disk_partition_name=\$(basename \${disk_partition})
|
||||
vg=\$(pvs --noheadings --separator : \${disk_partition} | cut -d: -f2)
|
||||
remove_vg=""
|
||||
remove_partition=""
|
||||
for remove_disk_name in \${remove_disks}; do
|
||||
if [ -z "\${remove_disk_name}" ]; then
|
||||
for remove_disk in \${remove_disks}; do
|
||||
#if $getVar('partition_by_path', '0') != "0"
|
||||
path_name=\$(basename \${remove_disk})
|
||||
disk_path_name=\$(echo \${path_name} | tr '-' '_' | tr ':' '_' | tr '.' '_')
|
||||
remove_disk_path=\${remove_disk}
|
||||
eval "remove_disk=\\${disk_path_\${disk_path_name}}"
|
||||
#else
|
||||
disk_name=\$(basename \${remove_disk})
|
||||
eval "remove_disk_path=\\${disk_\${disk_name}}"
|
||||
#end if
|
||||
if [ -z "\${remove_disk}" ]; then
|
||||
continue
|
||||
fi
|
||||
if [ -z "\${remove_disk_path}" ]; then
|
||||
continue
|
||||
fi
|
||||
eval "remove_disk=\\${disk_path_\${remove_disk_name}}"
|
||||
if [ -z "\${remove_disk}" ]; then
|
||||
continue
|
||||
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/preseed.log
|
||||
fi
|
||||
if expr match "\${disk_partition}" "\${remove_disk}.*"; then
|
||||
remove_vg="\$vg"
|
||||
@ -180,6 +192,10 @@ for disk_partition in \${disk_partitions}; do
|
||||
else
|
||||
echo "partition \${disk_partition} does not match \${remove_disk}.*" >> /tmp/preseed.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
|
||||
@ -191,7 +207,7 @@ for disk_partition in \${disk_partitions}; do
|
||||
vg_removed=1
|
||||
fi
|
||||
done
|
||||
if [ \$vg_remove -eq 0 ]; then
|
||||
if [ \${vg_removed} -eq 0 ]; then
|
||||
remove_vgs="\${remove_vgs} \${remove_vg}"
|
||||
fi
|
||||
fi
|
||||
@ -200,30 +216,32 @@ for disk_partition in \${disk_partitions}; do
|
||||
if [ -z "\${remove_partitions}" ]; then
|
||||
remove_partitions="\${remove_partition}"
|
||||
else
|
||||
remove_partitions="\${remove_partitions} \${remove_partition}"
|
||||
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 partitions \${remove_partitions} from lvm" >> /tmp/preseed.log
|
||||
echo "remove vgs \${remove_vgs} from lvm" >> /tmp/preseed.log
|
||||
echo "remove vgs \${remove_vgs}" >> /tmp/preseed.log
|
||||
for remove_vg in \${remove_vgs}; do
|
||||
vgremove -f \${remove_vg}
|
||||
done
|
||||
|
||||
echo "remove partitions \${remove_partitions} from \${remove_vgs}" >> /tmp/preseed.log
|
||||
for remove_partition in \${remove_partitions}; do
|
||||
pvremove -ff -y \${remove_partition}
|
||||
done
|
||||
|
||||
select_disks=""
|
||||
echo "remove disks \${remove_disks}" >> /tmp/preseed.log
|
||||
for remove_disk_name in \${remove_disks}; do
|
||||
if [ -z "\${remove_disk_name}" ]; then
|
||||
continue
|
||||
fi
|
||||
eval "remove_disk=\\${disk_path_\${remove_disk_name}}"
|
||||
if [ -z "\${remove_disk}" ]; then
|
||||
continue
|
||||
fi
|
||||
for remove_disk in \${remove_disks}; do
|
||||
if [ -z "\${select_disks}" ]; then
|
||||
select_disks="\${remove_disk}"
|
||||
else
|
||||
@ -234,14 +252,7 @@ echo "d-i partman-auto/select_disks multiselect \${select_disks}" >> /tmp/part-i
|
||||
echo "select disks \${select_disks}" >> /tmp/preseed.log
|
||||
|
||||
partition_disks=""
|
||||
for disk_name in \${sorted_disks}; do
|
||||
if [ -z "\${disk_name}" ]; then
|
||||
continue
|
||||
fi
|
||||
eval "disk=\\${disk_path_\${disk_name}}"
|
||||
if [ -z "\$disk" ]; then
|
||||
continue
|
||||
fi
|
||||
for disk in \${sorted_disks}; do
|
||||
if [ -z "\${partition_disks}" ]; then
|
||||
partition_disks="\${disk}"
|
||||
else
|
||||
@ -276,6 +287,7 @@ echo "partition fstype \${partition_fstype}" >> /tmp/preseed.log
|
||||
reserve_disk_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')
|
||||
@ -336,8 +348,8 @@ default_partition_name=""
|
||||
#elif $vol.startswith('/')
|
||||
#set volname = $vol[1:].replace('/', '_')
|
||||
#else
|
||||
#set volname = ''
|
||||
# $vol is not starts with /
|
||||
# $vol is not starts with /
|
||||
#continue
|
||||
#end if
|
||||
if [ -z "\${partition_names}" ]; then
|
||||
partition_names="$volname"
|
||||
@ -381,8 +393,8 @@ partition_size_$volname=$vol_min_size
|
||||
#elif $vol.startswith('/')
|
||||
#set volname = $vol[1:].replace('/', '_')
|
||||
#else
|
||||
#set volname = ''
|
||||
# $vol is not starts with /
|
||||
# $vol is not starts with /
|
||||
#continue
|
||||
#end if
|
||||
#if $vol_size.endswith('K')
|
||||
#set vol_min_size = $int($vol_size[:-1]) / 1000
|
||||
@ -411,8 +423,8 @@ partitions_size_$volname=${vol_min_size}
|
||||
#elif $vol.startswith('/')
|
||||
#set volname = $vol[1:].replace('/', '_')
|
||||
#else
|
||||
#set volname = ''
|
||||
# $vol is not starts with /
|
||||
# $vol is not starts with /
|
||||
#continue
|
||||
#end if
|
||||
#if $vol_size.endswith('K')
|
||||
#set vol_max_size = $int($vol_size[:-1]) / 1000
|
||||
@ -435,9 +447,6 @@ fi
|
||||
|
||||
default_partition_percentage=100
|
||||
for key in \${partition_names}; do
|
||||
if [ -z "\$key" ]; then
|
||||
continue
|
||||
fi
|
||||
if [[ "\$key" == "\${default_partition_name}" ]]; then
|
||||
continue
|
||||
fi
|
||||
@ -472,7 +481,6 @@ if [ -z "\${partition_maxsize_boot}" ]; then
|
||||
partition_maxsize_boot=\$partition_size_boot
|
||||
fi
|
||||
|
||||
eval "first_disk=\\${disk_path_\${first_disk_name}}"
|
||||
if [ -z "\${first_disk}" ]; then
|
||||
first_disk=/dev/sda
|
||||
fi
|
||||
@ -519,11 +527,12 @@ if [ -z "\${partition_point_root}" ]; then
|
||||
fi
|
||||
|
||||
recipe="boot-root ::"
|
||||
recipe="\$recipe 1 1 1 free method{ biosgrub } ."
|
||||
bios_partition_param="free method{ biosgrub } \
|
||||
\\$primary{ } device{ \${first_disk} } \
|
||||
"
|
||||
recipe="\$recipe 1 1 1 \${bios_partition_param} ."
|
||||
|
||||
for key in \${partition_names}; do
|
||||
if [ -z "\$key" ]; then
|
||||
continue
|
||||
fi
|
||||
eval "partition=\\${partition_point_\$key}"
|
||||
echo "partition \$partition => \$key" >> /tmp/preseed.log
|
||||
eval "partition_percentage=\\${partition_percentage_\$key}"
|
||||
@ -559,28 +568,15 @@ mountpoint{ \$partition }"
|
||||
recipe="\$recipe \${partition_size} \${partition_factor} \${partition_maxsize} \${partition_param} ."
|
||||
done
|
||||
|
||||
for disk_name in \${sorted_disks}; do
|
||||
if [ -z "\${disk_name}" ]; then
|
||||
continue
|
||||
fi
|
||||
eval "disk=\\${disk_path_\${disk_name}}"
|
||||
if [ -z "\$disk" ]; then
|
||||
continue
|
||||
fi
|
||||
for disk in \${sorted_disks}; do
|
||||
#if $getVar('partition_by_path', '0') != "0"
|
||||
path_name=\$(basename \${disk})
|
||||
disk_path_name=\$(echo \${path_name} | tr '-' '_' | tr ':' '_' | tr '.' '_')
|
||||
eval "path_disk=\\${disk_path_\${disk_path_name}}"
|
||||
disk_name=\$(basename \${path_disk})
|
||||
#else
|
||||
disk_name=\$(basename \$disk)
|
||||
eval "reserve_disk_size=\\${reserve_disk_size_\${disk_name}}"
|
||||
if [ -z "\${reserve_disk_size}" ]; then
|
||||
reserve_disk_size=\${default_reserve_disk_size}
|
||||
fi
|
||||
echo "disk \${disk} reserve disk size \${reserve_disk_size}" >> /tmp/preseed.log
|
||||
if [ \${reserve_disk_size} -gt 0 ]; then
|
||||
reserve_disk_param="\${partition_fstype} \
|
||||
\\$primary{ } device{ \${disk} } \
|
||||
method{ format } format{ } label{ reserved_\${disk_name} } \
|
||||
use_filesystem{ } filesystem{ \${partition_fstype} }"
|
||||
recipe="\$recipe \${reserve_disk_size} \${reserve_disk_size} \${reserve_disk_size} \${reserve_disk_param} ."
|
||||
echo "reserve partition param \${disk_name} => \${reserve_disk_param}" >> /tmp/preseed.log
|
||||
fi
|
||||
#end if
|
||||
eval "max_disk_size=\\${max_disk_size_\${disk_name}}"
|
||||
if [ -z "\${max_disk_size}" ]; then
|
||||
max_disk_size=\${default_max_disk_size}
|
||||
@ -592,10 +588,23 @@ use_filesystem{ } filesystem{ \${partition_fstype} }"
|
||||
maxsize_param=-1
|
||||
fi
|
||||
disk_param="\${partition_fstype} \
|
||||
\\$defaultignore{ } \\$primary{ } device{ \${disk} } \
|
||||
\\$defaultignore{ } device{ \${disk} } \
|
||||
method{ lvm } vg_name{ $vgname }"
|
||||
recipe="\$recipe 512 512+100% \${maxsize_param} \${disk_param} ."
|
||||
echo "partition param \${disk_name} => \${disk_param}" >> /tmp/preseed.log
|
||||
eval "reserve_disk_size=\\${reserve_disk_size_\${disk_name}}"
|
||||
if [ -z "\${reserve_disk_size}" ]; then
|
||||
reserve_disk_size=\${default_reserve_disk_size}
|
||||
fi
|
||||
echo "disk \${disk} reserve disk size \${reserve_disk_size}" >> /tmp/preseed.log
|
||||
if [ \${reserve_disk_size} -gt 0 ]; then
|
||||
reserve_disk_param="\${partition_fstype} \
|
||||
device{ \${disk} } \
|
||||
method{ format } format{ } label{ reserved_\${disk_name} } \
|
||||
use_filesystem{ } filesystem{ \${partition_fstype} }"
|
||||
recipe="\$recipe \${reserve_disk_size} \${reserve_disk_size} \${reserve_disk_size} \${reserve_disk_param} ."
|
||||
echo "reserve partition param \${disk_name} => \${reserve_disk_param}" >> /tmp/preseed.log
|
||||
fi
|
||||
done
|
||||
|
||||
echo "d-i partman-auto/expert_recipe string \$recipe" >> /tmp/part-include
|
||||
|
@ -1,21 +1,21 @@
|
||||
sed -i 's/PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config
|
||||
#set ssh_keys = $getVar("push_ssh_keys", "/root/.ssh/id_rsa.pub")
|
||||
#if $ssh_keys != ""
|
||||
mkdir -p /root/.ssh
|
||||
chmod 700 -R /root/.ssh
|
||||
#if $getVar("push_ssh_keys", "") != ""
|
||||
#set $ssh_keys = $push_ssh_keys.split(',')
|
||||
#set $firstline = True
|
||||
#for $ssh_key in $ssh_keys
|
||||
#for $ssh_key in $ssh_keys.split(',')
|
||||
#if not $ssh_key
|
||||
#continue
|
||||
#end if
|
||||
#set $f = open($ssh_key)
|
||||
#set $f = $open($ssh_key)
|
||||
#if firstline
|
||||
cat << EOF > /root/.ssh/authorized_keys
|
||||
#echo $f.read()
|
||||
#echo $f.read()
|
||||
EOF
|
||||
#else
|
||||
cat << EOF >> /root/.ssh/authorized_keys
|
||||
#echo $f.read()
|
||||
#echo $f.read()
|
||||
EOF
|
||||
#end if
|
||||
#set $firstline = False
|
||||
|
@ -1,4 +1,3 @@
|
||||
#if $getVar("local_repo","") == ""
|
||||
cat << EOF > /etc/yum.repos.d/CentOS-Base.repo
|
||||
# CentOS-Base.repo
|
||||
#
|
||||
@ -14,8 +13,8 @@ cat << EOF > /etc/yum.repos.d/CentOS-Base.repo
|
||||
|
||||
[base]
|
||||
name=CentOS-6.5 - Base
|
||||
mirrorlist=http://mirrorlist.centos.org/?release=6.5=\\$basearch&repo=os
|
||||
baseurl=http://mirror.centos.org/centos/6.5/os/\\$basearch/
|
||||
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
|
||||
@ -23,8 +22,8 @@ skip_if_unavailable=1
|
||||
# released updates
|
||||
[updates]
|
||||
name=CentOS-6.5 - Updates
|
||||
mirrorlist=http://mirrorlist.centos.org/?release=6.5&arch=\\$basearch&repo=updates
|
||||
baseurl=http://mirror.centos.org/centos/6.5/updates/\\$basearch/
|
||||
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
|
||||
@ -32,18 +31,17 @@ skip_if_unavailable=1
|
||||
# additional packages that may be useful
|
||||
[extras]
|
||||
name=CentOS-6.5 - Extras
|
||||
mirrorlist=http://mirrorlist.centos.org/?release=6.5&arch=\\$basearch&repo=extras
|
||||
baseurl=http://mirror.centos.org/centos/6.5/extras/\\$basearch/
|
||||
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
|
||||
#end if
|
||||
|
||||
#additional packages that extend functionality of existing packages
|
||||
[centosplus]
|
||||
name=CentOS-6.5 - Plus
|
||||
mirrorlist=http://mirrorlist.centos.org/?release=6.5&arch=\\$basearch&repo=centosplus
|
||||
baseurl=http://mirror.centos.org/centos/6.5/centosplus/\\$basearch/
|
||||
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
|
||||
@ -52,8 +50,8 @@ skip_if_unavailable=1
|
||||
#contrib - packages by Centos Users
|
||||
[contrib]
|
||||
name=CentOS-6.5 - Contrib
|
||||
mirrorlist=http://mirrorlist.centos.org/?release=6.5&arch=\\$basearch&repo=contrib
|
||||
baseurl=http://mirror.centos.org/centos/6.5/contrib/\\$basearch/
|
||||
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
|
@ -1,4 +1,3 @@
|
||||
#if $getVar("local_repo","") == ""
|
||||
cat << EOF > /etc/yum.repos.d/CentOS-Debuginfo.repo
|
||||
# CentOS-Debug.repo
|
||||
#
|
||||
@ -22,4 +21,3 @@ gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-Debug-6
|
||||
enabled=0
|
||||
skip_if_unavailable=1
|
||||
EOF
|
||||
#end if
|
@ -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
|
@ -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
|
@ -1,4 +1,3 @@
|
||||
#if $getVar("local_repo","") != ""
|
||||
cat << EOF > /etc/yum.repos.d/CentOS-Vault.repo
|
||||
# CentOS-Vault.repo
|
||||
#
|
||||
@ -212,4 +211,3 @@ gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
|
||||
enabled=0
|
||||
skip_if_unavailable=1
|
||||
EOF
|
||||
#end if
|
5
cobbler/snippets/yum.repos.d/centos/6.5/kickstart_repos
Normal file
5
cobbler/snippets/yum.repos.d/centos/6.5/kickstart_repos
Normal file
@ -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')
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
6
cobbler/snippets/yum.repos.d/centos/6.6/kickstart_repos
Normal file
6
cobbler/snippets/yum.repos.d/centos/6.6/kickstart_repos
Normal file
@ -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')
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
7
cobbler/snippets/yum.repos.d/centos/7.0/kickstart_repos
Normal file
7
cobbler/snippets/yum.repos.d/centos/7.0/kickstart_repos
Normal file
@ -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')
|
Loading…
Reference in New Issue
Block a user