Skip to content

The Ansible Solarwinds Inventory Plugin was built to allow you to use your preexisting Solarwinds NCM inventory information to run Ansible playbooks against.

License

Notifications You must be signed in to change notification settings

dalrrard/ansible-solarwinds-inventory-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Ansible Solarwinds Inventory Plugin
Explore the docs »

Report a Bug · Request a Feature . Ask a Question

Project license Code style: black

Pull Requests welcome code with love by dalrrard

Table of Contents

About

The Ansible Solarwinds Inventory Plugin was built to allow you to use your preexisting Solarwinds NCM inventory information to run Ansible playbooks against.

Built With

This project was built and tested using Python 3.9 and Ansible 4.8.0 (ansible-core 2.11.6) though earlier versions should work with minimal to no tweaking.

Getting Started

Prerequisites

This plugin currently uses the Cirrus.Nodes table from Solarwinds NCM using the Solarwinds Information Service (SWIS). In the future, the ability to pull information from Orion may be added.

Installation

You can install this plugin in a few ways. The most straightforward is to add the plugin locally as described in these instructions. For convenience, this is how you can add it to your user's home directory in Linux.

mkdir -p ~/.ansible/plugins/inventory

cd ~/.ansible/plugins/inventory

curl -O https://raw.githubusercontent.com/dalrrard/ansible-solarwinds-inventory-plugin/main/solarwinds.py

You can verify that Ansible sees the plugin by running this command:

ansible-doc -t inventory solarwinds

Usage

To use this plugin, you'll need to create a file named any of these names:

  • solarwinds_inventory.yaml
  • solarwinds_inventory.yml
  • solarwinds.yaml
  • solarwinds.yml

The information below is mandatory information to put in the file.

---
plugin: solarwinds
base_url: https://<server-fqdn-or-ip>
username: <vault encrypted username for Solarwinds>
password: <vault encrypted password for Solarwinds>

This details most available options. See Ansible's constructed inventory documentation for more standard options.

---
plugin: solarwinds
base_url: https://<server-fqdn-or-ip>
username: <vault encrypted username for Solarwinds>
password: <vault encrypted password for Solarwinds>
api_port: 17778
verify_ssl: true
additional_properties:
  # Example options. You can use any field from the Cirrus.Nodes table.
  - Location
  - OwningGroup
  - Tenant
  - SiteID
groups:
  cellular_routers: "'-4G' in inventory_hostname or '-4g' in inventory_hostname"
use_connection_profiles: true

The additional_properties option is a list of column names from Cirrus.Nodes that you want to group the inventory by. The plugin automatically retrieves these fields from Cirrus.Nodes:

  • AgentIP
  • SysName
  • ConnectionProfile
  • MachineType
  • OSVersion
  • OSImage

It uses SysName for the ansible_host variable and will attempt to retrieve the ConnectionProfile information for each device and set the ansible_user, ansible_password, and ansible_become_password for each device with the information from the associated profile.

You can use the inventory just like any other. This command will print an inventory graph to your screen of all the hosts and groups they belong to.

ansible-inventory -i solarwinds_inventory.yml --graph --ask-vault-pass

Roadmap

See the open issues for a list of proposed features (and known issues).

Support

Reach out to the maintainer at one of the following places:

Project assistance

If you want to say thank you or/and support active development of Ansible Solarwinds Inventory Plugin:

  • Add a GitHub Star to the project.
  • Tweet about the Ansible Solarwinds Inventory Plugin.
  • Write interesting articles about the project on Dev.to, Medium or your personal blog.

Together, we can make Ansible Solarwinds Inventory Plugin better!

Contributing

First off, thanks for taking the time to contribute! Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make will benefit everybody else and are greatly appreciated.

Please read our contribution guidelines, and thank you for being involved!

Authors & contributors

The original setup of this repository is by Dalton Rardin.

For a full list of all authors and contributors, see the contributors page.

Security

Ansible Solarwinds Inventory Plugin follows good practices of security, but 100% security cannot be assured. Ansible Solarwinds Inventory Plugin is provided "as is" without any warranty. Use at your own risk.

For more information and to report security issues, please refer to our security documentation.

License

This project is licensed under the GNU General Public License v3.

See LICENSE for more information.

About

The Ansible Solarwinds Inventory Plugin was built to allow you to use your preexisting Solarwinds NCM inventory information to run Ansible playbooks against.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages