Setting up a Ansible Module Test Environment
I’ve begun developing some Ansible modules and have created a Vagrant environment to help with testing. You can check it over over on my github. The environment has been created to test some MongoDB modules but can easily be repurposed to another use. It’s quite simple to get started;
git clone https://github.com/rhysmeister/AnsibleTest.git
cd AnsibleTest
vagrant up
This will fire up a VM and install two versions of Python; 2.6 and 3.5. These are the two versions of python that all Ansible modules should be tested against. These version can be activated with the following bash aliases; py26 and py35. These aliases will set the version of python to the appropriate one as well as setting up the ansible environment so your custom modules can be found (those that are in the git repo cloned during setup).
The tasks/main.yml file does contain a bunch of other tasks, to deploy some bash scripts and ansible playbooks, to help with module testing. These can be removed or modified to suit your own purposes.