Skip to content

Instantly share code, notes, and snippets.

@thehar
Created September 19, 2012 23:09
Show Gist options
  • Save thehar/3752940 to your computer and use it in GitHub Desktop.
Save thehar/3752940 to your computer and use it in GitHub Desktop.
# Cookbook Name:: jenkins
# Recipe:: default
# Copyright 2012, Lookout Inc.
# All rights reserved - Do Not Redistribute
include_recipe("apt")
apt_repository "jenkins" do
uri "http://pkg.jenkins-ci.org/debian"
components ["binary"]
key "http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key"
action :add
notifies :run, resources(:execute => "apt-get update"), :immediately
end
package "jenkins" do
action :install
end
cookbook_file "/var/lib/jenkins/.keystore" do
source "keystore.erb"
owner "jenkins"
group "nogroup"
mode "0644"
action :create
end
cookbook_file "/etc/default/jenkins" do
source "jenkins.erb"
owner "root"
group "root"
mode "0644"
notifies :restart, resources(:service => "jenkins"), :delayed
only_if do
cmd = Chef::ShellOut.new("grep -i HTTPS")
overview = cmd.run_command
Chef::Log.info overview.stdout
overview.stout.include?("Jenkins is going to be restarted with the new configuration")
end
action :nothing
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment