From fb9e90d84ab1eb50c6f0702316a67bcad6db8524 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Mon, 5 Mar 2018 19:57:25 +0800 Subject: vars: add "mail.user" for the virtual mail user info --- roles/mail/tasks/main.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'roles/mail/tasks') diff --git a/roles/mail/tasks/main.yml b/roles/mail/tasks/main.yml index 8bf6ff3..8191c0d 100644 --- a/roles/mail/tasks/main.yml +++ b/roles/mail/tasks/main.yml @@ -10,19 +10,19 @@ - dovecot-pigeonhole - name: group - check vmail group - command: pw groupshow vmail + command: pw groupshow {{ mail.user.name }} register: pw_cmd ignore_errors: true changed_when: false tags: vmail - name: group - create vmail group - command: pw groupadd vmail -g 5000 + command: pw groupadd {{ mail.user.name }} -g {{ mail.user.id }} when: pw_cmd.rc != 0 tags: vmail - name: user - check vmail user - command: pw usershow vmail + command: pw usershow {{ mail.user.name }} register: pw_cmd ignore_errors: true changed_when: false @@ -30,9 +30,9 @@ - name: user - create vmail user command: > - pw useradd vmail - -u 5000 -g vmail - -m -M 0700 -d "/home/vmail" + pw useradd {{ mail.user.name }} + -u {{ mail.user.id }} -g {{ mail.user.name }} + -m -M 0700 -d {{ mail.user.home }} -s /sbin/nologin -c "Virtual Mail User" when: pw_cmd.rc != 0 -- cgit v1.2.2