J'ai la recette de marionnette simple suivante:
# 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'
Où j'importe de nombreux fichiers de définition vhost (y compris la base de données) tels que:
# Apache vhost.
apache::vhost { 'foo1':
docroot => '/var/www/foo1',
directories => [
{ path => '/var/www/foo1',
allow_override => ['All'],
},
],
}
# MySQL database.
mysql_database { 'foo1':
ensure => 'present',
}
Mais le problème, c’est que l’ importation des manifestes est déconseillée et que l’avertissement rouge suivant est affiché à chaque exécution:
$ 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')
La question qui se pose est donc la suivante: quel est le moyen actuel, agréable et facile d’importer de nombreux fichiers manifest (chacun pour un vhost différent)?
Je m'attendrais à la structure suivante:
main-config.pp
includes/vhost-foo1.pp
includes/vhost-foo2.pp
includes/vhost-foo3.pp
...