Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vagrant test env #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Vagrant test env #3

wants to merge 1 commit into from

Conversation

apentori
Copy link
Contributor

Add usage of vagrant to deploy a local test environment

Signed-off-by: Alexis Pentori <[email protected]>
@apentori apentori requested a review from jakubgs June 27, 2023 08:58
Copy link
Member

@jakubgs jakubgs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if I like this. I'd rather not clutter up the template with extra stuff like that.

One one hand I do agree that it's good to have a way to test things locally. But on another hand
this repo should be slim, and have only things essentialy for a fleet setup. I'd rather keep the Makefile as small as possible. This setup is useful, but it is optional.

Some other issues include:

  • You can't create something like ansible/inventory/test since many repos already have that.
  • Same goes for ansible/group_vars/test.yml, it's a file that can easily already be in fleet repos.

If I was doing something like this I'd write a script of some sort to put in infra-utils that would call Vagrant and Ansible for you. For example:

  • You don't need a group_vars file because that could be passed to Ansible via -e flag.
  • You don't need a inventory file because that could be passed to Ansible via -i flag.
  • All you need is a Vagrantfile, and that could be created by the script.
  • The only thing we could add to the template is Vagrantfile and .vagrant to .gitignore.

What I'd envision is if you're in any repo, and you want to test playbook abc, instead of doing:

ansible-playbook ansible/abc.yml

You could do:

~/work/infra-utils/ansible/vm-playbook.py ansible/abc.yml

Which would:

  1. Create a Vagrantfile if not present
  2. Start a virtual machine if not already running.
  3. Run Ansible in that VM using flags like -e, -i, --user, and soon.
  • It could also parse the playbook file to apply to the host the correct groups

What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants