[Mageia-sysadm] Packaging puppet modules

nicolas vigier boklm at mars-attacks.org
Fri Mar 25 02:05:10 CET 2011


Hello,

We have now created a lot of puppet modules for different things used
on Mageia servers. And I think many of them could be useful for other
people installing servers. They are already available on our svn server,
but I think we can do something better, to make them easier to use.

When trying to use puppet modules from other people that I found on the
internet, I usually have the following problems :
 - modules are made for other distributions
 - modules have dependencies on other modules, and it is not easy to see
   which ones
 - sometimes they can have dependency on an other module doing something
   that you already do with a different module (for instance there is many
   different apache httpd modules)
 - modules come from unknow people, so you have to check them carefully
   before using them
 - you need to modify them to do what you want, because there often is
   a lot of hardcoded values everywhere

So I think it could be interesting to provide some modules for Mageia,
and distribute them as packages, doing the same as what we do for other
software.

We could do something like this :
 - one package per module
 - modules installed in /usr/share/puppet/modules
 - use rpm find-requires and find-provides to automatically manage
   dependencies between modules
 - remove any hardcoded values from modules, but use parameterised
   classes, so you don't have to modify modules to use them
 - setup puppet so that someone who wants to overwrite a module installed
   by a package can create one with the same name in /etc/puppet/modules.
   Or overwrite one template file.

Then people using Mageia will be able to install puppet modules that
are known to work with Mageia.

For instance, someone who wants to install a wordpress blog with a mysql
database on a second server could do something like this very quickly :

# urpmi puppet-wordpress puppet-mysql
# cat > /etc/puppet/manifests/site.pp <<EOF
node server1 {
  class { mysql::server:
     dbtype => "innodb"
  }
  class { mysql::dbuser:
     dbuser => 'wordpress',
     dbpassword => 'password',
  }
}
node server2 {
  class { wordpress:
     hostname => 'blog.example.com',
     dbtype => 'mysql',
     dbhost => 'server1.example.com',
     dbuser => 'wordpress',
     dbpassword => 'password',
  }
}
EOF

Or someone who wants to setup a Mageia buildsystem to build his own
packages :
# urpmi puppet-mgabuildsystem
# cat > /etc/puppet/manifests/site.pp <<EOF
node mainnode {
   class { mgabuildsystem::mainnode:
      distribname => "My Distribution",
      domain => "mydistribution.org",
      ...
   }
}
...
EOF

Those module could also be used locally by some tools. For instance if
we want to create a graphical tool like drakwizard, to setup some software
on a machine. This graphical interface would ask some parameters, then
install the corresponding puppet modules, generate a puppet file
containing the parameters entered and run puppet on it locally.

However compared to what we do currently :
 - it will be more work, to avoid hardcoding anything
 - modules can become more complexe if they support more things
 - we will have to be careful when changing API of released modules, or
   write it in release notes so users of the packages know what they need
   to change when updating to a newer release of the distribution.

So it is more work, but I think it can be worth it. We can maybe convince
other Mageia packagers to help write puppet modules for the software
they package.

A distribution providing puppet modules for many software would allow
someone to install one or many servers very quickly and easily, and I
think it would be very nice.

Maybe this is something that could be done for Mageia release 2 or later.
So I plan to try to see if/how this could be done.

What do you think ?



More information about the Mageia-sysadm mailing list