Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No more configs in states #7

Merged
merged 3 commits into from
Sep 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions exim/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -21,35 +21,42 @@ exim_install_packages:
{% set relay_domains = salt['pillar.get']('exim:config:relay_domains', '') %}
{% set relay_nets = salt['pillar.get']('exim:config:relay_nets', '') %}
{% set smarthost = salt['pillar.get']('exim:config:smarthost', '') %}
{% set cfilemode = salt['pillar.get']('exim:config:cfilemode', '644') %}

{{ map.config_dir }}/{{ map.config_file }}:
file.managed:
- contents: |
dc_use_split_config='{{ use_split_config }}'
dc_eximconfig_configtype='{{ configtype }}'
dc_other_hostnames='{{ other_hostnames }}'
dc_local_interfaces='{{ local_interfaces }}'
dc_relay_domains='{{ relay_domains }}'
dc_relay_nets='{{ relay_nets }}'
dc_use_split_config='{{ use_split_config }}'
dc_hide_mailname='{{ hide_mailname }}'
ue4c_keepcomments='{{ ue4c_keepcomments }}'
dc_localdelivery='{{ localdelivery }}'
dc_local_interfaces='{{ local_interfaces }}'
dc_minimaldns='{{ minimaldns }}'
dc_other_hostnames='{{ other_hostnames }}'
dc_readhost='{{ readhost }}'
dc_relay_domains='{{ relay_domains }}'
dc_relay_nets='{{ relay_nets }}'
dc_smarthost='{{ smarthost }}'
CFILEMODE='{{ cfilemode }}'
- watch_in:
- service: {{ map.service }}

{% if salt['pillar.get']('exim:files') %}
{% for dir in map.sub_dirs %}
{% for file in salt['pillar.get']('exim:files:' + dir, {}) %}
{{ map.config_dir }}/conf.d/{{ dir }}/{{ file }}:
file.managed:
- source: salt://exim/{{ file }}
- contents_pillar: exim:files:{{ dir }}:{{ file }}
- watch_in:
- service: {{ map.service }}
{% endfor %}
{% endfor %}
{% endif %}


exim_service:
service.running:
- name: {{ map.service }}

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor style issue: better to avoid trailing newlines. You may want to add something right after the last line of actual code if jump at the bottom of the file.


27 changes: 20 additions & 7 deletions pillar.example
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,30 @@ exim:
relay_nets: ''
smarthost: ''
files:
# Name all files which should be put under the corresponding
# split config directory
# Source files must be placed in an exim directory under file_roots
# e.g. /srv/salt/files/exim/
main:
- file1
- file 2
'01_exim4-config_listmacrosdefs': |
exim_path = /usr/sbin/exim4
# Macro defining the main configuration directory.
# We do not use absolute paths.
.ifndef CONFDIR
CONFDIR = /etc/exim4
.endif

'90_exim4-config_log_selector': |
# uncomment this for debugging
# MAIN_LOG_SELECTOR == MAIN_LOG_SELECTOR +all -subject -arguments

.ifdef MAIN_LOG_SELECTOR
log_selector = MAIN_LOG_SELECTOR
.endif

acl:
'00_exim4-config_header': |
begin acl
router:
transport:
retry:
- file3
'file3': |
# some more config
rewrite:
auth: