Procházet zdrojové kódy

Split up email address information in `mail_virtual_users`

Use the changed `mail_virtual_users` structure to ensure directories and
sieve rules are created for each defined account.
Bryan J Swift před 11 roky
rodič
revize
d9bbc072c0

+ 2
- 2
roles/mailserver/tasks/dovecot.yml Zobrazit soubor

@@ -19,8 +19,8 @@
19 19
   with_items: mail_virtual_domains
20 20
 
21 21
 - name: Ensure mail directories are in place
22
-  file: state=directory path=/decrypted/{{ item.name }}/{{ item.primary_user }} owner=vmail group=dovecot
23
-  with_items: mail_virtual_domains
22
+  file: state=directory path=/decrypted/{{ item.domain }}/{{ item.account }} owner=vmail group=dovecot
23
+  with_items: mail_virtual_users
24 24
 
25 25
 - name: Copy dovecot.conf into place
26 26
   copy: src=etc_dovecot_dovecot.conf dest=/etc/dovecot/dovecot.conf

+ 3
- 3
roles/mailserver/tasks/dspam.yml Zobrazit soubor

@@ -29,7 +29,7 @@
29 29
     - 90-plugin.conf
30 30
   notify: restart dovecot
31 31
 
32
-- name: Put sieve rules into each primary user directory
33
-  copy: src=dot_dovecot.sieve dest=/decrypted/{{ item.name }}/{{ item.primary_user }}/.dovecot.sieve owner=vmail group=dovecot
34
-  with_items: mail_virtual_domains
32
+- name: Put sieve rules into each user directory
33
+  copy: src=dot_dovecot.sieve dest=/decrypted/{{ item.domain }}/{{ item.account }}/.dovecot.sieve owner=vmail group=dovecot
34
+  with_items: mail_virtual_users
35 35
   notify: restart dovecot

+ 5
- 1
roles/mailserver/templates/mailserver.sql.j2 Zobrazit soubor

@@ -36,7 +36,11 @@ INSERT INTO {{ mail_mysql_database }}.`virtual_domains` (`id`, `name`)
36 36
 
37 37
 {% for virtual_user in mail_virtual_users %}
38 38
 INSERT INTO {{ mail_mysql_database }}.`virtual_users`  (`domain_id`, `password` , `email`)
39
-	VALUES ('{{ virtual_user.domain_pk_id }}', '{{ virtual_user.password_hash }}', '{{ virtual_user.address }}');
39
+	VALUES (
40
+		'{{ virtual_user.domain_pk_id }}',
41
+		'{{ virtual_user.password_hash }}',
42
+		'{{ virtual_user.account }}@{{ virtual_user.domain }}'
43
+	);
40 44
 {% endfor %}
41 45
 
42 46
 {% if mail_virtual_aliases is defined %}

+ 2
- 2
vars/testing.yml Zobrazit soubor

@@ -23,9 +23,9 @@ mail_mysql_password: testPassword
23 23
 mail_virtual_domains:
24 24
   - name: "{{ domain }}"
25 25
     pk_id: 1
26
-    primary_user: "{{ main_user_name }}"
27 26
 mail_virtual_users:
28
-  - address: "{{ main_user_name }}@{{ domain }}"
27
+  - account: "{{ main_user_name }}"
28
+    domain: "{{ domain }}"
29 29
     password_hash: "$6$IYJfaF3jvmbAzlSe$1HBkbIdrOTWA31WYon7VSE2xAcFzYSZuVb8d3I0NDWzPxXBaqkHqKs4rLeNO9CVQEKv7wA15QctCyXbdRqFDy." #foo
30 30
     domain_pk_id: 1
31 31
 mail_virtual_aliases:

+ 4
- 2
vars/user.yml Zobrazit soubor

@@ -26,10 +26,12 @@ mail_virtual_domains:
26 26
 #    pk_id: 2
27 27
 #    primary_user: TODO
28 28
 mail_virtual_users:
29
-  - address: "{{ main_user_name }}@{{ domain }}"
29
+  - account: "{{ main_user_name }}"
30
+    domain: "{{ domain }}"
30 31
     password_hash: TODO
31 32
     domain_pk_id: 1
32
-#  - address: "TODO@{{ domain }}"
33
+#  - account: "{{ TODO }}"
34
+#    domain: "{{ domain }}"
33 35
 #    password_hash: TODO
34 36
 #    domain_pk_id: 2
35 37
 mail_virtual_aliases:

Loading…
Zrušit
Uložit