I’m writing an inventory plugin that gets a list of online machines from an active directory OU structure and dynamically creates groups and host details from it.
However, as I write it - I’d like to be able to test the incremental changes by just calling parser() directly.
Does anyone have an example call to parser() to test plugins? For example - my definition is :
I found the inventory script documentation (on how to create your own) to be severely lacking… i eventually gave up on trying it.
I hope you find an answer, but I just wanted to vent my frustration with the docs here haha
Thanks Albert for your feedback on the documentation - I’m sorry it hasn’t helped you achieve your goals. Do you remember where you got stuck? If so, would you be willing to share the details so we can improve the docs?
Josh, if you solve your challenges, I encourage you to contribute what you learn back to the documentation so everyone can benefit from your exploration.
Feel free to respond via email or join the #ansible-docs IRC channel on Freenode IRC.
Thanks,
Alicia
Alicia Cozine
Lead Technical Writer, Ansible by Red Hat
The part that seems to be lacking for me is testing of inventory plugins (or plugins in general). My current assumption is I’ll need to setup the ansible development environment and create a unit test.
Can you confirm if that is the case? Scripts were significantly easier, as I could just visually inspect the --list output of the script to confirm the json output etc. I cant seem to find a way to correctly call the inventory plugin to test all of its results. Specifically, most of the unit tests don’t actually test calls to the inventory class. Such as inventory.add_host() etc.