Skip to content

Instantly share code, notes, and snippets.

@jwhitley
Created June 22, 2012 07:14
Show Gist options
  • Save jwhitley/2970941 to your computer and use it in GitHub Desktop.
Save jwhitley/2970941 to your computer and use it in GitHub Desktop.
Sample VM user-customization Chef recipe
include_recipe "git"
%w{ vim zsh }.each { |p| package p }
bash "Set vagrant's shell to zsh" do
code <<-EOT
chsh -s /bin/zsh vagrant
EOT
not_if 'test "/bin/zsh" = "$(grep vagrant /etc/passwd | cut -d: -f7)"'
end
rc_repo = "[email protected]:GITHUB_USERID/YOUR_RCFILE_REPO.git"
# This is needed since the check in the git resource is busted;
# it looks for the target dir, not <target>/.git
bash "Perform initial clone" do
code <<-EOT
cd /home/vagrant
sudo -E -u vagrant bash -c "git init . && git remote add origin #{rc_repo} && git pull origin master"
EOT
not_if 'test -d /home/vagrant/.git'
end
git "/home/vagrant" do
repository rc_repo
reference "master"
action :sync
user 'vagrant'
group 'vagrant'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment