Yes, you can use them. Save the variables in the CI/CD settings of your repository though.
However, I would advice you use SSH Keys for SSH connection. That way you don’t need to bother about username-password, as username-password come with some complexities along the line.
But above all, do what works for you!