Not sure that is really an ansible task.  I'm sure you could use ansible to 
set it up.  I use this on my systems to get notification: 
cd /etc/systemd/system
if [[ ! rebootsh.service ]]; then
   cat > rebootsh.service << EOF
[Unit]
Description=Notify sys admin when the server gets rebooted
After=network.target
After=postfix.service

[Service]
Type=simple
ExecStart=/root/bin/reboot.sh
TimeoutStartSec=0
RemainAfterExit=no

[Install]
WantedBy=rescue.target
WantedBy=multi-user.target
WantedBy=graphical.target
EOF
   echo "Added the rebootsh service"
   chmod 444 rebootsh.service
   systemctl enable rebootsh.service
else
   echo "Rebootsh.service already in place"
fi

cd /root/bin
if [[ ! -f reboot.sh ]]; then
   cat > reboot.sh << EOF
#!/bin/bash
#
# Send an e-mail whenever the system starts.
#
DATE=$(/bin/date +'%d%b%y')
TIME=$(/bin/date +'%H:%M%:S')
HOST=$(/bin/hostname -s)
SUBJ="${HOST} has been booted on ${DATE} at ${TIME}"
[email protected]
BODY=$(/bin/mktemp)
echo ""                                       >  ${BODY}
echo "The last five logins were:"             >> ${BODY}
/usr/bin/who /var/log/wmtp | /usr/bin/tail -5 >> ${BODY}
#
/bin/mailx -s "${SUBJ}" ${NOTIFY} < ${BODY}
/bin/rm ${BODY}

You could use something similar I would believe?

On Sunday, October 14, 2018 at 4:56:30 PM UTC-4, [email protected] wrote:
>
> Hi All, 
>
> I am looking for ansible play book example to send alert to premetheus 
> after a host has rebooted and re-started unexpeditly. Any help would be 
> greatly appreciate it. 
>
> Thanks 
> Riaz
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/ea221226-cac2-448d-8cd8-5f57834d1388%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to