Managing User Configuration Files Across Multiple Computers

Managing user configuration files across multiple computers

At the moment, I use a cloned git repo. To keep things simple, the only file that needs to vary between the different machines is .bashrc. It's nice if there can be just one version of this file that responds differently on different machines. Thus, in my .bashrc:

if [ $(hostname) == 'host1' ]; then
# things to do differently on host1.
elif [ $(hostname) == 'host2' ]; then
# things to do differently on host2.
fi

This obviously has some limitations (such as that a different technique would be required for .vimrc or other config files needing customization), but it works fairly well.

Handling web.config differences across multiple machines when using version control

VS 2010 will provide you with a lot of control to manage web.config files for various configurations... Please check out.

How would you centralize configuration across multiple projects?

If you want to maintain the standard configuration interface, take a look at the ProtectedConfigurationProvider. This provider lets you store your configuration data outside of a standard configuration file, encrypt it however you like, or redirect requests for configuration in any way you see fit:

  • Redirecting Configuration with a Custom Provider - Wrox
  • Implementing a Protected Configuration Provider - MSDN
  • Protected Configuration - Blayd Software

The beauty of this approach is that nothing changes in your existing applications. They don't need to know where their configuration is stored. The retrieval of configuration data is isolated in the provider. You can store it in a central file, store it in a database, or access it via a web service. If you change your mind, you only have to update your provider. Everything else stays the same.

Manage custom, machine specific configuration files in Salt

I don't know about Salt but in general in Configuration Management tools there is groups of hosts for several machines with the same configuration, templates and variables for customization for each machine
for example you can specify variable port=8888 for host1 and port=9999 for host2 but nginx-template will be something like this:

server {
listen {{port}};
}

for the both servers.
The same idea with machine specific data example(ansible):

- name: start container with mon
docker:
name: test-mongo
state: reloaded
image: mongo
when: master_ip == ansible_default_ipv4.address

where master_ip is my variable and ansible_default_ipv4.address is ip which ansible was connected to this host.

Hope this helps.



Related Topics



Leave a reply



Submit