Puppet cannot find the module I just installed

The problem that I discovered is that I can successfully install Puppet modules. For instance:

[puppet@swarmcritic ~]$ puppet module install puppetlabs/mysql
Notice: Preparing to install into /home/puppet/.puppet/modules ...
Notice: Created target directory /home/puppet/.puppet/modules
Notice: Downloading from https://forge.puppetlabs.com ...
Notice: Installing -- do not interrupt ...
/home/puppet/.puppet/modules
└─┬ puppetlabs-mysql (v2.1.0)
  └── puppetlabs-stdlib (v4.1.0)

But when I try to call the module using the node.pp file as follows:

 node 'example.com' {
    include '::mysql::server'
 }

Then I get the error message:

[puppet@example mysql]$ sudo puppet apply ~puppet/puppet/manifests/site.pp
Error: Could not find class ::mysql::server for example.com on node example.com
Error: Could not find class ::mysql::server for example.com on node example.com

How can i fix this?

+3
source share
3 answers

Puppet installed the module in the .puppet directory of my home directory tree, but did not look there when it was time to look for the module! Instead, he ONLY looked at / etc / puppet / modules. It seems that by default it only looks there. If you want it to look in ~ myusername / .puppet, you need to configure the path variable in /etc/puppet/puppet.conf or something like that.

, , . /etc/puppet/modules, :

sudo puppet module install -i /etc/puppet/modules puppetlabs/mysql

, .

, Puppet -i root, /etc/puppet/modules, root, ~ myusername/.puppet/modules/. , sudo :

sudo puppet module install puppetlabs/mysql

. -i!

- , , . , Puppet () /etc/puppet/modules, . , , sudo, ~ myusername/.puppet. , , ~ myusername/.puppet, . , Puppet.

. , sudo .

OP.

+4

, :

# puppet config print modulepath
/etc/puppetlabs/puppet/modules:/opt/puppet/share/puppet/modules

...

https://puppetlabs.com/learn/autoloading

+2

, :

(3,6 ), modulepath conf (/etc/puppet/puppet.conf) puppet module list , , .

(/etc/puppet puppet 4.0 /etc/puppetlabs/code 4.0 ) environment.conf. (puppet module list), , .

+1
source

All Articles