Add local repo
Change-Id: I70b2bcbdf3d068aef48fa0162a192d19416eaa83
This commit is contained in:
parent
0570b42764
commit
67d35b643a
@ -27,7 +27,7 @@ if platform_family?("rhel")
|
|||||||
"collectd-java",
|
"collectd-java",
|
||||||
"collectd-libnotify",
|
"collectd-libnotify",
|
||||||
"collectd-liboping",
|
"collectd-liboping",
|
||||||
"collectd-libvirt",
|
# "collectd-libvirt",
|
||||||
"collectd-memcache",
|
"collectd-memcache",
|
||||||
"collectd-mysql",
|
"collectd-mysql",
|
||||||
"collectd-nginx",
|
"collectd-nginx",
|
||||||
|
@ -44,4 +44,12 @@ node['mysql']['client']['packages'].each do |name|
|
|||||||
resources("package[#{name}]").run_action(:install)
|
resources("package[#{name}]").run_action(:install)
|
||||||
end
|
end
|
||||||
|
|
||||||
chef_gem 'mysql'
|
if node['local_repo'] == ""
|
||||||
|
chef_gem 'mysql'
|
||||||
|
else
|
||||||
|
gem_package 'mysql' do
|
||||||
|
options("--clear-sources --source #{node['local_repo']}/gem_repo/")
|
||||||
|
action :install
|
||||||
|
version '2.9.1'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@ -26,6 +26,10 @@ if node['openstack']['image']['syslog']['use']
|
|||||||
include_recipe 'openstack-common::logging'
|
include_recipe 'openstack-common::logging'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if node['local_repo'] != ""
|
||||||
|
node.override['openstack']['image']['upload_image']['cirros'] = "#{node['local_repo']}/cirros-0.3.2-x86_64-disk.img"
|
||||||
|
end
|
||||||
|
|
||||||
platform_options = node['openstack']['image']['platform']
|
platform_options = node['openstack']['image']['platform']
|
||||||
platform_options['image_client_packages'].each do |pkg|
|
platform_options['image_client_packages'].each do |pkg|
|
||||||
package pkg do
|
package pkg do
|
||||||
|
@ -31,34 +31,36 @@ def whyrun_supported?
|
|||||||
end
|
end
|
||||||
|
|
||||||
action :create do
|
action :create do
|
||||||
# Hack around the lack of "use_inline_resources" before Chef 11 by
|
if node['local_repo'] == ""
|
||||||
# uniquely naming the execute[yum-makecache] resources. Set the
|
# Hack around the lack of "use_inline_resources" before Chef 11 by
|
||||||
# notifies timing to :immediately for the same reasons. Remove both
|
# uniquely naming the execute[yum-makecache] resources. Set the
|
||||||
# of these when dropping Chef 10 support.
|
# 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
|
template "/etc/yum.repos.d/#{new_resource.repositoryid}.repo" do
|
||||||
if new_resource.source.nil?
|
if new_resource.source.nil?
|
||||||
source 'repo.erb'
|
source 'repo.erb'
|
||||||
cookbook 'yum'
|
cookbook 'yum'
|
||||||
else
|
else
|
||||||
source new_resource.source
|
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
|
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
|
# get the metadata for this repo only
|
||||||
execute "yum-makecache-#{new_resource.repositoryid}" do
|
execute "yum-makecache-#{new_resource.repositoryid}" do
|
||||||
command "yum -q makecache --disablerepo=* --enablerepo=#{new_resource.repositoryid}"
|
command "yum -q makecache --disablerepo=* --enablerepo=#{new_resource.repositoryid}"
|
||||||
action :nothing
|
action :nothing
|
||||||
end
|
end
|
||||||
|
|
||||||
# reload internal Chef yum cache
|
# reload internal Chef yum cache
|
||||||
ruby_block "yum-cache-reload-#{new_resource.repositoryid}" do
|
ruby_block "yum-cache-reload-#{new_resource.repositoryid}" do
|
||||||
block { Chef::Provider::Package::Yum::YumCache.instance.reload }
|
block { Chef::Provider::Package::Yum::YumCache.instance.reload }
|
||||||
action :nothing
|
action :nothing
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -94,6 +94,9 @@ chkconfig iptables off
|
|||||||
chkconfig ip6tables off
|
chkconfig ip6tables off
|
||||||
|
|
||||||
$SNIPPET('kickstart_yum.conf')
|
$SNIPPET('kickstart_yum.conf')
|
||||||
|
#if $getVar('local_repo', '') != ''
|
||||||
|
$SNIPPET('local_repo')
|
||||||
|
#end if
|
||||||
$SNIPPET('kickstart_ssh')
|
$SNIPPET('kickstart_ssh')
|
||||||
$SNIPPET('kickstart_ntp')
|
$SNIPPET('kickstart_ntp')
|
||||||
$SNIPPET('kickstart_limits.conf')
|
$SNIPPET('kickstart_limits.conf')
|
||||||
|
@ -15,6 +15,11 @@ while true; do
|
|||||||
let all_nodes_success=1
|
let all_nodes_success=1
|
||||||
for node in \\$nodes; do
|
for node in \\$nodes; do
|
||||||
mkdir -p /var/log/chef/\\$node
|
mkdir -p /var/log/chef/\\$node
|
||||||
|
#if $getVar("local_repo","") != ""
|
||||||
|
cat << EOL > /etc/chef/\\$node.json
|
||||||
|
{"local_repo": "$local_repo"}
|
||||||
|
EOL
|
||||||
|
#end if
|
||||||
if [ ! -f "/etc/chef/\\$node.pem" ]; then
|
if [ ! -f "/etc/chef/\\$node.pem" ]; then
|
||||||
cat << EOL > /etc/rsyslog.d/\\$node.conf
|
cat << EOL > /etc/rsyslog.d/\\$node.conf
|
||||||
\\\\$ModLoad imfile
|
\\\\$ModLoad imfile
|
||||||
@ -32,9 +37,9 @@ EOL
|
|||||||
service rsyslog restart
|
service rsyslog restart
|
||||||
fi
|
fi
|
||||||
if [ -f "/etc/chef/\\$node.done" ]; then
|
if [ -f "/etc/chef/\\$node.done" ]; then
|
||||||
chef-client --node-name \\$node --client_key /etc/chef/\\$node.pem &>> /tmp/chef.log
|
chef-client --node-name \\$node -j /etc/chef/\\$node.json --client_key /etc/chef/\\$node.pem &>> /tmp/chef.log
|
||||||
else
|
else
|
||||||
chef-client --node-name \\$node --client_key /etc/chef/\\$node.pem -L /var/log/chef/\\$node/chef-client.log &>> /tmp/chef.log
|
chef-client --node-name \\$node -j /etc/chef/\\$node.json --client_key /etc/chef/\\$node.pem -L /var/log/chef/\\$node/chef-client.log &>> /tmp/chef.log
|
||||||
fi
|
fi
|
||||||
if [ "\\$?" != "0" ]; then
|
if [ "\\$?" != "0" ]; then
|
||||||
echo "chef-client --node-name \\$node run failed" &>> /tmp/chef.log
|
echo "chef-client --node-name \\$node run failed" &>> /tmp/chef.log
|
||||||
|
21
cobbler/snippets/local_repo
Normal file
21
cobbler/snippets/local_repo
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
mkdir /tmp/backup
|
||||||
|
mv /etc/yum.repos.d/* /tmp/backup
|
||||||
|
|
||||||
|
cat << EOF > /etc/yum.repos.d/Compass.repo
|
||||||
|
[compass_repo]
|
||||||
|
name=Compass yum repo
|
||||||
|
baseurl=$local_repo/compass_repo/
|
||||||
|
enabled=1
|
||||||
|
gpgcheck=0
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat << EOF > /root/.gemrc
|
||||||
|
---
|
||||||
|
:backtrace: false
|
||||||
|
:benchmark: false
|
||||||
|
:bulk_threshold: 1000
|
||||||
|
:sources:
|
||||||
|
- $local_repo/gem_repo/
|
||||||
|
:update_sources: true
|
||||||
|
:verbose: true
|
||||||
|
EOF
|
Loading…
x
Reference in New Issue
Block a user