diff options
| author | Seth Vidal <skvidal@fedoraproject.org> | 2013-06-03 22:19:01 +0000 |
|---|---|---|
| committer | Seth Vidal <skvidal@fedoraproject.org> | 2013-06-03 22:19:01 +0000 |
| commit | e9e5208be6ccc6c87be00adc8042e5d01e37284e (patch) | |
| tree | b65008c97cbe0a6b89fe84b1bd3da72100658d57 /scripts/installedon | |
| parent | a73047871c825065b71033639e9006f9aa71b160 (diff) | |
add builders/isbuilding and installedon scripts to ansible scripts
Diffstat (limited to 'scripts/installedon')
| -rwxr-xr-x | scripts/installedon | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/scripts/installedon b/scripts/installedon new file mode 100755 index 000000000..ace4a9f09 --- /dev/null +++ b/scripts/installedon @@ -0,0 +1,37 @@ +#!/usr/bin/python -tt + +import ansible +import ansible.runner +import ansible.playbook +import sys +import os +import time + +if len(sys.argv) < 2: + print "installedon hostname or group" + sys.exit(1) + +pattern = '*' +if len(sys.argv) > 1: + pattern=';'.join(sys.argv[1:]) + + +conn = ansible.runner.Runner(pattern=pattern, timeout=20, forks=30, remote_user='root') +conn.module_name='shell' +conn.module_args='rpm -qa --qf "%{installtime}\n" | sort -rn| tail -n 1' + +res = conn.run() + + +for host in sorted(res['dark'].keys()): + print '%s is down' % host + +now = time.time() +for host in sorted(res['contacted'].keys()): + insttime = float(res['contacted'][host]['stdout']) + days = (now - insttime) / 86400 + + print '%s install is %d days old' % (host, days) + + + |
