From 26aa4e2469879fe22ded495830cc59945f51a6b5 Mon Sep 17 00:00:00 2001 From: Ingo Gottwald Date: Thu, 12 Jul 2012 11:14:15 +0200 Subject: [PATCH] Enabled cowsay support for Ubuntu --- lib/ansible/callbacks.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/ansible/callbacks.py b/lib/ansible/callbacks.py index 7bbbf39793..38f32fca48 100644 --- a/lib/ansible/callbacks.py +++ b/lib/ansible/callbacks.py @@ -78,8 +78,16 @@ class AggregateStats(object): def banner(msg): res = "" + global COWSAY if os.path.exists("/usr/bin/cowsay"): - cmd = subprocess.Popen("/usr/bin/cowsay -W 60 \"%s\"" % msg, + COWSAY = "/usr/bin/cowsay" + elif os.path.exists("/usr/games/cowsay"): + COWSAY = "/usr/games/cowsay" + else: + COWSAY = None + + if COWSAY != None: + cmd = subprocess.Popen("%s -W 60 \"%s\"" % (COWSAY, msg), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) (out, err) = cmd.communicate() res = "%s\n" % out