We investigate the temperature dependence of the shear viscosity to entropy density ratio $eta/s$ using a piecewise linear parametrization. To determine the optimal values of the parameters and the associated uncertainties, we perform a global Bayesian model-to-data comparison on Au+Au collisions at $sqrt{s_{NN}}=200$ GeV and Pb+Pb collisions at $2.76$ TeV and $5.02$ TeV, using a 2+1D hydrodynamical model with the EKRT initial state. We provide three new parametrizations of the equation of state (EoS) based on contemporary lattice results and hadron resonance gas, and use them and the widely used $s95p$ parametrization to explore the uncertainty in the analysis due to the choice of the equation of state. We found that $eta/s$ is most constrained in the temperature range $Tapprox 150$--$220$ MeV, where, for all EoSs, $0.08 < eta/s < 0.23$ when taking into account the 90% credible intervals. In this temperature range the EoS parametrization has only a small $approx 10%$ effect on the favored $eta/s$ value, which is less than the $approx 30%$ uncertainty of the analysis using a single EoS parametrization. Our parametrization of $(eta/s)(T)$ leads to a slightly larger minimum value of $eta/s$ than the previously used parametrizations. When we constrain our parametrization to mimic the previously used parametrizations, our favored value is reduced, and the difference becomes statistically insignificant.