Device42 – Official Blog

Towards a Unified View of IT Infrastructure | The Official Device42 Blog


Announcing the Ansible Lookup Plugin

Infrastructure deployed from code is becoming more and more common.Ansible - Device42 Logo Building servers by hand is making sense less and less, and the process is often being bypassed altogether for automated builds and/or containers, instead.


There are, however, lots of servers around that were built before infrastructure as code was common, and still more servers and containers that were built as one-offs (or “temporary” test servers!) where automating the build process would have taken more time than a manual build.

Ansible Automation powered by Device42
Maintenance on existing servers can be time consuming

They need to be updated and cared for too; at least until they’re replaced. It may make sense to destroy the existing ones and automate their inclusion if they’ve become part of your infrastructure – but that takes time, and those are the kinds of big changes that require thorough testing.


In the meantime, you need to update the vulnerable packages on those servers, deploy new monitoring agents, collect statistics, push new certificates… the list goes on.


So you have the software / certificate / package / etc. ready to go, and you’re ahead of the game: You already know you can easily generate a list of server names to update with Device42’s existing Ansible Inventory Plugin.

Now what? Look up credentials one by one? Absolutely not!


Meet the Ansible Lookup Plugin! Given a device_name, the Ansible lookup plugin can fetch the IP address and/or the associated credentials [login and password] for a given server — Just what the doctor ordered when it comes time to automate deployment of updates to a large group of servers, for example.


For credentials, simply have your Ansible Playbook call:
lookup('cred_d42', 'device_name', 'password', 'username')


If you need IP address for your servers, simply:
lookup('cred_d42', 'device_name', 'host')


The Ansible Lookup Plugin can be a powerful ally in your quest to further automate your infrastructure. Whether it’s one task, or an entire as-code deployment, we’ve got your back. The lookup plugin is as versatile as the scripts you write, and combined with the existing plugins, a veritable powerhouse!


Visit our Ansible integration page for more info, and download today!


Thanks for checking out Device42’s newest Ansible integration — download your copy now, directly from our github.

If you aren’t already a Device42 user, get a 30-day free trial for free, or share the link with a friend!


Device42’s integrations are provided as-is and without any support. We’re happy to fix bugs, though — let us know at [email protected].

Share this post

Rock Johnston
About the author