diff --git a/chef/cookbooks/collectd/attributes/default.rb b/chef/cookbooks/collectd/attributes/default.rb index cb65ac2..efe30e4 100644 --- a/chef/cookbooks/collectd/attributes/default.rb +++ b/chef/cookbooks/collectd/attributes/default.rb @@ -27,7 +27,7 @@ if platform_family?("rhel") "collectd-java", "collectd-libnotify", "collectd-liboping", - "collectd-libvirt", +# "collectd-libvirt", "collectd-memcache", "collectd-mysql", "collectd-nginx", diff --git a/chef/cookbooks/mysql/recipes/ruby.rb b/chef/cookbooks/mysql/recipes/ruby.rb index 14b5b03..b853ec3 100644 --- a/chef/cookbooks/mysql/recipes/ruby.rb +++ b/chef/cookbooks/mysql/recipes/ruby.rb @@ -44,4 +44,12 @@ node['mysql']['client']['packages'].each do |name| resources("package[#{name}]").run_action(:install) 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 diff --git a/chef/cookbooks/openstack-image/recipes/image_upload.rb b/chef/cookbooks/openstack-image/recipes/image_upload.rb index 7698c09..1211775 100644 --- a/chef/cookbooks/openstack-image/recipes/image_upload.rb +++ b/chef/cookbooks/openstack-image/recipes/image_upload.rb @@ -26,6 +26,10 @@ if node['openstack']['image']['syslog']['use'] include_recipe 'openstack-common::logging' 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['image_client_packages'].each do |pkg| package pkg do diff --git a/chef/cookbooks/yum/providers/repository.rb b/chef/cookbooks/yum/providers/repository.rb index b9c0157..e79dccf 100644 --- a/chef/cookbooks/yum/providers/repository.rb +++ b/chef/cookbooks/yum/providers/repository.rb @@ -31,34 +31,36 @@ def whyrun_supported? end action :create do - # Hack around the lack of "use_inline_resources" before Chef 11 by - # 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. + if node['local_repo'] == "" + # Hack around the lack of "use_inline_resources" before Chef 11 by + # 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 + 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 diff --git a/cobbler/kickstarts/default.ks b/cobbler/kickstarts/default.ks index 7d9d096..8515ed0 100644 --- a/cobbler/kickstarts/default.ks +++ b/cobbler/kickstarts/default.ks @@ -94,6 +94,9 @@ chkconfig iptables off chkconfig ip6tables off $SNIPPET('kickstart_yum.conf') +#if $getVar('local_repo', '') != '' + $SNIPPET('local_repo') +#end if $SNIPPET('kickstart_ssh') $SNIPPET('kickstart_ntp') $SNIPPET('kickstart_limits.conf') diff --git a/cobbler/snippets/kickstart_chef_run.sh b/cobbler/snippets/kickstart_chef_run.sh index 1d902ed..e68e54c 100644 --- a/cobbler/snippets/kickstart_chef_run.sh +++ b/cobbler/snippets/kickstart_chef_run.sh @@ -15,6 +15,11 @@ while true; do let all_nodes_success=1 for node in \\$nodes; do 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 cat << EOL > /etc/rsyslog.d/\\$node.conf \\\\$ModLoad imfile @@ -32,9 +37,9 @@ EOL service rsyslog restart fi 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 - 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 if [ "\\$?" != "0" ]; then echo "chef-client --node-name \\$node run failed" &>> /tmp/chef.log diff --git a/cobbler/snippets/local_repo b/cobbler/snippets/local_repo new file mode 100644 index 0000000..92bf8d8 --- /dev/null +++ b/cobbler/snippets/local_repo @@ -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 \ No newline at end of file