diff --git a/defaults/main.yml b/defaults/main.yml index e984224..a54e43a 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1 +1,5 @@ opendkim_port: 8891 +opendkim_postfix: True +opendkim_TrustedHosts: + - 127.0.0.1 + - localhost diff --git a/files/TrustedHosts b/files/TrustedHosts deleted file mode 100644 index a0d2f42..0000000 --- a/files/TrustedHosts +++ /dev/null @@ -1,2 +0,0 @@ -127.0.0.1 -localhost diff --git a/tasks/main.yml b/tasks/main.yml index 5efa646..53fc00f 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,3 +1,4 @@ --- - include: opendkim.yml - include: postfix.yml + when: "{{ opendkim_postfix == True }}" diff --git a/tasks/opendkim.yml b/tasks/opendkim.yml index 54286fe..1067f74 100644 --- a/tasks/opendkim.yml +++ b/tasks/opendkim.yml @@ -15,7 +15,7 @@ file: path=/etc/opendkim/keys state=directory - name: opendkim TrustedHosts present - copy: src=TrustedHosts dest=/etc/opendkim/TrustedHosts + template: src=TrustedHosts.j2 dest=/etc/opendkim/TrustedHosts notify: - restart opendkim @@ -46,4 +46,4 @@ - restart opendkim - name: opendkim is running - service: name=opendkim state=running enabled=yes + service: name=opendkim state=started enabled=yes diff --git a/tasks/postfix.yml b/tasks/postfix.yml index c0e8cbe..c2f5dde 100644 --- a/tasks/postfix.yml +++ b/tasks/postfix.yml @@ -26,5 +26,5 @@ dest: /etc/postfix/main.cf - name: postfix is running - service: name=postfix state=running enabled=yes + service: name=postfix state=started enabled=yes tags: postfix diff --git a/templates/TrustedHosts.j2 b/templates/TrustedHosts.j2 new file mode 100644 index 0000000..2e7d087 --- /dev/null +++ b/templates/TrustedHosts.j2 @@ -0,0 +1,3 @@ +{% for host in opendkim_TrustedHosts %} +{{ host }} +{% endfor %}