Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
salt-formulas
mirror
Postfix Formula
Commits
ae878da8
Commit
ae878da8
authored
Dec 08, 2017
by
Alexander Weidinger
Browse files
Use defaults.yaml and osmap.yaml
parent
9ed99927
Changes
3
Hide whitespace changes
Inline
Side-by-side
postfix/defaults.yaml
View file @
ae878da8
...
...
@@ -2,11 +2,11 @@
# vim: ft=yaml
postfix
:
aliases_file
:
/etc/aliases
config_path
:
/etc/postfix
package
:
postfix
postsrsd_pkg
:
postsrsd
postgrey_pkg
:
postgrey
root_grp
:
root
service
:
postfix
xbin_prefix
:
/usr
aliases_file
:
/etc/aliases
config_path
:
/etc/postfix
package
:
postfix
postsrsd_pkg
:
postsrsd
postgrey_pkg
:
postgrey
root_grp
:
root
service
:
postfix
xbin_prefix
:
/usr
postfix/map.jinja
View file @
ae878da8
# -*- coding: utf-8 -*-
# vim: ft=jinja
{%
-
macro
deep_merge
(
a
,
b
)
%}
{#- This whole `'dict' in x.__class__.__name__` mess is a
workaround for the missing mapping test in CentOS 6's
ancient Jinja2, see #193 #}
{%
-
for
k
,
v
in
b.iteritems
()
%}
{%
-
if
v
is
string
or
v
is
number
%}
{%
-
do
a.update
(
{
k
:
v
}
)
%}
{%
-
elif
'dict'
not
in
v.__class__.__name__
%}
{%
-
if
a
[
k
]
is
not
defined
%}
{%
-
do
a.update
(
{
k
:
v
}
)
%}
{%
-
elif
a
[
k
]
is
iterable
and
'dict'
not
in
a
[
k
]
.
__class__.__name__
and
a
[
k
]
is
not
string
%}
{%
-
do
a.update
(
{
k
:
v
|
list
+
a
[
k
]
|
list
}
)
%}
{%
-
else
%}
{%
-
do
a.update
(
{
k
:
v
}
)
%}
{%
-
endif
%}
{%
-
elif
'dict'
in
v.__class__.__name__
%}
{%
-
if
a
[
k
]
is
not
defined
%}
{%
-
do
a.update
(
{
k
:
v
}
)
%}
{%
-
elif
'dict'
in
a
[
k
]
.
__class__.__name__
%}
{%
-
do
a.update
(
{
k
:
v
}
)
%}
{%
-
else
%}
{%
-
do
deep_merge
(
a
[
k
],
v
)
%}
{%
-
endif
%}
{%
-
else
%}
{%
-
do
a.update
(
{
k
:
'ERROR: case not contempled in merging!'
}
)
%}
{%
-
endif
%}
{%
-
endfor
%}
{%
-
endmacro
%}
{## Start with defaults from defaults.yaml ##}
{%
import_yaml
"postfix/defaults.yaml"
as
default_settings
%}
{##
Setup variable using grains['os_family'] based logic, only add key:values here
that differ from whats in defaults.yaml
##}
{%
set
osrelease
=
salt
[
'grains.get'
](
'osrelease'
)
%}
{# set salt_release = salt['pillar.get']('salt:release', 'latest') #}
{# set postfix = salt['grains.filter_by'](#}
{%
set
os_family_map
=
salt
[
'grains.filter_by'
](
{
'Debian'
:
{
'policyd_spf_pkg'
:
'postfix-policyd-spf-python'
,
'pcre_pkg'
:
'postfix-pcre'
,
'mysql_pkg'
:
'postfix-mysql'
,
}
,
'Gentoo'
:
{
'package'
:
'mail-mta/postfix'
,
'policyd_spf_pkg'
:
'mail-filter/pypolicyd-spf'
,
'postgrey_pkg'
:
'mail-filter/postgrey'
,
'postsrsd_pkg'
:
'mail-filter/postsrsd'
,
'aliases_file'
:
'/etc/mail/aliases'
,
}
,
'RedHat'
:
{
'policyd_spf_pkg'
:
'pypolicyd-spf'
,
}
,
'Arch'
:
{
'policyd_spf_pkg'
:
'python-postfix-policyd-spf'
,
}
,
'FreeBSD'
:
{
'policyd_spf_pkg'
:
'py27-postfix-policyd-spf-python'
,
'aliases_file'
:
'/etc/mail/aliases'
,
'xbin_prefix'
:
'/usr/local'
,
'config_path'
:
'/usr/local/etc/postfix'
,
'root_grp'
:
'wheel'
,
}
,
}
,
merge
=
salt
[
'pillar.get'
](
'postfix:lookup'
))
%}
{## Merge the flavor_map to the default settings ##}
{%
do
deep_merge
(
default_settings.postfix
,
os_family_map
)
%}
{## Merge in postfix:lookup pillar ##}
{%
set
postfix
=
salt
[
'pillar.get'
](
'postfix'
,
default
=
default_settings.postfix
,
merge
=
True
)
{%
import_yaml
"postfix/defaults.yaml"
as
defaults
%}
{%
import_yaml
"postfix/osmap.yaml"
as
osmap
%}
{%
set
postfix
=
salt
[
'grains.filter_by'
](
defaults
,
merge
=
salt
[
'grains.filter_by'
](
osmap
,
grain
=
'os'
,
merge
=
salt
[
'pillar.get'
](
'postfix:lookup'
,
{}
),
),
base
=
'postfix'
)
%}
postfix/osmap.yaml
0 → 100644
View file @
ae878da8
Arch
:
policyd_spf_pkg
:
python-postfix-policyd-spf
Debian
:
policyd_spf_pkg
:
postfix-policyd-spf-python
pcre_pkg
:
postfix-pcre
mysql_pkg
:
postfix-mysql
FreeBSD
:
policyd_spf_pkg
:
py27-postfix-policyd-spf-python
aliases_file
:
/etc/mail/aliases
xbin_prefix
:
/usr/local
config_path
:
/usr/local/etc/postfix
root_grp
:
wheel
Gentoo
:
package
:
mail-mta/postfix
policyd_spf_pkg
:
mail-filter/pypolicyd-spf
postsrsd_pkg
:
mail-filter/postsrsd
postgrey_pkg
:
mail-filter/postgrey
aliases_file
:
/etc/mail/aliases
RedHat
:
policyd_spf_pkg
:
pypolicyd-spf
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