Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.
package { 'mailman':
  ensure  => installed,
  require => Package['exim4'],
}
maillist { 'mailman':
  ensure      => 'present',
  admin       => $admin,
  description => 'Site list',
  password    => $master_password,
  require     => Package['mailman'],
}

If package "mailman" has not been installed, then puppet complains that it "Could not find a default provider for maillist". It seems it considers this to be an error in the manifest, because it aborts entirely and does not apply any configuration. As a result, it does not process the "package { 'mailman': ... }" directive, which means it does not install mailman. I need to comment out the maillist directive, then apply the configuration so that mailman is installed, then uncomment and reapply. But this is not satisfactory.

How can I do it in a better way?

share|improve this question
    
What happens if you specify provider => mailman in mailist {} define? –  rvs Mar 7 '12 at 17:08
    
Again, it doesn't work. I don't remember if the error message is exactly the same, however it can't find the mailman provider. –  Antonis Christofides Mar 7 '12 at 17:34
add comment

2 Answers

up vote 4 down vote accepted

There was a fix in Puppet 2.7.8, for issue #6907 that enables a provider to be installed or synchronised during the run that it's being used in (subject to normal dependencies being specified). See the 2.7.8 release notes too.

You should find it fixes this case, allowing you to install the Mailman dependency for the maillist provider during the same run.

share|improve this answer
    
Thanks. I'm using 2.7.6 from squeeze-backports. (testing has 2.7.11 - I wonder if backports get updated.) –  Antonis Christofides Mar 8 '12 at 14:50
add comment

One simple thing you could do is create a custom fact that will report if mailman is installed on your system. Just have the fact return true or false depending on the presence of the binary.

Then just add a conditional to your your manifest.

if (true = $gotmailman)
{
    maillist { 'mailman':
      ensure      => 'present',
      admin       => $admin,
      description => 'Site list',
      password    => $master_password,
      require     => Package['mailman'],
    }
}
share|improve this answer
    
I guess you meant to have the "maillist" inside the "if", not the "package"? –  Antonis Christofides Mar 7 '12 at 17:33
    
Yeah, sorry about that. –  Zoredache Mar 7 '12 at 17:49
    
Thanks, this is a useful tip until I upgrade Puppet to 2.7.8 or later. –  Antonis Christofides Mar 8 '12 at 14:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.