There are several tools you can use for this purpose. Ansible is one of them. If you want to use Ansible, you can use "Ansible variables". You can assign system environment variables according to the values of these "Ansible variables".
You can also store all your Ansible playbooks with all your variables in a git repository. That way they don't show in the server other than as environment variables after you run your Ansible playbooks.
You can look at setting up environment variables with Ansible here: http://docs.ansible.com/playbooks_environment.html
Having said that there are other tools that can help you do this. Among them: Puppet, Chef, CFEngine, Fabric and SaltStack. All of them will help you accomplish what you want although differently. They have their advantages and disadvantages depending on what you are looking for and what your architecture looks like.
Check my answer here too for more insights: Heroku-like deployment and environment configuration via EC2