From 7fff1b962c498af398d23bdb177a5dba8b1b30d6 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Thu, 21 Jan 2016 14:19:10 -0800 Subject: [PATCH] Log puppet to syslog instead of json Stop sending the complete puppet output back via json. Do send it to local syslog instead. This is mostly because right now all of our puppet output is going into a single very long json line in our log file. Change-Id: Ie6d2d82def95ef2bb79ae862707218a44e0138ca --- library/puppet | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/library/puppet b/library/puppet index d4f69b1..03e269a 100644 --- a/library/puppet +++ b/library/puppet @@ -183,7 +183,7 @@ def main(): else: cmd += " --no-noop" else: - cmd = "%s apply --detailed-exitcodes " % base_cmd + cmd = "%s apply --detailed-exitcodes --logdest syslog" % base_cmd if p['environment']: cmd += "--environment '%s' " % p['environment'] if module.check_mode: @@ -195,7 +195,7 @@ def main(): if rc == 0: # success - module.exit_json(rc=rc, changed=False, stdout=stdout) + module.exit_json(rc=rc, changed=False) elif rc == 1: # rc==1 could be because it's disabled # rc==1 could also mean there was a compilation failure @@ -206,19 +206,18 @@ def main(): msg = "puppet did not run" module.exit_json( rc=rc, disabled=disabled, msg=msg, - error=True, stdout=stdout, stderr=stderr) + error=True) elif rc == 2: # success with changes - module.exit_json(rc=0, changed=True, stdout=stdout, stderr=stderr) + module.exit_json(rc=0, changed=True) elif rc == 124: # timeout module.exit_json( - rc=rc, msg="%s timed out" % cmd, stdout=stdout, stderr=stderr) + rc=rc, msg="%s timed out" % cmd) else: # failure module.fail_json( - rc=rc, msg="%s failed with return code: %d" % (cmd, rc), - stdout=stdout, stderr=stderr) + rc=rc, msg="%s failed with return code: %d" % (cmd, rc)) # import module snippets from ansible.module_utils.basic import *