Ask Your Question

Why isn't there a way to 'puppet agent -t' for a single module?

asked 2018-07-05 11:28:35 -0500

lcraider3 gravatar image

Often I want to change a template and reapply it to a node, but to do so I run 'puppet agent -t' which runs everything. It seems like such a common need.

edit retag flag offensive close merge delete

3 Answers

Sort by » oldest newest most voted

answered 2018-07-09 08:52:02 -0500

sirinek gravatar image

The issue is that modules can call out to other modules either via include statements or using resource-style calls, and you may end up executing code you were not intending to.

We'll do puppet runs using tags for this purpose. It's not perfect, but it works for most cases.

puppet agent -tv --tags=<comma delimited tag list>

This way, only the classes that match the tags specified will run. Everything else is skipped. Be sure to read the documentation carefully about how tag names are determined.

edit flag offensive delete link more


Nice answer! I have a passing familiarity with tags, but haven't ever really used them!

DarylW gravatar imageDarylW ( 2018-07-09 09:04:40 -0500 )edit

Thank you! I've seen (and created) tags within modules and didn't really know I could use them for this. Greatly appreciated!

lcraider3 gravatar imagelcraider3 ( 2018-07-12 12:50:58 -0500 )edit

answered 2018-07-06 09:03:30 -0500

DarylW gravatar image

A module is like a function - if you don't pass it parameters (via hiera, direct calls in roles and profiles, etc) then you are only applying the default configuration. If there were some 'way' to do a puppet agent -t for a single module, you would also need to give it the right 'context' to do what it needs to do.

One thing that I had done in the past was to create a minimal pp file, or if it was just invoking a module I would use the -e argument for adding a puppet 'expression'. i.e. if you have a module, loaded on the instance you are working, and you want to apply the defaults that it can reference, you can do puppet apply -e 'include "myclass" ' to run a 'single module' on a node. Granted that you have to have a copy of your module on the node and configure the --modulepath, etc, to point at them.

edit flag offensive delete link more

answered 2018-07-09 13:21:50 -0500

greynolds gravatar image

puppet apply -e 'include "myclass" -> seems to work if R10 or your architecture for your module path is local to the puppet master without dependencies.

puppet agent -tv --tags=<comma delimited="" tag="" list=""> -> seems to work within the environment parameters for example:

puppet module generate --type --environment Dev -> should be set before running the previous command

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2018-07-05 11:28:35 -0500

Seen: 93 times

Last updated: Jul 09