Add noop argument

check_mode causes other things that we may want to actually happen
(such as setting up hiera) not to run.  This way we can do all of
those but still run puppet in noop.

Change-Id: I32f07a032d28f5c5d04e9eeb50b94f7c0a57ce53
This commit is contained in:
James E. Blair 2016-09-16 12:17:01 -07:00 committed by Monty Taylor
parent 1a20bc89eb
commit b4f591b72d
No known key found for this signature in database
GPG Key ID: 7BAE94BC7141A594
2 changed files with 11 additions and 2 deletions

View File

@ -73,6 +73,13 @@ options:
required: false
default: stdout
version_added: "2.1"
noop:
description:
- Whether puppet should be run in noop mode
required: false
default: false
version_added: "2.1"
requirements: [ puppet ]
author: "Monty Taylor (@emonty)"
'''
@ -125,6 +132,7 @@ def main():
facts=dict(default=None),
facter_basename=dict(default='ansible'),
environment=dict(required=False, default=None),
noop=dict(required=False, default=False, type='bool'),
),
supports_check_mode=True,
mutually_exclusive=[
@ -187,7 +195,7 @@ def main():
cmd += " --show_diff"
if p['environment']:
cmd += " --environment '%s'" % p['environment']
if module.check_mode:
if module.check_mode or p['noop']:
cmd += " --noop"
else:
cmd += " --no-noop"
@ -199,7 +207,7 @@ def main():
cmd += "--logdest %s " % p['logdest']
if p['environment']:
cmd += "--environment '%s' " % p['environment']
if module.check_mode:
if module.check_mode or p['noop']:
cmd += "--noop "
else:
cmd += "--no-noop "

View File

@ -64,6 +64,7 @@
facter_basename: "{{ facter_basename|default(omit) }}"
logdest: "{{ puppet_logdest|default(omit) }}"
environment: "{{ puppet_environment|default(omit) }}"
noop: "{{ puppet_noop|default(omit) }}"
- always:
- name: find logs
shell: "ls -tr /var/lib/puppet/reports/{{ ansible_fqdn }}/*_puppetdb.json"