--- - name: "Install Mailpit using the official installation script" ansible.builtin.shell: "bash <(curl -sL https://raw.githubusercontent.com/axllent/mailpit/develop/install.sh)" args: creates: /usr/local/bin/mailpit register: mailpit_install changed_when: "mailpit_install.rc == 0 and 'Installed Mailpit to' in mailpit_install.stdout" become: yes - name: "Create Mailpit systemd service file" ansible.builtin.template: src: mailpit.service.j2 dest: /etc/systemd/system/mailpit.service owner: root group: root mode: '0644' notify: Restart Mailpit service - name: "Ensure Mailpit service is enabled and started" ansible.builtin.systemd: name: mailpit enabled: yes state: started daemon_reload: yes