Browse Source

Improved idempotency and removed ip detection for checkrbl

Luke Cyca 11 years ago
parent
commit
7043143f90

+ 1
- 0
roles/common/tasks/encfs.yml View File

18
 - name: Check for existing encfs
18
 - name: Check for existing encfs
19
   shell: ls /encrypted/*
19
   shell: ls /encrypted/*
20
   ignore_errors: True
20
   ignore_errors: True
21
+  changed_when: False  # never report as "changed"
21
   register: encfs_check
22
   register: encfs_check
22
 
23
 
23
 # If it is empty, we need to create the encfs
24
 # If it is empty, we need to create the encfs

+ 6
- 1
roles/mailserver/handlers/main.yml View File

8
   service: name=opendkim state=restarted
8
   service: name=opendkim state=restarted
9
 
9
 
10
 - name: restart solr
10
 - name: restart solr
11
-  service: name=tomcat6 state=restarted
11
+  service: name=tomcat6 state=restarted
12
+
13
+- name: import mysql postfix
14
+  mysql_db: name={{ mail_mysql_database }} state=import target=/etc/postfix/import.sql
15
+  notify: restart postfix
16
+

+ 1
- 5
roles/mailserver/tasks/checkrbl.yml View File

1
-- name: What is our IP address?
2
-  command: dig ${mail_server_hostname} +short
3
-  register: dig_command
4
-
5
 - name: Download check-rbl
1
 - name: Download check-rbl
6
   get_url: url=https://raw.github.com/lukecyca/check-rbl/f6b222b0ca/check-rbl.pl dest=/opt/check-rbl.pl
2
   get_url: url=https://raw.github.com/lukecyca/check-rbl/f6b222b0ca/check-rbl.pl dest=/opt/check-rbl.pl
7
 
3
 
8
 - name: Install nightly check-rbl cronjob
4
 - name: Install nightly check-rbl cronjob
9
-  cron: name="check-rbl" hour="2" minute="0" job="perl /opt/check-rbl.pl -i ${dig_command.stdout}"
5
+  cron: name="check-rbl" hour="2" minute="0" job="perl /opt/check-rbl.pl -i ${server_ip_address}"

+ 5
- 7
roles/mailserver/tasks/postfix.yml View File

11
 
11
 
12
 - name: Create database user for mail server
12
 - name: Create database user for mail server
13
   mysql_user: user={{ mail_mysql_username }} password={{ mail_mysql_password }} state=present priv="mailserver.*:ALL"
13
   mysql_user: user={{ mail_mysql_username }} password={{ mail_mysql_password }} state=present priv="mailserver.*:ALL"
14
+  notify: import mysql postfix
14
 
15
 
15
 - name: Create database for mail server
16
 - name: Create database for mail server
16
   mysql_db: name={{ mail_mysql_database }} state=present
17
   mysql_db: name={{ mail_mysql_database }} state=present
18
+  notify: import mysql postfix
17
 
19
 
18
-- name: copy over mailserver sql
20
+- name: Copy import.sql
19
   template: src=mailserver.sql.j2 dest=/etc/postfix/import.sql owner=root group=root mode=0600
21
   template: src=mailserver.sql.j2 dest=/etc/postfix/import.sql owner=root group=root mode=0600
20
-  tags: import_mysql_postfix
22
+  notify: import mysql postfix
21
 
23
 
22
-- name: import mysql postfix
23
-  mysql_db: name={{ mail_mysql_database }} state=import target=/etc/postfix/import.sql
24
-  tags: import_mysql_postfix
25
-
26
-- name: Copy Postfix config files into place
24
+- name: Copy main.cf
27
   template: src=etc_postfix_main.cf.j2 dest=/etc/postfix/main.cf owner=root group=root
25
   template: src=etc_postfix_main.cf.j2 dest=/etc/postfix/main.cf owner=root group=root
28
   notify: restart postfix
26
   notify: restart postfix
29
 
27
 

+ 1
- 3
roles/mailserver/templates/etc_opendkim_TrustedHosts.j2 View File

1
 127.0.0.1
1
 127.0.0.1
2
-# TODO add your server's IP and DNS hosts, ex:
3
-# ns1.linode.com
4
-# 198.58.112.239 
2
+{{ server_ip_address }}
5
 {% for domain in mail_virtual_domains %}
3
 {% for domain in mail_virtual_domains %}
6
 {{ domain.name }}
4
 {{ domain.name }}
7
 {% endfor %}
5
 {% endfor %}

Loading…
Cancel
Save