--- - name: "[OpenRC] Start and enable service: mosquitto" service: name: mosquitto enabled: yes state: started when: - ansible_service_mgr == "openrc" - name: "[systemd] Start and enable service: mosquitto" systemd: name: mosquitto enabled: yes state: started when: - ansible_service_mgr == "systemd"