Get list of nodes being out of sync

Problem:
I regulary get many nodes with mismatch of certificate and private key, I observe suche nodes on foreman with orange color (out of sync).
IN this case I do reinstalling of SSL certificates for all such nodes (clean current and request for new), but I have to make the list of theese nodes manually.
Is there any way to get from server by script the list of nodes being out of sync instead of doung it manually ?
Expected outcome:
Point me to some manuals in foreman relevant to the question
Foreman and Proxy versions:

Foreman and Proxy plugin versions:
Foreman 1.23.2. and puppet 6.19.1
Distribution and version:
Centos 7
Other relevant data:

On the main foreman page the pie chart has “stale servers”

Click that, to get the query to return that subset, and pass that search query into /api/v2/hosts.

Json based results will have the hosts.

I have ansible jobs to do this every once in a while and then connect to and"fix" them. Our most common issues are hung puppet processes or dead puppet services, but it will find/fix cert issues as a last resort too…

1 Like

Thanks, Lang_Jason !
I’ve catched the idea and on my way to realize it.