Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
P
Puppet Camptocamp Postfix
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Projets publics
Puppet Camptocamp Postfix
Commits
303e06ba
Commit
303e06ba
authored
Jan 22, 2020
by
Bodenhaltung
Committed by
Raphaël Pinson
Jan 22, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add the possibility to manage (or not) aliases (#271)
parent
33604bd1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
11 deletions
+60
-11
manifests/files.pp
manifests/files.pp
+9
-6
manifests/init.pp
manifests/init.pp
+3
-0
manifests/service.pp
manifests/service.pp
+10
-5
spec/acceptance/postfix_spec.rb
spec/acceptance/postfix_spec.rb
+38
-0
No files found.
manifests/files.pp
View file @
303e06ba
...
...
@@ -15,6 +15,7 @@ class postfix::files {
$master_bounce_command
=
$postfix::master_bounce_command
$master_defer_command
=
$postfix::master_defer_command
$myorigin
=
$postfix::myorigin
$manage_aliases
=
$postfix::manage_aliases
$manage_root_alias
=
$postfix::manage_root_alias
$root_mail_recipient
=
$postfix::root_mail_recipient
$chroot
=
$postfix::chroot
...
...
@@ -45,12 +46,14 @@ class postfix::files {
}
# Aliases
file
{
'/etc/aliases'
:
ensure
=>
'file'
,
content
=>
"# file managed by puppet
\n
"
,
notify
=>
Exec
[
'newaliases'
],
replace
=>
false
,
seltype
=>
$postfix::params::aliasesseltype
,
if
$manage_aliases
{
file
{
'/etc/aliases'
:
ensure
=>
'file'
,
content
=>
"# file managed by puppet
\n
"
,
notify
=>
Exec
[
'newaliases'
],
replace
=>
false
,
seltype
=>
$postfix::params::aliasesseltype
,
}
}
# Config files
...
...
manifests/init.pp
View file @
303e06ba
...
...
@@ -54,6 +54,8 @@
#
# [*myorigin*] - (string)
#
# [*manage_aliases*] - (boolean) Manage /etc/aliases file
#
# [*relayhost*] - (string)
#
# [*root_mail_recipient*] - (string)
...
...
@@ -109,6 +111,7 @@ class postfix (
String
$mydestination
=
'$myorigin'
,
# postfix_mydestination
String
$mynetworks
=
'127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128'
,
# postfix_mynetworks
String
$myorigin
=
$::fqdn
,
Boolean
$manage_aliases
=
true
,
# /etc/aliases
Optional
[
String
]
$relayhost
=
undef
,
# postfix_relayhost
Boolean
$manage_root_alias
=
true
,
Variant
[
Array
[
String
],
String
]
$root_mail_recipient
=
'nobody'
,
# root_mail_recipient
...
...
manifests/service.pp
View file @
303e06ba
class
postfix::service
{
$manage_aliases
=
$postfix::manage_aliases
exec
{
'restart postfix after packages install'
:
command
=>
regsubst
(
$::postfix::params::restart_cmd
,
'reload'
,
'restart'
),
refreshonly
=>
true
,
...
...
@@ -12,11 +15,13 @@ class postfix::service {
restart
=>
$::postfix::params::restart_cmd
,
}
# Aliases
exec
{
'newaliases'
:
command
=>
'/usr/bin/newaliases'
,
refreshonly
=>
true
,
subscribe
=>
File
[
'/etc/aliases'
],
require
=>
Service
[
'postfix'
],
if
$manage_aliases
{
exec
{
'newaliases'
:
command
=>
'/usr/bin/newaliases'
,
refreshonly
=>
true
,
subscribe
=>
File
[
'/etc/aliases'
],
require
=>
Service
[
'postfix'
],
}
}
if
$::osfamily
==
'RedHat'
{
alternatives
{
'mta'
:
...
...
spec/acceptance/postfix_spec.rb
View file @
303e06ba
...
...
@@ -39,5 +39,43 @@ describe 'postfix class' do
it
{
is_expected
.
to
be_enabled
}
it
{
is_expected
.
to
be_running
}
end
describe
file
(
'/etc/aliases'
)
do
it
{
is_expected
.
to
exist
}
end
end
context
'default parameters with manage_aliase as false'
do
it
'should work idempotently with no errors and with your own configuration of /etc/aliases '
do
pp
=
<<-
EOS
# Make sure the default mailer is stopped in docker containers
if $::operatingsystem == 'Debian' {
service { 'exim4':
ensure => stopped,
hasstatus => false,
before => Class['postfix'],
}
}
if $::osfamily == 'RedHat' {
service { 'sendmail':
ensure => stopped,
hasstatus => false,
before => Class['postfix'],
}
}
class { 'postfix':
smtp_listen => 'all',
manage_aliases => false,
}
EOS
# Run it twice and test for idempotency
apply_manifest
(
pp
,
:catch_failures
=>
true
)
apply_manifest
(
pp
,
:catch_changes
=>
true
)
end
describe
file
(
'/etc/aliases'
)
do
it
{
is_expected
.
not_to
exist
}
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment