community.general.puppet module – Runs puppet

Note

This module is part of the community.general collection (version 8.6.7).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install community.general. You need further requirements to be able to use this module, see Requirements for details.

To use it in a playbook, specify: community.general.puppet.

Synopsis

  • Runs puppet agent or apply in a reliable manner.

Aliases: system.puppet

Requirements

The below requirements are needed on the host that executes this module.

  • puppet

Parameters

Parameter

Comments

certname

string

The name to use when handling certificates.

confdir

string

added in community.general 5.1.0

Path to the directory containing the puppet.conf file.

debug

boolean

Enable full debugging.

Choices:

  • false ← (default)

  • true

environment

string

Puppet environment to be used.

environment_lang

string

added in community.general 8.6.0

The lang environment to use when running the puppet agent.

The default value, C, is supported on every system, but can lead to encoding errors if UTF-8 is used in the output

Use C.UTF-8 or en_US.UTF-8 or similar UTF-8 supporting locales in case of problems. You need to make sure the selected locale is supported on the system the puppet agent runs on.

Default: "C"

execute

string

Execute a specific piece of Puppet code.

It has no effect with a puppetmaster.

facter_basename

string

Basename of the facter output file.

Default: "ansible"

facts

dictionary

A dict of values to pass in as persistent external facter facts.

logdest

string

Where the puppet logs should go, if puppet apply is being used.

all will go to both console and syslog.

stdout will be deprecated and replaced by console.

Choices:

  • "all"

  • "stdout" ← (default)

  • "syslog"

manifest

string

Path to the manifest file to run puppet apply on.

modulepath

string

Path to an alternate location for puppet modules.

noop

boolean

Override puppet.conf noop mode.

When true, run Puppet agent with --noop switch set.

When false, run Puppet agent with --no-noop switch set.

When unset (default), use default or puppet.conf value if defined.

Choices:

  • false

  • true

puppetmaster

string

The hostname of the puppetmaster to contact.

show_diff

boolean

Whether to print file changes details

Choices:

  • false ← (default)

  • true

skip_tags

list / elements=string

added in community.general 6.6.0

A list of puppet tags to be excluded.

summarize

boolean

Whether to print a transaction summary.

Choices:

  • false ← (default)

  • true

tags

list / elements=string

A list of puppet tags to be used.

timeout

string

How long to wait for puppet to finish.

Default: "30m"

use_srv_records

boolean

Toggles use_srv_records flag

Choices:

  • false

  • true

verbose

boolean

Print extra information.

Choices:

  • false ← (default)

  • true

Attributes

Attribute

Support

Description

check_mode

Support: full

Can run in check_mode and return changed status prediction without modifying target.

diff_mode

Support: none

Will return details on what has changed (or possibly needs changing in check_mode), when in diff mode.

Examples

- name: Run puppet agent and fail if anything goes wrong
  community.general.puppet:

- name: Run puppet and timeout in 5 minutes
  community.general.puppet:
    timeout: 5m

- name: Run puppet using a different environment
  community.general.puppet:
    environment: testing

- name: Run puppet using a specific certname
  community.general.puppet:
    certname: agent01.example.com

- name: Run puppet using a specific piece of Puppet code. Has no effect with a puppetmaster
  community.general.puppet:
    execute: include ::mymodule

- name: Run puppet using a specific tags
  community.general.puppet:
    tags:
    - update
    - nginx
    skip_tags:
    - service

- name: Run puppet agent in noop mode
  community.general.puppet:
    noop: true

- name: Run a manifest with debug, log to both syslog and console, specify module path
  community.general.puppet:
    modulepath: /etc/puppet/modules:/opt/stack/puppet-modules:/usr/share/openstack-puppet/modules
    logdest: all
    manifest: /var/lib/example/puppet_step_config.pp

Authors

  • Monty Taylor (@emonty)