Closed Andyjb8 closed 1 year ago
Hey! I really appreciate you testing, I can see right away the issue with setting a node back to a managed state (and this might be a good time to add a CHANGELOG actually).
To the other point of requiring snmp_version and parameters, that should not be necessary. However if you do specify snmp_version, it will require the additional params for that version, and I should see about updating the documentation block to reflect that. I use both unmanaged and muted states for orion_node without needing to pass snmp_verison, can you retest something like this for me?
- name: Unmanage a node
solarwinds.orion.orion_node:
hostname: "{{ solarwinds_host }}"
username: "{{ solarwinds_username }}"
password: "{{ solarwinds_password }}"
name: "{{ node_name }}"
state: unmanaged
Hmm, I am getting:
"msg": "snmp_version is 2 but all of the following are missing: ro_community_string"
Here is what I have:
- hosts: all
gather_facts: false
vars:
solarwinds_info: &solarwinds_info
hostname: al-svr-sol-01
username: user
password: password
tasks:
- name: Unmanage Node Solarwinds
solarwinds.orion.orion_node:
<<: *solarwinds_info
state: unmanaged
name: "{{ inventory_hostname }}"
ip_address: "{{ ansible_host }}"
Originally ip_address in there, I took that out and I get the same thing.
- name: Unmanage Node Solarwinds
solarwinds.orion.orion_node:
<<: *solarwinds_info
state: unmanaged
name: "{{ inventory_hostname }}"
ip_address: "{{ ansible_host }}"
I just realized what I had above was changing state to unmanaged. I get the same "msg": "snmp_version is 2 but all of the following are missing: ro_community_string" warning when changing state to either managed or unmanaged. But, when I have the snmpv3 parameters unmanaged works, but managed does not.
awesome yup I see my mistake there as well. I am setting a default for snmp version when it isn't passed, which is triggering the required_if on that parameter. I have a few changes to make but should have a new version by tomorrow morning.
Excellent, thanks!
Also, should I be able to update snmpv3 credentials like this with orion_update_node?
- name: Update SNMPv3 on Node
solarwinds.orion.orion_update_node:
<<: *solarwinds_info
name: "{{ inventory_hostname }}"
properties:
ObjectSubType: SNMP
snmp_version: 3
snmpv3_auth_key: authpass
snmpv3_auth_method: SHA1
snmpv3_priv_key: privpass
snmpv3_priv_method: AES128
snmpv3_username: snmpuser
delegate_to: localhost
It's not working and I get this message:
_"msg": "Failed to update 400 Client Error: Invalid column name 'snmp_version'.\r\nInvalid column name 'snmpv3_auth_key'.\r\nInvalid column name 'snmpv3_auth_method'.\r\nInvalid column name 'snmpv3_priv_key'.\r\nInvalid column name 'snmpv3_priv_method'.\r\nInvalid column name 'snmpv3_username'. for url: https://x.x.x.x:17778/SolarWinds/InformationService/v3/Json/swis:/x.x.x.x/Orion/Orion.Nodes/NodeID=1061"_
solarwinds treats snmpv3 credentials differently, they are stored in a credential library, so that may be the issue that those credentials aren't updated by the node's URI. This is a separate issue that I haven't had the need to correct, but managing nodes with snmpv3 this way will absolutely fill up your Credential Library in solarwinds (it will make a new credential set for each node)
Thanks you for this collection! I am testing it out as this will be very useful and the solarwinds.orion.orion_node module works great to add nodes and to set a managed node to unmanaged, but I am having an issue setting an un-managed state back to a managed state.
Here is my task:
Here is the error I get: fatal: [myhostname -> localhost]: FAILED! => { "changed": false, "msg": "New-style module did not handle its own exit"
Also, I found it necessary to specify the snmp_version and parameters to manage / un-manage a node. Why is that necessary?
Thanks!