diff --git a/states/autoconfig/config-v1.1.xml.j2 b/states/autoconfig/config-v1.1.xml.j2 new file mode 100644 index 0000000..2fbdf77 --- /dev/null +++ b/states/autoconfig/config-v1.1.xml.j2 @@ -0,0 +1,22 @@ + + + + paulbsd.com + Services paulbsd.com + paulbsd.com + + imap.paulbsd.com + 993 + SSL + password-cleartext + %EMAILADDRESS% + + + smtp.paulbsd.com + 465 + SSL + password-cleartext + %EMAILADDRESS% + + + diff --git a/states/autoconfig/defaults.yaml b/states/autoconfig/defaults.yaml new file mode 100644 index 0000000..0f21024 --- /dev/null +++ b/states/autoconfig/defaults.yaml @@ -0,0 +1,4 @@ +--- +autoconfig: + enabled: true + install_dir: /usr/local/apps diff --git a/states/autoconfig/init.sls b/states/autoconfig/init.sls new file mode 100644 index 0000000..10ad9a6 --- /dev/null +++ b/states/autoconfig/init.sls @@ -0,0 +1,3 @@ +--- +include: + - .install \ No newline at end of file diff --git a/states/autoconfig/install.sls b/states/autoconfig/install.sls new file mode 100644 index 0000000..db0c526 --- /dev/null +++ b/states/autoconfig/install.sls @@ -0,0 +1,24 @@ +--- +{%- from "autoconfig/map.jinja" import autoconfig with context %} +autoconfig-directory: + file.directory: + - name: {{ autoconfig.install_dir }}/autoconfig + - user: root + - group: root + - mode: 0755 + +autoconfig-maildir: + file.directory: + - name: {{ autoconfig.install_dir }}/autoconfig/mail + - user: root + - group: root + - mode: 0755 + +autoconfig-file: + file.managed: + - name: {{ autoconfig.install_dir }}/autoconfig/mail/config-v1.1.xml + - source: salt://autoconfig/config-v1.1.xml.j2 + - user: root + - group: root + - mode: 0644 + - template: jinja diff --git a/states/autoconfig/map.jinja b/states/autoconfig/map.jinja new file mode 100644 index 0000000..a3c69d7 --- /dev/null +++ b/states/autoconfig/map.jinja @@ -0,0 +1,5 @@ +{%- import_yaml "autoconfig/defaults.yaml" as default_settings -%} + +{%- set defaults = salt['grains.filter_by'](default_settings, default='autoconfig')-%} + +{%- set autoconfig = salt['pillar.get']('autoconfig', default=defaults, merge=True) -%} \ No newline at end of file