mirror of
https://pagure.io/fedora-infra/ansible.git
synced 2026-03-30 08:50:55 +08:00
2 rough cuts for viewing/listing the ansible logs
- see the scripts for how they work and example usages
This commit is contained in:
30
scripts/loglist
Executable file
30
scripts/loglist
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
# lists what playbooks/processes have happened today
|
||||
# takes 2 optional arguments: date string, playbook name
|
||||
# examples:
|
||||
# ./loglist
|
||||
# ./loglist yesterday
|
||||
# ./loglist "last friday"
|
||||
# ./loglist yesterday mirrorlist
|
||||
|
||||
logpath='/var/log/ansible'
|
||||
|
||||
when='yesterday'
|
||||
if [ -n "$1" ]; then
|
||||
when=$1
|
||||
fi
|
||||
|
||||
ts=`date -d "$when" +%Y/%m/%d`
|
||||
|
||||
if [ -z "$2" ]; then
|
||||
find $logpath/$ts -mindepth 1 -maxdepth 1 -type d -print
|
||||
exit;
|
||||
fi
|
||||
|
||||
if [ -d $logpath/$ts/$2 ]; then
|
||||
find $logpath/$ts/$2 -mindepth 1 -maxdepth 1 -type d -print
|
||||
else
|
||||
echo "No such playbook log: $2"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user