Get Nodes Module #15
Replies: 3 comments 3 replies
-
Nice! What might make it more broadly useful might be a more customizable "orion_query" module, with a bool option to write it to a csv? Only tweak I think would be needing a 'query' param for the string, add a bool param for 'csv', and make the csv_path only required if 'csv' is true. There's other minor things, such as an EXAMPLES and RETURN block to put in, and Ansible guidelines put the imports after the RETURN block (pep-8 will complain, ignore it). If it's included in the collection, you should also use the extends_document_fragment for the orion_auth_options, along with importing the orion_argument_spec from module_utils/orion.py (orion_custom_property should be a fine reference for all those updates). Also, I think you'll really find use for what I'm cooking up next. I just finished making a dynamic inventory plugin for another collection, and I plan to use that experience to make one for Solarwinds. |
Beta Was this translation helpful? Give feedback.
-
Just pushed 1.1.0 for you to test out the dynamic inventory plugin next week! To enable it, update the collection, then update your ansible.cfg:
and to enable caching, you'll need to use something other than default memory fact caching plugin. these are the [defaults] settings that I use
You'll find a fairly good starting example in the plugin's EXAMPLE block to get started, but holler if you have questions. |
Beta Was this translation helpful? Give feedback.
-
Nice, I got it working! Is there a way it can exclude certain nodes from being included in the dynamic inventory? For example if the node is unmanaged? (StatusIcon property is Unmanaged.gif) or a certain string in the hostname, I do not want them added to dynamic inventory. For instance say nodes with "VA" at beginning of hostname are in SolarWinds but managed by another group and not by my ansible server? Thanks! |
Beta Was this translation helpful? Give feedback.
-
I created a custom module to get node data and custom properties from Solarwinds. It accomplishes the same thing as "Export Custom Property Values" from the "Manage Nodes" page in Solarwinds. I needed this because I generate my ansible inventory from my solarwinds node inventory. I have another script that creates my ansible inventory from this csv output from solarwinds. I am sure it can be improved, but wanted to share in case this is something you thought would be useful to include in this collection
orion_get_nodes.py
Beta Was this translation helpful? Give feedback.
All reactions