Add color parameter

When we're logging inside of ansible, turning off ansi colors can
be nice. Especially inside of Zuul.

Change-Id: I719ebb106fbb31795cc02c9504507bdae607bcdd
This commit is contained in:
Monty Taylor 2020-04-21 16:04:48 -05:00
parent 7570d49d8e
commit 0505f79daa
2 changed files with 4 additions and 0 deletions

View File

@ -167,6 +167,7 @@ def main():
facter_basename=dict(default='ansible'), facter_basename=dict(default='ansible'),
environment=dict(required=False, default=None), environment=dict(required=False, default=None),
certname=dict(required=False, default=None), certname=dict(required=False, default=None),
color=dict(required=False, default=None),
tags=dict(required=False, default=None, type='list'), tags=dict(required=False, default=None, type='list'),
execute=dict(required=False, default=None), execute=dict(required=False, default=None),
noop=dict(required=False, default=False, type='bool'), noop=dict(required=False, default=False, type='bool'),
@ -254,6 +255,8 @@ def main():
cmd += " --tags '%s'" % ','.join(p['tags']) cmd += " --tags '%s'" % ','.join(p['tags'])
if p['certname']: if p['certname']:
cmd += " --certname='%s'" % p['certname'] cmd += " --certname='%s'" % p['certname']
if p['color']:
cmd += " --color='%s'" % p['color']
if module.check_mode or p['noop']: if module.check_mode or p['noop']:
# Noop causes detailed-exitcodes to sometimes erroneously # Noop causes detailed-exitcodes to sometimes erroneously
# return failures, so we only set detailed-exitcodes when # return failures, so we only set detailed-exitcodes when

View File

@ -135,6 +135,7 @@
facts: "{{ facts|default(omit) }}" facts: "{{ facts|default(omit) }}"
facter_basename: "{{ facter_basename|default(omit) }}" facter_basename: "{{ facter_basename|default(omit) }}"
logdest: "{{ puppet_logdest|default(omit) }}" logdest: "{{ puppet_logdest|default(omit) }}"
color: "{{ puppet_color|default(omit) }}"
environment: "{{ puppet_environment|default(omit) }}" environment: "{{ puppet_environment|default(omit) }}"
noop: "{{ puppet_noop|default(omit) }}" noop: "{{ puppet_noop|default(omit) }}"
debug: "{{ puppet_debug|default(omit) }}" debug: "{{ puppet_debug|default(omit) }}"