updated postfix state

This commit is contained in:
Paul 2020-07-19 14:13:51 +02:00
parent 8ba2dc88af
commit 0701722f5e
10 changed files with 94 additions and 72 deletions

40
states/postfix/config.sls Normal file
View File

@ -0,0 +1,40 @@
---
{%- from "postfix/map.jinja" import postfix with context %}
postfix-pgsql-dir:
file.directory:
- name: {{ postfix.base_dir }}/pgsql
- user: root
- group: root
postfix-main-cf:
file.managed:
- name: {{ postfix.base_dir }}/pgsql/main.cf
- source: salt://postfix/templates/main.cf.j2
- user: root
- group: root
- mode: 644
- template: jinja
- watch_in:
- service: postfix-service
postfix-main-cf:
file.managed:
- name: {{ postfix.base_dir }}/main.cf
- source: salt://postfix/templates/main.cf.j2
- user: root
- group: root
- mode: 644
- template: jinja
- watch_in:
- service: postfix-service
postfix-master-cf:
file.managed:
- name: {{ postfix.base_dir }}/master.cf
- source: salt://postfix/templates/master.cf.j2
- user: root
- group: root
- mode: 644
- template: jinja
- watch_in:
- service: postfix-service

View File

@ -2,6 +2,8 @@
postfix:
enabled: true
base_dir: '/etc/postfix'
pkgs:
- postfix
config:
main:
alias_database: 'hash:/etc/aliases'

View File

@ -1,73 +1,6 @@
---
{%- from "postfix/map.jinja" import postfix with context %}
postfix-pkg:
pkg.latest:
- name: postfix
postfix-pgsql-dir:
file.directory:
- name: {{ postfix.base_dir }}/pgsql
- user: root
- group: root
postfix-main-cf:
file.managed:
- name: {{ postfix.base_dir }}/main.cf
- source: salt://postfix/main.cf.j2
- user: root
- group: root
- mode: 644
- template: jinja
- watch_in:
- service: postfix-service
postfix-master-cf:
file.managed:
- name: {{ postfix.base_dir }}/master.cf
- source: salt://postfix/master.cf.j2
- user: root
- group: root
- mode: 644
- template: jinja
- watch_in:
- service: postfix-service
postfix-transport-maps:
file.managed:
- name: {{ postfix.base_dir }}/transport
- source: salt://postfix/transport.j2
- user: root
- group: root
- mode: 644
- template: jinja
- watch_in:
- service: postfix-service
- cmd: postfix-transport
postfix-sender-access-maps:
file.managed:
- name: {{ postfix.base_dir }}/sender_access
- source: salt://postfix/sender_access.j2
- user: root
- group: root
- mode: 644
- template: jinja
- watch_in:
- service: postfix-service
- cmd: postfix-sender-access
postfix-transport:
cmd.run:
- name: postmap transport
- cwd: {{ postfix.base_dir }}
postfix-sender-access:
cmd.run:
- name: postmap sender_access
- cwd: {{ postfix.base_dir }}
postfix-service:
service.running:
- name: postfix
- enable: True
- reload: True
include:
- .install
- .config
- .maps
- .service

View File

@ -0,0 +1,5 @@
---
{%- from "postfix/map.jinja" import postfix with context %}
postfix-pkg:
pkg.latest:
- pkgs: {{ postfix.pkgs }}

35
states/postfix/maps.sls Normal file
View File

@ -0,0 +1,35 @@
---
{%- from "postfix/map.jinja" import postfix with context %}
postfix-transport-maps:
file.managed:
- name: {{ postfix.base_dir }}/transport
- source: salt://postfix/templates/transport.j2
- user: root
- group: root
- mode: 644
- template: jinja
- watch_in:
- service: postfix-service
- cmd: postfix-transport
postfix-sender-access-maps:
file.managed:
- name: {{ postfix.base_dir }}/sender_access
- source: salt://postfix/templates/sender_access.j2
- user: root
- group: root
- mode: 644
- template: jinja
- watch_in:
- service: postfix-service
- cmd: postfix-sender-access
postfix-transport:
cmd.run:
- name: postmap transport
- cwd: {{ postfix.base_dir }}
postfix-sender-access:
cmd.run:
- name: postmap sender_access
- cwd: {{ postfix.base_dir }}

View File

@ -0,0 +1,7 @@
---
{%- from "postfix/map.jinja" import postfix with context %}
postfix-service:
service.running:
- name: postfix
- enable: True
- reload: True