I’ve been working on support for interacting with Consul from within Ansible. Currently there is support for manipulating services, checks, acls and values in the kv store. There is also an inventory that gets built from the contents of the catalog, grouping nodes by service and availability. Its pretty close to ready for submission and I have a few questions before creating the pull request.
The modules have been added in the extras repo, but there are other files, the lookup module, inventory script and importantly the integration tests that don’t really fit there and need to be added to the project proper to work. What is the suggested way to add module submissions with tests and other project level files? Can the inventory and lookups go in the extras project? What about the tests? What should I be thinking about for v2 support?
One of the modules is named consul and this happens to have the same name as the inventory script consul.py, this can cause collisions in ‘hacking’ mode where the runtime loads the inventory script instead of the module. Where would I look to exclude the inventory plugins from the module lookup? I could rename the consul module as a workaround, but would prefer to exclude the inventory scripts if possible.
Also, the tests need a working Consul cluster to pass, I’ve put together a Vagrant project and associated roles to spin up a new cluster and add an agent to the local host. If the local agent can’t be found the tests will not run. The roles and vagrant project can be found here
https://github.com/sgargan/consul-vagrant
Vagrant has been really useful for testing, it might be something worth formalizing into the test infrastructure so that the destructive tests can be easily and cleanly run. If the tests for a module were easy to run in isolation, PRs could be automatically verified, I think this TDD/CI approach would definitely help to speed up the throughput of submissions. What are your thoughts on this? I’d be happy to help out with such an effort.
regards,
Steve