Add module parameter to control Puppet agent noop switch (#43678)
* Puppet agent noop switch Add module parameter to control noop switch Current module overrides puppet.conf noop setting by forcing '--no-noop' switch which may not be expected or desired. Add parameter to allow user control. noop: Undefined - Use agent configuration noop: true - Add --noop switch to cmd noop: false - Add --no-noop switch to cmd Ansible check mode always runs with --noop switch * Update lib/ansible/modules/system/puppet.py Co-Authored-By: matonb <matonb@ltresources.co.uk> Co-Authored-By: matonb <matonb@ltresources.co.uk> Co-Authored-By: matonb <matonb@ltresources.co.uk>
This commit is contained in:
parent
bb6a82d2a9
commit
6291efd4ea
1 changed files with 22 additions and 4 deletions
|
@ -32,6 +32,13 @@ options:
|
|||
manifest:
|
||||
description:
|
||||
- Path to the manifest file to run puppet apply on.
|
||||
noop:
|
||||
description:
|
||||
- Override puppet.conf noop mode.
|
||||
- Undefined, use default or puppet.conf value if defined.
|
||||
- true, Run Puppet agent with C(--noop) switch set.
|
||||
- false, Run Puppet agent with C(--no-noop) switch set.
|
||||
version_added: "2.8"
|
||||
facts:
|
||||
description:
|
||||
- A dict of values to pass in as persistent external facter facts.
|
||||
|
@ -104,6 +111,10 @@ EXAMPLES = '''
|
|||
puppet:
|
||||
tags: update,nginx
|
||||
|
||||
- name: Run puppet agent in noop mode
|
||||
puppet:
|
||||
noop: true
|
||||
|
||||
- name: Run a manifest with debug, log to both syslog and stdout, specify module path
|
||||
puppet:
|
||||
modulepath: /etc/puppet/modules:/opt/stack/puppet-modules:/usr/share/openstack-puppet/modules
|
||||
|
@ -148,6 +159,7 @@ def main():
|
|||
puppetmaster=dict(type='str'),
|
||||
modulepath=dict(type='str'),
|
||||
manifest=dict(type='str'),
|
||||
noop=dict(required=False, type='bool'),
|
||||
logdest=dict(type='str', default='stdout', choices=['stdout',
|
||||
'syslog',
|
||||
'all']),
|
||||
|
@ -230,6 +242,9 @@ def main():
|
|||
cmd += " --certname='%s'" % p['certname']
|
||||
if module.check_mode:
|
||||
cmd += " --noop"
|
||||
elif 'noop' in p:
|
||||
if p['noop']:
|
||||
cmd += " --noop"
|
||||
else:
|
||||
cmd += " --no-noop"
|
||||
else:
|
||||
|
@ -248,6 +263,9 @@ def main():
|
|||
cmd += " --tags '%s'" % ','.join(p['tags'])
|
||||
if module.check_mode:
|
||||
cmd += "--noop "
|
||||
elif 'noop' in p:
|
||||
if p['noop']:
|
||||
cmd += " --noop"
|
||||
else:
|
||||
cmd += " --no-noop"
|
||||
if p['execute']:
|
||||
|
|
Loading…
Reference in a new issue