A little while ago, I started my journey learning about DevOps, starting out by diving into some of the tooling (Puppet), and adding a few DevOps podcasts into my rotation.
One problem that plagued the process from the beginning... how to handle puppet modules? Here's the evolution of my thought process...
Stage 1... ignorance
I simple used GIT to control my /etc/puppet/modules/ directory! Lots of redundant code in here that was already saved in other git repos I could/should just fetch, which gives me an idea...
Stage 2..... frustration
Git Submodules! I was just manually pulling down most of my modules directly from their git repos instead of though puppet forge anyway, so how about adding them as submodules to my repo, and having git fetch them for me!
Stage 3...... starting automation
Now that I was trying to build easy to run Vagrantfiles that had my puppet configs, I need some way to set it all up.... Initial trick.... adding a 'setup' script in my vagrant directory that pre-downloads all the modules that I run before the first setup! (either by directly calling git clone on the repo, or by calling git submodule init). This was still a 'prestep' to running vagrant-up, so that didn't quite feel right
Stage 4...... feels right!
One of the first things I did after joining twitter was to ask #puppetize what the best way to manage modules was, and they did not disappoint! I was redirected to this blog, which shows how you can use puppet librarian to manage your modules, but as to not require everyone to have ruby-gems installed on their main machine, they pull it down inside of their vagrant instance (since most vagrant images already have ruby-gems installed since ruby is a core component of puppet and chef.
Utilizing Configuration management with Vagrant is a powerful tool to help build easily repeatable environments for both Dev and Deploy! I hope this helps someone! I know it was quite a struggle initially!