Skip to content

Commit

Permalink
Refactoring of exim state
Browse files Browse the repository at this point in the history
  • Loading branch information
A1EF committed Jul 16, 2023
1 parent b341ab0 commit 731dd14
Showing 1 changed file with 11 additions and 34 deletions.
45 changes: 11 additions & 34 deletions salt/exim.sls
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@ debconf-utils:
pkg.installed:
- order: 1

exim_packages:
exim4:
pkg.installed:
- pkgs:
- exim4
- require:
- debconf: exim4_config
- order: 2
service.running:
- enable: True
- watch:
- file: /etc/exim4/*

exim4_setup:
exim4_config:
debconf.set:
- name: exim4_config
- data:
'exim4/mailname': {'type': 'string', 'value': {{ grains['localhost'] }} }
'exim4/dc_localdelivery': {'type': 'select', 'value': 'mbox format in /var/mail/'}
Expand All @@ -24,14 +25,7 @@ exim4_setup:
- require:
- pkg: debconf-utils

exim4_service:
service.running:
- name: exim4
- enable: True
- watch:
- file: /etc/exim4/*

create_dir_dkim:
/etc/exim4/dkim:
file.directory:
- name: /etc/exim4/dkim
- makedirs: True
Expand All @@ -55,19 +49,8 @@ generate_public_cert:
- cwd: /etc/exim4/dkim/
- creates: /etc/exim4/dkim/{{ pillar['dkim_public_key'] }}

chown_dkim:
file.directory:
- name: /etc/exim4/dkim
- makedirs: True
- user: Debian-exim
- group: Debian-exim
- recurse:
- user
- group

exim4_dkim:
/etc/exim4/exim4.conf.template:
file.blockreplace:
- name: /etc/exim4/exim4.conf.template
- marker_start: "### end transport/30_exim4-config_procmail_pipe"
- marker_end: "remote_smtp:"
- content: |
Expand All @@ -76,22 +59,17 @@ exim4_dkim:
DKIM_PRIVATE_KEY = ${if exists{DKIM_KEY_FILE}{DKIM_KEY_FILE}{0}}
DKIM_SELECTOR = {{ pillar['dkim_selector'] }}
- show_changes: True

exim4_config_localmail:
file.line:
- name: /etc/exim4/exim4.conf.template
- mode: replace
- content: 'domainlist local_domains = localhost : localhost.localdomain'
- match: 'domainlist local_domains = MAIN_LOCAL_DOMAINS'

exim4_config_localmacros:
/etc/exim4/exim4.conf.localmacros:
file.managed:
- name: /etc/exim4/exim4.conf.localmacros
- contents: 'MAIN_TLS_ENABLE = 1'

exim4_conf:
/etc/exim4/update-exim4.conf.conf:
file.managed:
- name: /etc/exim4/update-exim4.conf.conf
- contents: |
dc_eximconfig_configtype='smarthost'
dc_other_hostnames=''
Expand All @@ -107,9 +85,8 @@ exim4_conf:
dc_mailname_in_oh='true'
dc_localdelivery='mail_spool'
exim4_passwd_client:
/etc/exim4/passwd.client:
file.managed:
- name: /etc/exim4/passwd.client
- user: root
- group: Debian-exim
- mode: 640
Expand Down

0 comments on commit 731dd14

Please sign in to comment.