]> Frank Brehm's Git Trees - salt/states.git/commitdiff
Adding state for creating /etc/postfix/postfix.pem
authorFrank Brehm <frank@brehm-online.com>
Mon, 29 Feb 2016 14:09:40 +0000 (15:09 +0100)
committerFrank Brehm <frank@brehm-online.com>
Mon, 29 Feb 2016 14:09:40 +0000 (15:09 +0100)
postfix/common.sls

index 6fc8a3947ad1aca62966d32d5570331c9805c76c..585a191051d90732872ec3296b93a4cc3ac0d59b 100644 (file)
@@ -33,28 +33,40 @@ postfix:
       - file: /etc/postfix
     - backup: minion
 
-/etc/postfix/main.cf:
+/etc/postfix/postfix-cert.cnf:
   file.managed:
-    - source: salt://postfix/files/main.cf
+    - source: salt://postfix/files/postfix-cert.cnf
     - user: root
     - group: root
     - mode: 644
     - require:
-      - pkg: postfix
       - file: /etc/postfix
-    - watch_in:
-      - service: postfix
     - template: jinja
     - backup: minion
 
-/etc/postfix/postfix-cert.cnf:
+postfix.pem:
+  cmd.run:
+    - name: /etc/postfix/mkpostfixcert
+    - unless:
+      - test -f /etc/postfix/postfix.pem
+      - test -s /etc/postfix/postfix.pem
+    - require:
+      - file: /etc/postfix
+      - file: /etc/postfix/mkpostfixcert
+      - file: /etc/postfix/postfix-cert.cnf
+
+/etc/postfix/main.cf:
   file.managed:
-    - source: salt://postfix/files/postfix-cert.cnf
+    - source: salt://postfix/files/main.cf
     - user: root
     - group: root
     - mode: 644
     - require:
+      - pkg: postfix
       - file: /etc/postfix
+      - cmd: postfix.pem
+    - watch_in:
+      - service: postfix
     - template: jinja
     - backup: minion