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