Hi FreeIPA Team
Would you mind to add an API-visible serial/generation value for host and hostgroup data, so API clients can cheaply detect whether cached inventory data is still valid.
Use case: Ansible dynamic inventory generated from FreeIPA via API only.
Example script:
https://github.com/joe-speedboat/linux.scripts/blob/master/ansible/ansible_dynamic_inventory_freeipa_api.py
The script currently has to cache by TTL and rebuild inventory by calling host_find, hostgroup_find, and hostgroup_show for hostgroup membership, including nested groups. This works, but it either risks stale inventory or causes unnecessary API calls when nothing changed. The current script uses a fixed cache TTL and full rebuild after expiry. :contentReference[oaicite:0]{index=0}
host_find
hostgroup_find
hostgroup_show
Expose a cheap API-callable value, for example:
host_inventory_serial
or:
host_serial hostgroup_serial
The value should change when inventory-relevant data changes, including:
current_serial = ipa_api_call("host_inventory_serial") if current_serial == cached_serial: use cached inventory else: rebuild inventory store new serial with cache
Without such a value, API-only clients must either:
An API-level serial would reduce server load, simplify clients, and allow deterministic cache invalidation without requiring direct LDAP access to operational attributes such as modifyTimestamp or entryUSN.
modifyTimestamp
entryUSN
The value should ideally be stable/comparable across FreeIPA replicas, because clients may be configured with multiple FreeIPA servers.
ipaUniqueID is visible already: ipa host-show foo.bar.z --all|grep ipauniqueid
ipaUniqueID
ipa host-show foo.bar.z --all|grep ipauniqueid
we cannot really add a hash value without incurring some transactional costs, though. The problem is that depending on what access controls are applied to the client requesting this serial value we would see different subset of the host attributes and thus would have different value calculated out of it.
We can theoretically expose modifyTimestamp if that's enough and mix it over the DN of the object to provide stable hash that could serve as a serial/ID.
Thanks for answering Alexander. Yeah I see, your point, but I in Ansible EE we have no ipa cmd, our target is to provide lean inventory data in Ansible EE. Okay, so I have to find other ways to find out when I need to rebuild Inventory or move away.
ipa
Thanks again for your work! Chris
Metadata Update from @christian773: - Issue close_status updated to: wontfix - Issue status updated to: Closed (was: Open)
@twoerner is this something ansible-freeipa can help with?