Proper way of importing many manifest files with vhost definitions

0

I have the following simple puppet recipe:

# Apache

class { 'apache':
  mpm_module => 'prefork', # Determines which MPM is loaded and configured for the HTTPD process (event, itk, peruser, prefork, worker or false).
}

include apache::mod::prefork # Implements a non-threaded, pre-forking web server
include apache::mod::rewrite # Provides a rule-based rewriting engine to rewrite requested URLs on the fly.
include apache::mod::expires # Generation of Expires and Cache-Control HTTP headers according to user-specified criteria.
include apache::mod::headers # Customization of HTTP request and response headers.
include apache::mod::php     # Installs and configures mod_php.

# MySQL
# Note: mysql module will manage all the restarts needed after all the configuration changes.
class { '::mysql::server':
  root_password    => 'root', # Sets MySQL root password.
  override_options => {
    'mysqld' => {
      'log' => 'ON',
    }
  }
}

# Import many manifest files with vhost definitions.
import 'vhosts/*.pp'

Where I'm importing many vhost definition files (including database) such as:

# Apache vhost.
apache::vhost { 'foo1':
  docroot => '/var/www/foo1',
  directories  => [
    { path           => '/var/www/foo1',
      allow_override => ['All'],
    },
  ],
}

# MySQL database.
mysql_database { 'foo1':
  ensure  => 'present',
}

But the problem is, that Importing Manifests is deprecated and I've the following red warning every time it's ran:

$ sudo puppet apply foo.pp 
Warning: The use of 'import' is deprecated at foo.pp:49. See http://links.puppetlabs.com/puppet-import-deprecation
   (at /usr/lib/ruby/vendor_ruby/puppet/parser/parser_support.rb:110:in `import')

Therefore the question is, what is the current, nice and easy way of importing many manifest files (each for different vhost)?

I would expect the following structure:

main-config.pp
includes/vhost-foo1.pp
includes/vhost-foo2.pp
includes/vhost-foo3.pp
...

kenorb

Posted 2014-10-02T13:29:44.783

Reputation: 16 795

Answers

1

From the link you posted, the recommended way is to define the vhosts in classes and include those (in the node manifest or through an ENC), or manually define each vhost for each node (in the node manifest)>

T0xicCode

Posted 2014-10-02T13:29:44.783

Reputation: 181