Introduction


Hosttag is a client for tagging hostnames into groups or classes, storing the mappings in a redis datastore. It requires the ‘redis’ rubygem.

Hosttag assumes your redis server is found on a server called ‘hosttag’ on the default redis port (6379). You can either setup ‘hosttag’ as a hostname alias in a local hosts file, or specify an alternative host to use in a HOSTTAG_SERVER environment variable, or explicitly via a -s/–server <hostname> argument. Similarly, an alternate port can be specified using a HOSTTAG_PORT environment variable, or a -p/–port <port> command line argument.

Basic Usage


# Set some tags (-T says assume anything you don't know is a tag)
$ htset -T zeus dell centos centos5 server
$ htset -T minerva dell centos centos6 laptop
$ htset -T hermes hp ubuntu lucid desktop
$ htset -T athena hp ubuntu maverick server

# Queries
$ ht dell               
minerva zeus

$ ht ubuntu
hermes athena

$ ht -o hp dell         # -o/--or ORs arguments
hermes minerva zeus

$ ht -a ubuntu server   # -a/--and ANDs arguments
athena

$ ht -A                 # all hosts
athena hermes minerva zeus

$ ht -T                 # all tags
centos centos5 centos6 dell desktop hp laptop lucid maverick server

Security


A warning on security: basically, there isn’t any. Anyone who can get write to your redis server can write, rewrite, and delete all your hosttags. So you should only use hosttag on a trusted network.

Redis supports a password-ed mode, and it might make sense to use that via a config file or something, so you could at least restrict usage via file permissions (although traffic would still be in the clear, I believe). For now, though, there’s no security.

Installation


To install from source, unpack the tarball and run ‘rake install’ (requires rubygems and rake). You can set GEM_HOME to an alternate install directory (e.g. ~/.gem) if you want to install somewhere other than your gem default.

RPMs are available for CentOS/RHEL 5,6 from the Open Fusion repository:

http://www.openfusion.net/linux/openfusion_rpm_repository

Author


Gavin Carr <[email protected]>, www.openfusion.net/

Copyright 2010-2011 Gavin Carr.

Licence


This software is free software, licensed under the GNU Public License v3 or any later version.