Ask Your Question

How to run puppet module

asked 2015-10-13 15:31:49 -0500

drm509 gravatar image

updated 2015-10-13 15:59:54 -0500

For the life of me I can't figure out how to refresh puppet or maybe I'm not installing the module correctly. Here are my steps:

puppet module generate drm-lumberjack_conf

I write some code under manifests/init.pp which will create /var/tmp/lumberjack.conf then continue with module installation

puppet module build /home/drm/gitrepo/puppet/lumberjackconf
puppet module install /home/drm/gitrepo/puppet/lumberjack
puppet apply /home/amocanu/gitrepo/puppet/lumberjack

Do I need to both install a module and apply it? Makes no sense to me, a developer.

I restart puppet agent:
sudo /usr/local/bin/puppet agent --test --noop

I check to see if /var/tmp/lumberjack.conf has been created. It never gets created.
What am I missing?

PS - someone pointed out that I need to configure nodes to look for the new module. What does that mean?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2015-10-13 15:48:06 -0500

lupin gravatar image

updated 2015-10-13 17:05:21 -0500

You missed a lot, download the free learn VM

If you just wanted an instant result of your manifest without writing a module you can do it with puppet apply <manifest>.pp. However if you wanted to go further and organise your manifest->classes->modules, then you need the following steps.

** create a module skeleton
puppet module generate your-module_name
mv your-module_name module_name

** edit your module to add classes/manifest
vim  your-module/manifest/init.pp

** apply/test your module
puppet apply your-module/test/init.pp

After that, you're quite ecstatic and wanted to build your module into Forge ready archive, you do.

puppet module build module_name
edit flag offensive delete link more


your steps are the same as mine.

drm509 gravatar imagedrm509 ( 2015-10-13 15:54:14 -0500 )edit

sorry, I've edited the apply/test portion.

lupin gravatar imagelupin ( 2015-10-13 17:05:01 -0500 )edit

I never put anything in the test folder. Isn't that for testing your code. I'

drm509 gravatar imagedrm509 ( 2015-10-14 09:06:02 -0500 )edit

I figured it out! So what needs to be applied is not the files in manifests folder, but those in tests.

drm509 gravatar imagedrm509 ( 2015-10-14 10:09:15 -0500 )edit

Yes, basically you need to declare your defined class to be able to call/use it. The statement "include class_name" in test/init.pp is how you declare it . For further example you can add a "include <class_name> on your manifest/init.pp and call it using `puppet apply`.

lupin gravatar imagelupin ( 2015-10-14 14:51:52 -0500 )edit

Your Answer

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

Add Answer

Question Tools

1 follower


Asked: 2015-10-13 15:31:49 -0500

Seen: 534 times

Last updated: Oct 13 '15