--- - name: "[OpenRC] Enable and start service: hostapd" service: name: hostapd enabled: yes state: started when: - ansible_service_mgr == "openrc" - name: "[systemd] Enable and start service: hostapd" systemd: name: hostapd enabled: yes state: started when: - ansible_service_mgr == "systemd"