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