From 0505f79daa659cd4c5da0ca7f5cf03ead93ffefa Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Tue, 21 Apr 2020 16:04:48 -0500 Subject: [PATCH] Add color parameter When we're logging inside of ansible, turning off ansi colors can be nice. Especially inside of Zuul. Change-Id: I719ebb106fbb31795cc02c9504507bdae607bcdd --- library/puppet | 3 +++ tasks/main.yaml | 1 + 2 files changed, 4 insertions(+) diff --git a/library/puppet b/library/puppet index be79afe..63791e9 100644 --- a/library/puppet +++ b/library/puppet @@ -167,6 +167,7 @@ def main(): facter_basename=dict(default='ansible'), environment=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'), execute=dict(required=False, default=None), noop=dict(required=False, default=False, type='bool'), @@ -254,6 +255,8 @@ def main(): cmd += " --tags '%s'" % ','.join(p['tags']) if p['certname']: cmd += " --certname='%s'" % p['certname'] + if p['color']: + cmd += " --color='%s'" % p['color'] if module.check_mode or p['noop']: # Noop causes detailed-exitcodes to sometimes erroneously # return failures, so we only set detailed-exitcodes when diff --git a/tasks/main.yaml b/tasks/main.yaml index e510826..767f6eb 100644 --- a/tasks/main.yaml +++ b/tasks/main.yaml @@ -135,6 +135,7 @@ facts: "{{ facts|default(omit) }}" facter_basename: "{{ facter_basename|default(omit) }}" logdest: "{{ puppet_logdest|default(omit) }}" + color: "{{ puppet_color|default(omit) }}" environment: "{{ puppet_environment|default(omit) }}" noop: "{{ puppet_noop|default(omit) }}" debug: "{{ puppet_debug|default(omit) }}"