I am working on automating device onboarding using Ansible and the SolarWinds SWIS API.
Before attempting to add a node, I would like to verify whether the device already exists in SolarWinds (preferably by IP address or hostname) to avoid duplicate entries.
I found that querying Orion. Nodes using SWQL seems to be the right approach, for example
SELECT NodeID, Caption, IPAddress
FROM Orion.Nodes
WHERE IPAddress = ip
Has anyone implemented this check in Ansible? Is querying Orion.Nodes the recommended and most efficient method, or is there a better API endpoint or approach for validating node existence before creating a new node?
Any sample playbooks, scripts, or best practices would be greatly appreciated.
Thanks in advance!