Question

I am working on one-click deployment of a system onto Ubuntu machine. Just started using Puppet for this. It appears, in order for me to use external modules, I must pre-install them using something like

puppet module install foo

Questions:

  1. Do I always have to pre-install modules in order for me to use them?
  2. How do I automate Puppet modules installation?

It's a standalone puppet set up (so not a master-slave one). I will have to repeat this many times for different customers. Hence will be nice to have a single button doing all the work for me. In later stage, there is a place for master-slave setup. But it must be independent for each customer though.

Was it helpful?

Solution 2

Answering my own question.

Do I always have to pre-install modules in order for me to use them?

No, I don't. In a single node set up (masterless) the modules can be put into the --modulepath=/my-module-root path and puppet will pick them up. My problem was that the folder name for the module, did not match the class in the init.pp. For example

| modules
| -- gini_cassandra   ++ HERE ++
| ---- manifests
| ------ init.pp

Inside init.pp I had

class cassandra ...

Once I renamed gini_cassandra to cassandra things started working.

How do I automate Puppet modules installation?

As I don't need to install the modules in a masterless setup, I don't need to automate it. However, I found librarian-puppet (thanks to this answer) to be really useful. I don't need to version-control external modules. Librarian will pull them for me on both my machine, target machine where I run installation, and on the build machine.

OTHER TIPS

I'm working in a master less setup.

You should probably look at librarian-puppet You write Puppetfile describe all your modules :

  • local directory,
  • remote git,
  • puppet forge

and librarian-puppet will compute a modules directory for you.

librarian-puppet install

You can then upload it to the target machine and launch the puppet apply. It works well with vagrant also.

config.vm.provision :puppet, :module_path => "modules"

If you're using a puppet master then you only need to install modules on the master. Client machines will not need them since the master will compile their config for them.

So if there's a module you want to use, a 1 time 'puppet module install foo' on the master is all that's required.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top