define mail::opendkim::key() { file { "/etc/opendkim/keys/${name}" : ensure => directory, owner => 'opendkim', group => 'opendkim', mode => '0750', require => File['/etc/opendkim/keys'], } exec { "opendkim-genkey-${name}": command => "opendkim-genkey -s mail -d ${name}", cwd => "/etc/opendkim/keys/${name}", user => root, group => root, creates => "/etc/opendkim/keys/${name}/mail.private", require => [ File["/etc/opendkim/keys/${name}"], Package['opendkim-tools'] ], } }