What to use instead of import keyword

puppet

I'm using the following sample manifest from camptocamp/puppet-nagios:

node 'central_monitoring_server' {
  import "nagios"

  $nagiosadmin_password = "XXXX"

  ...

  include apache::base

  include nagios::base
  include nagios::nsca::daemon
  include nagios::webinterface
} 

However I've the warning:

Warning: The use of 'import' is deprecated at nagios.pp. See http://links.puppetlabs.com/puppet-import-deprecation

I've followed the link which says:

New users should avoid the import keyword, and existing users should
stop using it. Instead, do the following:

  • To keep your node definitions in separate files, specify a directory as your main manifest.
  • To load classes and defined types, use modules.

Together, these two features replace import completely.

However this is not clear what actually I should do.

Can I just use the include keyword instead of import as:

include nagios

Is that all? Is that should work in the same way?

I'm using puppet v3.7.4.

Best Answer

The import keyword was actually designed to import manifests, not classes, as explained here.

Now that Puppet has evolved and introduced autoloaded modules and a saner directory structure, this functionality is no longer needed, and you should use include instead.