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

0 votes

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

 node 'example.com' {
    include '::mysql::server'
 }
[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

But I have installed the modules successfully,

[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)

How do i fix this error?

Aug 8 in Puppet by Alice
83 views

1 answer to this question.

0 votes
  • This might be because you might not be logged in as a root user. 

  • 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 a user account and then invoked the puppet module install command without sudo that 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!.

answered Aug 8 by Sirajul
• 40,980 points

Related Questions In Puppet

0 votes
1 answer

Error: Could not find init script for 'puppet' - Puppet error

You need to be running your processes ...READ MORE

answered Mar 12 in Puppet by Haider
214 views
0 votes
1 answer
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
245 views
0 votes
1 answer
0 votes
1 answer

Error: Could not find class git::config for xxxx on node xxxx

You should note that you cannot call include on git::config. git::config is a ...READ MORE

answered Jul 31 in Puppet by Sirajul
• 40,980 points
74 views