Puppet Error Could ...
Notifications
Clear all

Puppet Error Could not find class mysql server for example com on node example com

RSS

(@ganesh)
Noble Member
加入:2年ago
Posts: 1362
18/05/2021 11:48 am

I get the following error when I'm trying to invoke a module using anodes.pp file like this:

node 'example.com' { include '::mysql::server' } [[email protected]mysql]$ sudo puppet apply ~puppet/puppet/manifests/site.pp Error: Could not find class ::mysql::server for example.com on node example.com

But I have installed the modules successfully,

[[email protected]~]$ 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)

How do I fix this error?


Quote
(@anamika)
Noble Member
加入:2年ago
Posts: 1381
18/05/2021 11:49 am
  • This might be because you might not be logged in as arootuser.

  • If you had worked in the root account, Puppet would (presumably) have installed the module into /etc/puppet/modules and there would have been no problem.

  • It's only because you might have created auseraccount and then invoked the puppet module install command withoutsudothat the modules ended up in ~myusername/.puppet.

  • To solve the problem, Instead of trying to modify the Puppet path, you could install the module explicitly into /etc/puppet/modules using the following command:

sudo puppet module install -i /etc/puppet/modules puppetlabs/mysql
  • Now puppet apply would work fine.

  • Further if you execute the Puppet module install command with no -i argument and root access, it will install the module into /etc/puppet/modules, but if you don't have root access, it will install it into ~myusername/.puppet/modules/.

  • Put a sudo in front of the original module installation command like this:

sudo puppet module install puppetlabs/mysql
  • Now there won't be any problem. You don't have to specify the -i argument!.


ReplyQuote
Share:
Baidu