--- - name: install packages package: name: "{{ item }}" state: installed with_items: - cyrus-sasl - cyrus-sasl-plain - block: - name: set saslauthd to use ldap lineinfile: path: /etc/sysconfig/saslauthd line: MECH=ldap regexp: "^MECH=.*" notify: restart saslauthd - name: create saslauthd.conf template: dest: /etc/saslauthd.conf src: saslauthd.conf.j2 mode: 0644 owner: root group: "{{ ansible_wheel }}" notify: restart saslauthd when: saslauthd_mech == "ldap" - name: enable saslauthd service service: name: saslauthd state: started enabled: true