Though many species use primitive “tools” to complete basic tasks, very few creatures aside from humans craft tools with future use in mind. Anthropologists believe that crafting tools allowed early humans to develop their cognition and acute motor skills, surpassing other primates and ascending the food chain.
So – that’s interesting, but why are we talking about the animal kingdom? Because – when highlighting Development Gateway (DG)’s IT tools – these two worlds are not so different after all. Nonprofits working in the technology for development sphere have to be fast, flexible, and agile – evolving not only with the ever-changing environment, but staying a step ahead.
Unlike many software development organizations, DG prioritizes free and open-source software (FOSS). This means we benefit from collaborating with the community, and give back to it. We release most of our products, and all internal tools, under licenses that allow others to reuse and share our code. In prioritizing FOSS, we are creating software that is both safer and more advanced, allowing us to evolve together.
In recent weeks, we’ve highlighted some of DG’s newest tools – such as AMP Offline and the AutoGeocoder. Today, we present an overview of how we built a new FOSS script that has benefited internal IT management behind the new tools.
Ansible for Deployment and Configuration Management
Together, virtualization; backups; and the ability to automate processes comprise DG’s DevOps triad. Ansible is a software we use for automation: scripting administrative actions (such as installing software and setting up permissions) and templatizing configuration files. Ansible allows scenarios for specific tasks, known as “roles,” and enables code reuse for common solutions such as configuring a web server or setting up a failover cluster. The program requires a list of servers to operate on, known as "inventory," and the means to assign roles and tasks to each. Given the number of virtual machines DG operates, our inventory had to be more than just a plain text file – we needed to build a comprehensive solution.
Directory in LDAP
In DG’s private cloud, we store user accounts, public keys, virtual machine configurations, and other data in a directory powered by OpenLDAP – yet another great example of FOSS. A directory stores information in a tree-like structure: grouping elements by units, departments, and the like. We store inventory and non-secret settings in the LDAP directory, and provide this information to Ansible on demand. Ansible supports invoking a script that provides inventory data, so it was only a matter of writing the script to do so.
Python: Writing the Script
Python was the language of choice to write the extension script. We had recently used it to write a software for managing our LDAP directory, and had contributed our patches to the software library we used. Therefore, we were able to use both Python and that same library for this task.
Lia: A Finished Product
We call the new script lia: LDAP Inventory for Ansible, and it's available under the GPL v3 license. Additionally, because our DevOps team members are avid Debian GNU/Linux users, we also packaged the tool for Debian, making it easy to distribute and update.
We’ve planned to share this script from Day 0 – so it is highly customizable for use with your own LDAP directory structure (schema). And finally, if you want to contribute, we welcome your pull requests on our GitHub page. Because after all, it was both cognition and collaboration that allowed us humans to climb the food chain.