简体   繁体   中英

How to use puppet modules in puppet client?

I have search many puppet module problem and seen the answer but still it doesn't solve my problem. I am new to puppet and have install puppet master and client. My /etc/puppet/manifests/site.pp contains

node 'dn1.test.com'{
        include custom_utils
}
node 'client.test.com'{
        include custom_utils
}
class custom_utils {
package { ["nmap","telnet","vim-enhanced","traceroute"]:
        ensure => latest,
        allow_virtual => false,
        }
}

and when I run

puppet agent -t

the puppet client works fine and install all the packages.

Now when I try to test modules I am not able to do it.

After installing module

puppet module install puppetlabs-mysql

my puppet module shows

    puppet module list
/etc/puppet/modules
├── nanliu-staging (v1.0.3)
├── puppetlabs-mysql (v3.3.0)
└── puppetlabs-stdlib (v4.6.0)
/usr/share/puppet/modules (no modules installed)

and I make changes to above site.pp as recommended in this sites as below

    node 'dn1.test.com'{
        include custom_utils
}

node 'client.test.com'{
        include custom_utils
        require puppetlabs-mysql
}
class custom_utils {
package { ["nmap","telnet","vim-enhanced","traceroute"]:
        ensure => latest,
        allow_virtual => false,
        }
}

But when i run puppet client

puppet agent -t

I get

Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find class puppetlabs-mysql for client.test.com on node client.test.com
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

What else do I have to do, any idea you provide will be very helpful. Thank you very much for your help.

Did you read the description how to use puppet mysql module ?

Puppet behaves as expected. First you have properly installed puppet-mysql module. Next to use it, you cannot just write:

require puppetlabs-mysql

Depend on what you need, you must use resources defined by that module. Eg

If you want a server installed with the default options you can run include '::mysql::server'.

All interaction for the server is done via mysql::server. To install the client, use mysql::client. To install bindings, use mysql::bindings.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM