I'm trying to use vagrant to set up a dev environment that automatically clones two repositories if they haven't already been cloned.
I wrote a simple script to clone the repos, after failing in many, many ways to get puppet to run the git command directly. For some reason I thought this method would be foolproof, but it turns out I'm a better fool than I thought.
exec {"load-repos":
command =>"/bin/bash /vagrant/manifests/modules/scripts/clone_repos.sh",
require => Package["git-core"],
}
Here's the script:
#!/bin/bash
if [ ! -d /vagrant/repo-one-dest ]; then
git clone git@example.com:/repo-one.git /vagrant/repo-one-dest
fi
if [ ! -d /vagrant/repo-two-dest ]; then
git clone git@example.com:/repo-two.git /vagrant/repo-two-dest
fi
exit
The private keys are set up properly. When I log into the vm and manually run bash clone_repos.sh
, everything works. No matter how many times I reload vagrant and let puppet do its thing, the repos are never loaded via the exec. What am I missing?