forked from daschatten/exim-formula
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(states): split exim metastate in .package/.config/.service
- Loading branch information
1 parent
5b815e6
commit a947ba9
Showing
8 changed files
with
109 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=sls | ||
|
||
{#- Get the `tplroot` from `tpldir` #} | ||
{%- set tplroot = tpldir.split('/')[0] %} | ||
{%- set sls_package_install = tplroot ~ '.package.install' %} | ||
{%- from tplroot ~ "/map.jinja" import map with context %} | ||
{% set use_split_config = salt['pillar.get']('exim:config:use_split_config', 'true') %} | ||
{% set configtype = salt['pillar.get']('exim:config:configtype', 'satellite') %} | ||
{% set hide_mailname = salt['pillar.get']('exim:config:hide_mailname', 'true') %} | ||
{% set ue4c_keepcomments = salt['pillar.get']('exim:config:ue4c_keepcomments', 'true') %} | ||
{% set localdelivery = salt['pillar.get']('exim:config:localdelivery', 'mail_spool') %} | ||
{% set local_interfaces = salt['pillar.get']('exim:config:local_interfaces', '') %} | ||
{% set minimaldns = salt['pillar.get']('exim:config:minimaldns', 'false') %} | ||
{% set other_hostnames = salt['pillar.get']('exim:config:other_hostnames', '') %} | ||
{% set readhost = salt['pillar.get']('exim:config:readhost', '') %} | ||
{% 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_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_minimaldns='{{ minimaldns }}' | ||
dc_readhost='{{ readhost }}' | ||
dc_smarthost='{{ smarthost }}' | ||
CFILEMODE='{{ cfilemode }}' | ||
{% 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: | ||
- contents_pillar: exim:files:{{ dir }}:{{ file }} | ||
{% endfor %} | ||
{% endfor %} | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=sls | ||
|
||
include: | ||
- .file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,7 @@ | ||
# This is the main state file for configuring exim, | ||
|
||
{% from "exim/map.jinja" import map with context %} | ||
exim_install_packages: | ||
pkg.installed: | ||
- pkgs: | ||
{% for pkg in map.pkgs %} | ||
- {{ pkg }} | ||
{% endfor %} | ||
{% set use_split_config = salt['pillar.get']('exim:config:use_split_config', 'true') %} | ||
{% set configtype = salt['pillar.get']('exim:config:configtype', 'satellite') %} | ||
{% set hide_mailname = salt['pillar.get']('exim:config:hide_mailname', 'true') %} | ||
{% set ue4c_keepcomments = salt['pillar.get']('exim:config:ue4c_keepcomments', 'true') %} | ||
{% set localdelivery = salt['pillar.get']('exim:config:localdelivery', 'mail_spool') %} | ||
{% set local_interfaces = salt['pillar.get']('exim:config:local_interfaces', '') %} | ||
{% set minimaldns = salt['pillar.get']('exim:config:minimaldns', 'false') %} | ||
{% set other_hostnames = salt['pillar.get']('exim:config:other_hostnames', '') %} | ||
{% set readhost = salt['pillar.get']('exim:config:readhost', '') %} | ||
{% 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_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_minimaldns='{{ minimaldns }}' | ||
dc_readhost='{{ readhost }}' | ||
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: | ||
- contents_pillar: exim:files:{{ dir }}:{{ file }} | ||
- watch_in: | ||
- service: {{ map.service }} | ||
{% endfor %} | ||
{% endfor %} | ||
{% endif %} | ||
exim_service: | ||
service.running: | ||
- name: {{ map.service }} | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=sls | ||
|
||
include: | ||
- .package | ||
- .config | ||
- .service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=sls | ||
|
||
include: | ||
- .install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=sls | ||
|
||
{#- Get the `tplroot` from `tpldir` #} | ||
{%- set tplroot = tpldir.split('/')[0] %} | ||
{%- from tplroot ~ "/map.jinja" import map with context %} | ||
exim/package/install: | ||
pkg.installed: | ||
- pkgs: {{ map.pkgs | json }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=sls | ||
|
||
include: | ||
- .running |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=sls | ||
|
||
{#- Get the `tplroot` from `tpldir` #} | ||
{%- set tplroot = tpldir.split('/')[0] %} | ||
{%- set sls_config_file = tplroot ~ '.config.file' %} | ||
{%- from tplroot ~ "/map.jinja" import map with context %} | ||
include: | ||
- {{ sls_config_file }} | ||
exim/service/running: | ||
service.running: | ||
- name: {{ map.service }} | ||
- enable: true | ||
- require: | ||
- sls: {{ sls_config_file }} |