Allowing hostcolor colours to be set

This commit is contained in:
Mark Szymanski 2016-06-17 16:12:01 +10:00 committed by Brian Coca
parent d9d7e413a5
commit 3a6743fb54

View file

@ -86,10 +86,10 @@ def colorize(lead, num, color):
def hostcolor(host, stats, color=True):
if ANSIBLE_COLOR and color:
if stats['failures'] != 0 or stats['unreachable'] != 0:
return u"%-37s" % stringc(host, 'red')
return u"%-37s" % stringc(host, C.COLOR_ERROR)
elif stats['changed'] != 0:
return u"%-37s" % stringc(host, 'yellow')
return u"%-37s" % stringc(host, C.COLOR_CHANGED)
else:
return u"%-37s" % stringc(host, 'green')
return u"%-37s" % stringc(host, C.COLOR_OK)
return u"%-26s" % host