Let $g(x):=f(x)-\dfrac{x(x^2-3)}{2}$ for all $x\in\mathbb{R}$. Then, we see that
$$g(x+1)+g(x-1)=0$$
for all $x\in\mathbb{R}$. If $h(x):=(-1)^{\left\lfloor\frac{x}{2}\right\rfloor}\,g(x)$ for each $x\in\mathbb{R}$, then $h$ is periodic with period $2$. Consequently,
$$f(x)=\dfrac{x(x^2-3)}{2}+(-1)^{\left\lfloor\frac{x}{2}\right\rfloor}\,h(x)\,,$$
where $h:\mathbb{R}\to\mathbb{R}$ is periodic with period $2$. There are infinitely many such functions $h$ even if you honor the conditions $f(0)=2$ and $f(-1)=0$. These extra requirements will only mean that $h(0)=2$ and $h(1)=h(-1)=1$.
Even if you want $f$ to be analytic, this would mean
$$f(x)=\dfrac{x(x^2-3)}{2}+\sum_{k=1}^\infty\,\Biggl(a_k\,\cos\left(\frac{(2k-1)\pi x}{2}\right)+b_k\,\sin\left(\frac{(2k-1)\pi x}{2}\right)\Biggr)\,,$$
where $(a_k)_{k=1}^\infty$ and $(b_k)_{k=1}^\infty$ are sequences of real numbers that satisfy $$\limsup\limits_{k\to\infty}\,\big(|a_k|+|b_k|\big)^{\frac1k}<1$$ (see here). With your conditions $f(0)=2$ and $f(-1)=0$, you need
$$\sum_{k=1}^\infty\,a_k=2\text{ and }\sum_{k=1}^\infty\,(-1)^k\,b_k=-1\,.$$ Clearly, there are uncountably many ways to fulfill these conditions.