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

Vagrantfile module for Ansible based on your work with modifications that may interest you #20

Open
jclaveau opened this issue Jun 19, 2021 · 1 comment

Comments

@jclaveau
Copy link

Hello!

Needing to control Vagrant from Ansible roles or playbooks (for cluster testing purpose), I had to write a collection of modules to handle Vagrant commands and Vagrantfile. For this second part, your work is the best I found during my tech monitoring so I integrated some of it in mine.

Here is my collection repo: https://github.com/jclaveau/ansible-vagrant-modules

To be les opiniated as you, I had to modify some parts of your code:

  • Support of multiple provisionners with all their possible parameters
  • Support of all possible parameters for forwarded_ports (makes overwriting of ssh ports possible)
  • Optional vagrant-groups.yml file
  • Warning removal due to Ruby's ** splat operator
  • Tests with ansible-test and continuous integration with Github Actions

You can find these modifications here: https://github.com/jclaveau/ansible-vagrant-modules/blob/main/plugins/module_utils/Vagrantfile

It diverged quite a lot so I cannot really make a PR but I wanted to notice you of my work so you may take value from it. Thus I open this bug.

I kept the MIT licensed only for the Vagrantfile so you can use it as much as you want. The rest of my collection is in GPLv3+ as the Ansible module development guidelines requires. Obviously, I listed your contributors in the credits of my README.

Thanks a lot for your work!

Here is an example of use (You can see how Ansible yaml fits well with your yaml config):

- name: Add a vm to the Vagrantfile
  jclaveau.vagrant.config:
  args:
    state: "present"
    name: "{{ item }}"
    config:
      box: boxomatic/debian-11
      ansible:
        playbook: "glusterfs_provisionning_playbook.yml"
      shell:
        inline: 'echo "provisionning done"'
      forwarded_ports:
        - host: "808{{ i }}"
          guest: 80
        - host: "8{{ i }}43"
          guest: 443
    loop:
     - srv001
     - srv002
  loop_control:
    index_var: "i"

Thanks a lot for your work

@bertvv
Copy link
Owner

bertvv commented Oct 8, 2021

So sorry for not responding earlier. I'm a bit overwhelmed with Github notifications on all my repos...

Very cool! I'm so glad you got use out of my Vagrantfile & thanks for letting me know!

I'll be checking your changes when I have some time & see what could be a useful addition.

@bertvv bertvv closed this as completed Oct 8, 2021
@bertvv bertvv reopened this Oct 8, 2021
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

No branches or pull requests

2 participants