Ansible Integration with Device42

Ansible Lookup Plugin

Fuel Ansible with the accurate infrastructure details autodiscovered by Device42!

The core of Ansible is a simple automation language that both describes and can carry out repeatable building and provisioning of IT application infrastructures.

It is very powerful, yet can be easier for a beginner to learn than some of its alternatives, as it doesn't require one to be an accomplished programmer to use it — as Ansible’s website puts it, Ansible "...doesn't require a grad-level computer science degree to read."

Device42 currently offers three Ansible integrations:

1. Static Inventory Script: generate static lists of hosts from Device42

2. Dynamic Inventory Script: dynamically generate host lists from Device42

3. Lookup Plugin: call it from your playbook to fetch a host’s IP addresses & password from Device42 [great when scripts need to SSH to a host!]

Avoid repetitive tasks.

...Automate them with Ansible & Device42!

Now, with Device42 integration, Ansible has near real-time access to your infrastructure’s inventory, making it an even more capable automation solution.

Need a list of hosts for anything from routine auditing activities to automated updates? Ansible can pull data in near-real time from Device42’s API. Continuous Discovery ensures that Device42 delivers accurate, up-to-date results whenever they’re needed.

Ansible Integration

Inventory data from the source!

Generate accurate Static or Dynamic inventory lists for use with Ansible!

The Ansible-Device42 Static Inventory Script can be used to create and pre-populate an inventory file based on Device42’s Configuration Items for use by Ansible.

The Dynamic Inventory Script can be used dynamically in conjunction with the $ansible command, generating a real-time inventory based on data within Device42.

Need to SSH into a host for final provisioning, to automate a package update, or for any other reason? By embedding the Ansible lookup script within your playbooks, you can easily get a hosts IP addresses and password, on demand!

Ansible Integration

Use With Any Ansible Command.

Execute any Ansible action that requires a list of hosts!

Ansible will also happily execute and use the output of any program that outputs a valid JSON dictionary of hosts to stdout. Therein lies the magic of Device42’s dynamic inventory script, powering Ansible with near-realtime lists of hosts to power any Ansible command!

Hint: The dynamic inventory script is especially powerful when combined with Device42’s Ansible lookup plugin!

Reference the Ansible documentation for automation examples and ideas!

Ansible Integration

Device42 + Ansible

Leverage CI’s in your CMDB for easier automation

No matter the use case, there’s no longer a need to manually create lists of machines to perform your desired action against.

Whether you are pushing out new software to all the hosts in your environment, refreshing SSH keys, updating configurations, or just verifying a setting. All these tasks are made easier with the Device42 + Ansible static & dynamic inventory scripts.

Ansible Integration
            [devtest@MMA-CentOS d42inv]$ ./autoInv_d42.py --list
            {"production": ["freebsd-93-001", "rundeck-001", "oracle-7-001", "centos-68-001", "localhost.localdomain", "centos-7-001", "ubuntu-1404-001.device42.pbt", "centos-7-002.device42.pvt", "ansible-001.device42.pvt"]}
        

Go ahead and download one or all of our Ansible integrations today!

The Ansible-Device42 inventory scripts can be found on the Ansible Inventory GitHub page.

Find the Ansible Lookup Plugin at its Github page, here.