#!/bin/bash minimum=${1:-86400} cd /etc/ansible/gathered_facts for f in *; do g=$(grep ansible_uptime_seconds $f) if [[ $? > 0 ]]; then continue fi up=$(echo "$g" | sed -e 's/.*"ansible_uptime_seconds":\s*\([0-9]\+\).*/\1/') if [[ $up -lt $minimum ]]; then echo $f uptime is $((up / 3600)) hours $(($up % 3600 / 60)) minutes fi done # vim: set tabstop=4 shiftwidth=4 expandtab smarttab: