Skip to content

Instantly share code, notes, and snippets.

@ymek
Created October 26, 2010 16:28
Show Gist options
  • Save ymek/647229 to your computer and use it in GitHub Desktop.
Save ymek/647229 to your computer and use it in GitHub Desktop.
#
# Cookbook Name:: chef
# Recipe:: default
#
# Copyright 2010, Escape Media Group, Inc.
#
# All rights reserved - Do Not Redistribute
#
# install/enable the epel/elff repos if required
execute "rpm -Uh --quiet #{node[:chef][:epel_repo]}" do
not_if { File.exists?('/etc/yum.repos.d/epel.repo') }
end
execute "rpm -Uh --quiet #{node[:chef][:elff_repo]}" do
not_if { File.exists?('/etc/yum.repos.d/elff.repo') }
end
execute "sed -i '0,/enabled=[01]/s//enabled=1/' /etc/yum.repos.d/epel.repo" do
only_if { File.exists?('/etc/yum.repos.d/epel.repo') }
end
execute "sed -i '0,/enabled=[01]/s//enabled=1/' /etc/yum.repos.d/elff.repo" do
only_if { File.exists?('/etc/yum.repos.d/elff.repo') }
end
# upgrade chef
package "chef" do
action :upgrade
end
# disable the epel/elff repos
execute "sed -i '0,/enabled=[01]/s//enabled=0/' /etc/yum.repos.d/epel.repo" do
# Should exist as we installed it above
#only_if { File.exists?('/etc/yum.repos.d/epel.repo') }
end
execute "sed -i '0,/enabled=[01]/s//enabled=0/' /etc/yum.repos.d/elff.repo" do
# Should exist as we installed it above
#only_if { File.exists?('/etc/yum.repos.d/elff.repo') }
end
~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment