How to store the userid and password of any provisioned server securely

Hi I would like to know how securely we can store the password and userid of any provisioned host. Like if I need to install a software in that host I have to give the userid and password ( admin) credential. But saving it to code base is not right.

How to take the approach?