From 05464816c2ee777f5d7e4eec5c3199733b1b0f10 Mon Sep 17 00:00:00 2001 From: Aleksej Romanov Date: Thu, 4 Oct 2012 17:43:25 +0700 Subject: [PATCH] Different return codes for different errors. --- bin/ansible | 4 ++-- bin/ansible-playbook | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/ansible b/bin/ansible index 906bfe5bbcf..0b0b536679c 100755 --- a/bin/ansible +++ b/bin/ansible @@ -129,9 +129,9 @@ if __name__ == '__main__': (runner, results) = cli.run(options, args) for result in results['contacted'].values(): if 'failed' in result or result.get('rc', 0) != 0: - sys.exit(1) + sys.exit(2) if results['dark']: - sys.exit(1) + sys.exit(2) except errors.AnsibleError, e: # Generic handler for ansible specific errors print "ERROR: %s" % str(e) diff --git a/bin/ansible-playbook b/bin/ansible-playbook index 954d2c32419..64d5ee66e50 100755 --- a/bin/ansible-playbook +++ b/bin/ansible-playbook @@ -143,7 +143,7 @@ def main(args): for h in hosts: stats = pb.stats.summarize(h) if stats['failures'] != 0 or stats['unreachable'] != 0: - sys.exit(1) + return 2 except errors.AnsibleError, e: print >>sys.stderr, "ERROR: %s" % e