2011-09-07

Setting Up Salt

Salt is a remote execution manager which allows a system administrator to run multiple commands across many systems in their enterprise at once. Similar to Func, I am looking at it as a configuration tool written in python that I can grok better than I am at puppet.

To start with we worked from the central home server by installing the following rpms:

  1. https://github.com/downloads/thatch45/salt/salt-0.8.9-1.el5.noarch.rpm
  2. https://github.com/downloads/thatch45/salt/python-zmq-2.1.7-1.el6.x86_64.rpm
  3. https://github.com/downloads/thatch45/salt/zeromq-2.1.7-1.el6.x86_64.rpm

$ sudo yum localinstall salt*rpm python-zmq*rpm zeromq*rpm

Now some prep work is needed here. We need to setup the hostname for the salt server in DNS and or /etc/hosts so that our clients can find it. After that we can start the master and minion on our first box.

$ sudo /sbin/chkconfig --add salt-master
$ sudo /sbin/chkconfig --add salt-minion
$ sudo /sbin/service salt-master start
$ sudo /sbin/service salt-minion start

The next clients will only have the minion added. The master will be off as we aren't ready to deal with multi-master setups. So what can we do with salt? Well we can run cmds and such

$ sudo salt '*' cmd.run "ls -l /etc/hosts"        
xanadu.int.smoogespace.com: -rw-r--r--. 1 root root 209 Sep  7 14:59 /etc/hosts
xanadu.int.smoogespace.com: 

$ sudo salt '*' user.info smooge
{'xanadu.int.smoogespace.com': {'gid': 500,
                                'groups': ['desktop_admin_r',
                                           'mock',
                                           'wheel'],
                                'home': '/home/smooge',
                                'name': 'smooge',
                                'passwd': 'x',
                                'shell': '/bin/bash',
                                'uid': 500}}
$ sudo salt '*' status.diskusage /
{'xanadu.int.smoogespace.com': {'/': {'available': 13899972608,
                                      'fstype': 'ext4',
                                      'total': 16910295040}}}


However I then ran into some limitations. I am trying to figure out what might have caused them, but they are rather interesting:

salt '*' pkg.list_pkgs
{'xanadu.int.smoogespace.com': {}}

salt '*' file.get_sum /etc/passwd    
{'xanadu.int.smoogespace.com': 'Hash md5 not supported'}

There should be quite a bit more packages there than that, and I think md5sum is supported. I am guessing there are some packages I need to install or check in the files. Will get to that in my next blog on this.

1 comment:

Anonymous said...

If you're looking for a puppet-like tool entirely based on python, try bcfg2, you may even like it.