On Jun 14, 2012, at 1:24 AM, Brian Gupta wrote:

> I need to install postfix on a a debian system with puppet.
> Unfortunately there are a lot of prompts. One way to deal with this
> is, is: 
> http://projects.puppetlabs.com/projects/1/wiki/Debian_Preseed_Patterns.
> Another way (apparently)  is to give an answerfile in the package
> resource declaration. (I have no idea how to do this)
> 
> e.g.:
> 
> echo postfix postfix/main_mailer_type        select  No configuration
> | debconf-set-selections
> apt-get install -y postfix
> 
> However, I'd just like to deal with this stuff from within the package
> resource declaration. Is there something simple I am missing?
> 
> I just want to install a single package install with noconfig, and
> have puppet handle the rest.
----
I don't have an issue with postfix on Ubuntu which I am sure is the Debian 
packages... (note that for postfix, I use what I describe as a 'one-shot' 
configuration setup which doesn't actually maintain the configuration files 
once they are dropped into place). I never have had an issue with interactive 
configuration.

# cat configure.pp 
# postfix::configure class
#
# Last update 07/20/2011
#
# Craig White
# 
# configures postfix
#
class postfix::configure {
  file{"/etc/puppet/deployment_files/postfix-main.cf":
    ensure    => present,
    owner     => postfix,
    group     => postfix,
    mode      => 0664,
    content   => template("postfix/main.cf.erb"),
    require   => Class["postfix::install"],
  }
  exec{"Deploy postfix/main.cf from template":
    command   => "/bin/cp /etc/postfix/main.cf /etc/postfix/main.cf-backup; 
/bin/cat /etc/puppet/deployment_files/postfix-main.cf > /etc/postfix/main.cf; 
/bin/touch /etc/puppet/deployment_files/postfix-main.cf-deployed",
    unless    => "/bin/ls -l 
/etc/puppet/deployment_files/postfix-main.cf-deployed",
    require   => [ File["/etc/puppet/deployment_files/postfix-main.cf"], 
Exec["/etc/mailname"] ],
    notify    => Class["postfix::service"],
  }
  exec { "/etc/mailname":
    command   => '/bin/echo `/bin/hostname`".ttiltd.com" > /etc/mailname',
    unless    => '/bin/ls -l 
/etc/puppet/deployment_files/postfix-main.cf-deployed',
    require   => Class["postfix::install"],
    notify    => Class["postfix::service"],
  }
}

# cat install.pp 
# postfix::install class
#
# Last update 07/20/2011
#
# Craig White
#
# ensures postfix package is installed
#
class postfix::install {
  package { ["postfix"]:
    ensure => present,
  }
  package { ["mailutils"]:
    ensure => present,
  }
  package { ["mailx"]:
    ensure => absent,
  }
}

# cat service.pp 
# postfix::service class
#
# Last update 07/20/2011
#
# Craig White
#
# ensures postfix is running
#
class postfix::service {
  service { "postfix" :
    ensure     => running,
    hasstatus  => true,
    hasrestart => true,
    enable     => true,
    require    => Class["postfix::configure"],
  }
}

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to