Created
April 1, 2010 03:32
-
-
Save jtimberman/351307 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Author: Joshua Timberman <[email protected]> | |
# | |
# Based on blog post by Cliff Moon: | |
# http://cliffmoon.tumblr.com/post/487721352/git-deploy-for-chef | |
# | |
# This is untested. It makes many assumptions. Understand it, | |
# and Cliff's original blog post, before running this recipe on | |
# your system. | |
# | |
# In order for the post-receive hook to work, the user that runs | |
# it will need to have a knife configuration file and client on | |
# the server if running Chef 0.8.x+. | |
package "acl" | |
execute "mount -o remount,acl /dev/mapper/#{node.hostname}-root" do | |
not_if "mount | egrep '/dev/mapper/#{node.hostname}-root.*acl'" | |
end | |
group "chefadmin" do | |
members "jtimberman" | |
end | |
directory "/srv/chef-repo" do | |
owner "root" | |
group "chefadmin" | |
mode "2775" | |
end | |
execute "git init" do | |
cwd "/srv/chef-repo" | |
not_if { ::FileTest.directory?("/srv/chef-repo/.git") } | |
end | |
execute "setfacl -R -m g:chefadmin:rwX /srv/chef-repo" do | |
only_if "mount | egrep '/dev/mapper/#{node.hostname}-root.*acl'" | |
not_if "getfacl | grep -x 'group:chefadmin:rwx'" | |
end | |
remote_file "/srv/chef-repo/.git/hooks/post-receive" do | |
source "post-receive" | |
mode "775" | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
cd .. | |
env -i git reset --hard | |
rake roles upload_cookbooks |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment