-
Notifications
You must be signed in to change notification settings - Fork 68
Expand file tree
/
Copy pathrun_HamPi_playbook_xubuntu_vm
More file actions
executable file
·27 lines (21 loc) · 1.02 KB
/
Copy pathrun_HamPi_playbook_xubuntu_vm
File metadata and controls
executable file
·27 lines (21 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env bash
#
# Copyright 2020 - 2023, Dave Slotter (W3DJS). All rights reserved.
#
echo -n "Ansible Playbook Run for Xubuntu VM started at: "
start_time=`date`
echo $start_time
# Compute the seconds since epoch for start date
t1=`date --date="$start_time" +%s`
curdate=`date +%Y-%m-%d`
echo "ansible-playbook -vvv -u hampi -i hosts_xubuntu_vm tasks/main.yml"
ansible-playbook -vvv -u hampi -i hosts_xubuntu_vm tasks/main.yml | tee --append ansible-output/ansible-output_${curdate}.txt
if [ -x /usr/local/bin/notify-send ]; then
export NOTIFY_SEND_URL="http://192.168.1.220:12345"
/usr/local/bin/notify-send -i /usr/share/icons/Adwaita/scalable/status/checkbox-checked-symbolic.svg "HamPi" "Ansible has finished."
fi
# Compute the seconds since epoch for end date
end_time=`date`
t2=`date --date="$end_time" +%s`
let diff_time=$t2-$t1
printf "Total time for running Ansible Playbook for Xubuntu VM: %02d:%02d:%02d\n" $((diff_time/3600)) $((diff_time%3600/60)) $((diff_time%60)) | tee --append ansible-output_${curdate}.txt