Ask Your Question

installing forge module from inside manifest

asked 2015-11-20 18:32:33 -0600

johntest gravatar image

updated 2015-11-25 13:36:24 -0600

I have a masterless setup.

I am attempting to install a forge module from inside the manifest node definition as such

node 'server4.test.local' {

  include iptables::pre
  include iptables::customrules
  include iptables::post

  exec { 'install-firewall-module':
    command => "/usr/bin/puppet module install puppetlabs-firewall",
    creates => "/etc/puppet/modules/firewall",

  Class['iptables::pre'] -> Class['iptables::customrules'] -> Class['iptables::post']

However it keeps trying the firewall class before installing the module.

Error: Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type firewall at /etc/puppet/modules/iptables/manifests/pre.pp:19 on node server4.test.local

What is the best way to go about this?

edit retag flag offensive close merge delete


Oh wait - I just noticed that you said you have a masterless setup. I need to revise my original answer. :)

GregLarkin gravatar imageGregLarkin ( 2015-11-20 20:03:56 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2015-11-20 20:03:19 -0600

GregLarkin gravatar image

updated 2015-11-24 18:48:53 -0600

You have a bootstrapping problem here, and you'll need to get all of your Puppet modules installed before you attempt to run puppet apply on the rest of your code.

I would create a bootstrap manifest that has your module install exec resources and apply that first, then apply the code that utilizes the classes and resources in the installed modules.

On the other hand, is there a reason for not moving to a master-agent configuration instead of masterless?


And one of our top PSEs, Gary Larizza, has exhaustively documented a proper workflow for setting up a master/agent configuration with git and r10k. Start at the bottom of the list and work your way up each article:

edit flag offensive delete link more


Hi John, I was thinking of some kind of shell script that you would run on each node that would do a "puppet module install ..." of each module required by your Puppet code. Then the script would follow with the "puppet apply ...." command to apply all of your resources.

GregLarkin gravatar imageGregLarkin ( 2015-11-24 18:43:03 -0600 )edit

If you wanted to write the entire thing as a Puppet .pp file, then you could issue a bunch of exec resources to call "puppet module install", then make sure they are ordered to be done before the rest of your resources. The execs could be placed in their own bootstrap manifest or not.

GregLarkin gravatar imageGregLarkin ( 2015-11-24 18:44:14 -0600 )edit

If you want to move to a standard master/agent configuration, then you want to investigate the use of a control repository and a Puppetfile to manage all of your Puppet module dependencies, be they downloaded from the Forge or private git repositories. I will update the answer above with links.

GregLarkin gravatar imageGregLarkin ( 2015-11-24 18:45:58 -0600 )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-11-20 18:32:33 -0600

Seen: 769 times

Last updated: Nov 25 '15