--- - name: install package apt: pkg: "{{ item }}" with_items: - dovecot-imapd - dovecot-lmtpd - dovecot-mysql notify: - reload dovecot - name: vmail group group: name: vmail gid: "{{vmail_gid}}" system: yes - name: vmail user user: name: vmail uid: "{{vmail_uid}}" group: vmail system: yes home: /var/vmail - name: dovecot configuration files template: src: "{{ item }}.j2" dest: /etc/dovecot/{{ item }} with_items: - dovecot.conf - conf.d/10-mail.conf - conf.d/10-auth.conf - conf.d/auth-sql.conf.ext - dovecot-sql.conf.ext - conf.d/10-ssl.conf notify: - reload dovecot - name: postfixadmin mysql user mysql_user: name: "{{dovecot_postfixadmin_mysql_username}}" password: "{{dovecot_postfixadmin_mysql_password}}" priv: "{{dovecot_postfixadmin_mysql_database}}.*:SELECT" state: present - name: configuration pull directory local_action: file args: path: ~/host_files/{{inventory_hostname}}/etc state: directory - name: pull configuration synchronize: src: /etc/dovecot dest: ~/host_files/{{inventory_hostname}}/etc/ mode: pull recursive: true