Feature Requests
Completed :latest

Ansible Dynamic Inventory

I've registered all of my hosts into PatchMon, and assigned them into groups.

It'd be amazing if I could point Ansible at a dynamic inventory plugin that queries patchmon for a list of hosts (and their groups)

https://docs.ansible.com/ansible/latest/dev_guide/developing_inventory.html

Is this something you'd be willing to support? I'm happy contributing to this feature/new repo if accepted?

5 Comments

Write a comment...

Posting anonymously

JP
Josh Preston
Josh Preston·1 month ago

I have a fork of the dynamic inventory going:

https://github.com/mrjoshuap/PatchMon-ansible

It seems to support these and a number additional host variables (with include_stats)

Hostvar

Source

ansible_host / patchmon_ip

ip

patchmon_id

id

patchmon_hostname / patchmon_friendly_name

identity fields

patchmon_os_type / patchmon_os_version

OS

patchmon_status / patchmon_effective_status / patchmon_reporting_state

lifecycle / freshness

patchmon_update_state

up_to_date, updates_pending, security_required

patchmon_needs_reboot

boolean

patchmon_updates_count / patchmon_security_updates_count / patchmon_total_packages

package counts

patchmon_last_update

last agent report

S
slibonati·1 year ago
S
slibonati·1 year ago

I think this is in large part there already. There is an endpoint , /api/v1/hosts/info which returns host info. Probably need to add in host group info which this endpoint currently does not return. I'm going to take a stab at writing the plugin.

9
9technologygroup·1 year ago

I'm going to further research into this.

If anyone else has view on this feature request then do put them forth :)

A
aukef·1 year ago

This is an interesting idea! I would probably use this. Perhaps this could be handled outside of PatchMon though: if there is an API to retrieve all hosts and their groups from PatchMon, one could create a simple script to turn this into the correct syntax for an Ansible inventory