--- - name: Install the dovecot packages and start the service block: - name: Install the dovecot packages yum: pkg={{ dovecot_rh_pkgs }} - name: Ensure that the service is started and enabled service: name=dovecot state=started enabled=yes when: dovecot_service_enabled | bool - name: Stop and disable the dovecot service service: name=dovecot state=stopped enabled=no when: not dovecot_service_enabled | bool tags: [ 'dovecot', 'imap' ]