Forum Discussion

JGJG's avatar
2 years ago

Ansible lm_info devices by group

Hello All,


I am trying to achieve a similar result in Ansible using the LogicMonitor collections modules as I can get with the Rest API using python.

Using rest, I can do something like:
{{url}}/device/groups/{{group_id}}/devices
and I will get a list of all devices for the group specified in ‘group_id’.

I am trying to get the same result using the ansible lm_info module but no luck.
I am not trying to perform any action - just return the info.

I tried using full_path to narrow the device results down but I still get all devices instead of those associated with the group (this is not a collector group but a device group).  The group parameter is not supported for lm_info with a target: device but full_path is supposed to be supported.

I am reluctant to even post this question because I am probably missing something really simple 🙄 but …

Thanks in advance

  • Just to provide closure, I simply wrote a python script that takes parameters, passed in a value from a previous ansible step and registered the output from the python script to use in subsequent steps.

    Not as streamlined as using straight Ansible, but it got the job done.

    Thanks for all of the comments.

    Have a great weekend

  • Anonymous's avatar
    Anonymous

    Agreed. I built up my own little library of functions to along with the SDK.