Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
base
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
puppetpublic
base
Commits
ee4494ef
Commit
ee4494ef
authored
8 years ago
by
Karl Kornel
Browse files
Options
Downloads
Patches
Plain Diff
postfix::sender: New type
parent
62854b4c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
manifests/postfix/sender.pp
+48
-0
48 additions, 0 deletions
manifests/postfix/sender.pp
with
48 additions
and
0 deletions
manifests/postfix/sender.pp
0 → 100644
+
48
−
0
View file @
ee4494ef
# Many systems send emails "From" root@system-name. That causes problems when
# an email is bounced. This type is used to have Postfix change the sender
# address of an email while it is in flight. Both the From: header and the
# envelope sender are changed.
#
# Example of how to set a sender:
#
# base::postfix::sender { 'root@stanford.edu':
# ensure => 'noreply@stanford.edu'
# }
#
# Example of how to ensure there is no sender map:
#
# base::postfix::sender { 'luke': ensure => absent }
#
# Assumes that a command 'postmap hash:$file' has been defined that will
# rebuild the senders map.
define
base::postfix::sender
(
$ensure
,
$file
=
'/etc/postfix/senders'
)
{
$pattern
=
"'^
${name}
'"
case
$ensure
{
'absent'
:
{
exec
{
"rm-sender-
${name}
"
:
command
=>
"sed -i -e '/^
${name}
/d'
${file}
"
,
onlyif
=>
"grep
${pattern}
${file}
"
,
notify
=>
Exec
[
"postmap hash:
${file}
"
]
}
}
default
:
{
$line
=
"
${name}
${ensure}
"
exec
{
"add-sender-
${name}
"
:
command
=>
"echo '
${line}
' >>
${file}
"
,
unless
=>
"grep
${pattern}
${file}
"
,
require
=>
Package
[
'postfix'
],
notify
=>
Exec
[
"postmap hash:
${file}
"
],
}
exec
{
"fix-sender-
${name}
"
:
command
=>
"sed -i -e 's/^
${name}
..*
\$
/
${line}
/'
${file}
"
,
unless
=>
"grep '^
${line}
\$
'
${file}
"
,
require
=>
Exec
[
"add-sender-
${name}
"
],
notify
=>
Exec
[
"postmap hash:
${file}
"
],
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment