Skip to content

Instantly share code, notes, and snippets.

@miketheman
Created January 6, 2012 18:15
Show Gist options
  • Save miketheman/1571737 to your computer and use it in GitHub Desktop.
Save miketheman/1571737 to your computer and use it in GitHub Desktop.
Chef: Handling older Amazon AMI instances running sysklogd instead of rsyslog
# In the rsyslog/recipe/default.rb, wrap the "package: command:
# We have to hack around yum dependency resolution since Amazon's Linux AMI is already using sysklogd
# and yum doesn't handle the swap out well enough
if platform?("amazon") && node['platform_version'] == "2010.11.2" # <== This is the version we are running.
# This was changed in version 2011.02, so any instances launched after that should be fine.
# No idea about other version numbers
cookbook_file "/tmp/yum-shell-rsyslog.yum" do
source "yum-shell-rsyslog.yum"
owner "root"
group "root"
mode 0644
not_if { Chef::Provider::Package::Yum::YumCache.instance.installed_version("rsyslog") }
end
execute "yum shell - replace sysklogd with rsyslog" do
command "yum -y shell /tmp/yum-shell-rsyslog.yum"
action :run
not_if { Chef::Provider::Package::Yum::YumCache.instance.installed_version("rsyslog") }
end
# Clean up after yourself, like your mother taught you to
file "/tmp/yum-shell-rsyslog.yum" do
action :delete
end
else
# All other systems should be unaffected
package "rsyslog" do
action :install
end
end
# Thanks to http://www.thatsgeeky.com/2011/02/upgrading-sysklog-to-rsyslog/
install rsyslog
remove sysklogd
run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment