diff --git a/deployment/puppet/osnailyfacter/manifests/tools/tools.pp b/deployment/puppet/osnailyfacter/manifests/tools/tools.pp index 4fd2dcad6d..916045af90 100644 --- a/deployment/puppet/osnailyfacter/manifests/tools/tools.pp +++ b/deployment/puppet/osnailyfacter/manifests/tools/tools.pp @@ -24,6 +24,27 @@ class osnailyfacter::tools::tools { class { '::osnailyfacter::ssh': } + ensure_packages(['postfix']) + + service { 'postfix': + ensure => running, + enable => true, + require => Package['postfix'], + } + + augeas { 'configure postfix': + context => '/files/etc/postfix/main.cf', + changes => [ + "set /files/etc/postfix/main.cf/mydestination ${::fqdn},localhost", + "set /files/etc/postfix/main.cf/myhostname ${::fqdn}", + 'set /files/etc/postfix/main.cf/inet_interfaces loopback-only', + 'set /files/etc/postfix/main.cf/default_transport error', + 'set /files/etc/postfix/main.cf/relay_transport error', + ], + notify => Service['postfix'], + require => Package['postfix'], + } + if $::virtual != 'physical' { class { '::osnailyfacter::acpid': } } diff --git a/tests/noop/spec/hosts/tools/tools_spec.rb b/tests/noop/spec/hosts/tools/tools_spec.rb index eff261308f..f87a2d9273 100644 --- a/tests/noop/spec/hosts/tools/tools_spec.rb +++ b/tests/noop/spec/hosts/tools/tools_spec.rb @@ -68,6 +68,21 @@ describe manifest do ) end + it 'should configure postfix with correct settings' do + should contain_package('postfix') + should contain_service('postfix') + should contain_augeas('configure postfix').with( + 'context' => '/files/etc/postfix/main.cf', + 'changes' => [ + "set /files/etc/postfix/main.cf/mydestination #{facts[:fqdn]},localhost", + "set /files/etc/postfix/main.cf/myhostname #{facts[:fqdn]}", + "set /files/etc/postfix/main.cf/inet_interfaces loopback-only", + "set /files/etc/postfix/main.cf/default_transport error", + "set /files/etc/postfix/main.cf/relay_transport error", + ], + ).that_notifies('Service[postfix]') + end + it 'should declare osnailyfacter::acpid on virtual machines' do facts[:virtual] = 'kvm' should contain_class('osnailyfacter::acpid')