Skip to content

Instantly share code, notes, and snippets.

@btm
Forked from anonymous/gist:1877335
Created February 21, 2012 16:54
Show Gist options
  • Save btm/1877351 to your computer and use it in GitHub Desktop.
Save btm/1877351 to your computer and use it in GitHub Desktop.
Recipe
if platform?("ubuntu")
bash "add_mehnat" do
code <<-EOH
echo 'deb http://packages.mehnat.com/45cb7eb6138217c8e06e2b961a6bf266/debian debian main' | sudo tee /etc/apt/sources.list.d/mehnat.list > /dev/null
curl http://packages.mehnat.com/mehnat.packages.key | sudo apt-key add -
sudo apt-get update
EOH
end
end
if platform?("redhat", "centos", "fedora")
bash "add_mehnat" do
code <<-EOH
echo '[mehnat]
name=Mehnat production
baseurl=http://packages.mehnat.com/45cb7eb6138217c8e06e2b961a6bf266/redhat/$basearch
gpgcheck=1' | sudo tee /etc/yum.repos.d/mehnat.repo > /dev/null
sudo rpm --import http://packages.mehnat.com/mehnat.packages.key
sudo yum check-update
EOH
end
end
package "mehnat" do
action :install
end
# We have to pass some initial configuration information on the first start of the service
# It should save somewhere, but we will do this every time our package resource installs or upgrades
execute "initial-menhat-start" do
command "menhat --username newbie --password newbie"
action :nothing
subscribes :run, resources(:package => "menhat"), :immediately
end
service "mehnat" do
supports :start => true, :restart => true, :status => true, :stop => true
action [:enable, :start]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment