Getting started

Default setup

If you don't specify any configuration values, the role will setup an IMAP and IMAPS service using the certificates provided by ansible-pki. It will further use the ansible-ferm role to open the required network ports with iptables: 143 (IMAP+STARTTLS) and 993 (IMAPS). Every user account which is able to login via PAM, can then also login via IMAP and access its mails stored as an mbox file in /var/mail/<username>.

Example inventory

You can install Dovecot on a host by adding it to the [debops_service_dovecot] group in your Ansible inventory:

[debops_service_dovecot]
hostname

Example playbook

Here's an example playbook which uses debops.dovecot role to install Dovecot:

---

- name: Manage Dovecot service
  hosts: [ 'debops_service_dovecot' ]
  become: True

  environment: '{{ inventory__environment | d({})
                   | combine(inventory__group_environment | d({}))
                   | combine(inventory__host_environment  | d({})) }}'

  roles:

    - role: debops.postfix/env
      tags: [ 'role::postfix', 'role::secret', 'role::ferm' ]

    - role: debops.secret
      tags: [ 'role::secret', 'role::postfix' ]
      secret__directories:
        - '{{ postfix__secret__directories }}'

    - role: debops.ferm
      tags: [ 'role::ferm', 'skip::ferm' ]
      ferm__dependent_rules:
        - '{{ postfix__ferm__dependent_rules }}'

    - role: debops.postfix
      tags: [ 'role::postfix', 'skip::postfix' ]
      postfix__dependent_maincf:
        - role: 'dovecot'
          config: '{{ dovecot__postfix__dependent_maincf }}'
      postfix__dependent_mastercf:
        - role: 'dovecot'
          config: '{{ dovecot__postfix__dependent_mastercf }}'

    - role: debops.dovecot
      tags: [ 'role::dovecot', 'skip::dovecot' ]

Ansible tags

You can use Ansible --tags or --skip-tags parameters to limit what tasks are performed during Ansible run. This can be used after a host was first configured to speed up playbook execution, when you are sure that most of the configuration is already in the desired state.

Available role tags:

role::dovecot
Main role tag, should be used in the playbook to execute all of the role tasks as well as role dependencies.