diff --git a/tasks/configure_dbmail_users.yml b/tasks/configure_dbmail_users.yml new file mode 100644 index 0000000..3858e61 --- /dev/null +++ b/tasks/configure_dbmail_users.yml @@ -0,0 +1,16 @@ +--- +- name: Ensure user accounts are present + shell: "dbmail-users -a {{ item.username }}" + loop: "{{ dbmail_users }}" + +- name: Set user accounts password + shell: "dbmail-users -c {{ item.username }} -w {{ item.password}} -p {{ item.password_type | default('sha512') }}" + loop: "{{ dbmail_users }}" + +- name: Link user accounts with emails + shell: "dbmail-users -c {{ item.username }} -s {{ item.email }}" + loop: "{{ dbmail_users }}" + +- name: Set user accounts quota + shell: "dbmail-users -c {{ item.username }} -m {{ item.quota }}" + loop: "{{ dbmail_users }}" \ No newline at end of file diff --git a/tasks/main.yml b/tasks/main.yml index d8dcd8f..e579561 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -17,4 +17,7 @@ - name: Ensure certificates are configured include_tasks: configure_certificates.yml - when: dbmail_configuration['POP']['tls_port'] > 0 or dbmail_configuration['IMAP']['tls_port'] > 0 or dbmail_configuration['SIEVE']['tls_port'] > 0 \ No newline at end of file + when: dbmail_configuration['POP']['tls_port'] > 0 or dbmail_configuration['IMAP']['tls_port'] > 0 or dbmail_configuration['SIEVE']['tls_port'] > 0 + +- name: Ensure user's are configured in dbmail + include_tasks: configure_dbmail_users.yml \ No newline at end of file