3

I've created a basic LAMP stack for my Vagrant box using Anisible. It's all working fine, etc and now I want members of my team to use the same box.

Vagrant recommends one Vagrant file per project, not a problem, but what about the provision resources, the playbooks, hosts, etc? I'm pretty sure they shouldn't be committed to that projects Git repo, so what do I do with them?

Do I commit them to a separate repo and simply clone them as a submodule? If that's the case, should I include the Vagrant file as well or am I missing something?

Taking the submodule idea further, would it makes sense to create project-specific branches off this repo and clone them as a submodule or am I looking at this the wrong way?

2
  • I think you would just commit those. Unless I am missing something but the idea is to have one Vagrantfile and then all the other resources it needs in the project. Then when someone pulls it down you get all that and vangrant up Commented Mar 9, 2016 at 15:14
  • yeah, you're over thinking it here. Take a look at other popular repositories that include a Vagrantfile and any necessary provisioners with them Commented Mar 9, 2016 at 15:31

1 Answer 1

5

Commit everything you need to bring up your box(es) for that project. You can easily copy and paste files from one project to another for reuse (or make a general repo) but the general idea would be that once they are committed to a project then all the developers needs to do is pull that project and vagrant up. If there are any mid-development changes, they can pull down again and vagrant provision and are current. That is the whole idea.

Check out the Github repos for Anisible, Chef and Puppet. The files are all there for their vagrant boxes per project.

Sign up to request clarification or add additional context in comments.

3 Comments

Cool, thanks for the quick response everyone. The simplest option is the correct one - I'm happy with that :)
So if I'm developing a Web App using a local Vagrant box, I should include the Vagrantfile and provisioning scripts in git even though the production server will not be using Vagrant?
@buttlebutkus yes because it make local development work on any machine then. Your production deployment could/should deploy only what is needed for production.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.