Bulk Node registration

From ControlTier

Jump to: navigation, search

Information about the Nodes in your environment can be registered to the ControlTier server using a project.xml file and the node tag.

If you install the ControlTier client, nodes are registered to a project by ctl-project during project setup but this page describes how to use an XML file to declare many nodes inside one file and then use ProjectBuilder to load their definitions. The clients obtain this data from the server as resources.xml.

Contents

Definition

Create a project.xml file and use the node tag to declare node metadata. Node tag attributes convey basic metadata described below:

attributedescriptionexample value
typenode typeNode
namenode namea name
descriptionnode descriptiona character string
hostnameThe hostname or IP address of the remote host to which you wish to connect. Can include port (eg hostname:port) if non-standard SSH port is requireda valid hostname
osArchoperating system architecture(eg uname -p)
osFamilyoperating system familywindows or unix
osNameoperating system name(eg uname -s)
osVersionoperating system version(eg uname -r)
ctlBaseCTL framework instance directoryCT_BASE
ctlHomeCTL software installation root directoryCTL_HOME
ctlUsernameThe username on the remote host to which you are connecting.(eg ${framework.ssh.user}
ctlPasswordremote connection passwordUnceccessary when using key-based authentication
tagsFiltering tags

The example file called "nodes.xml" below defines two nodes: ubuntu and centos54-vm1. Each node declares its hostname value as its IP address and they both declare the use of a common ctlUsername value, "demo".

The hostname and ctlUsername values are used for SSH connections during command dispatch (analogous to saying ssh ctlUsername@hostname) . No ctlPassword values were declared which means key-based authentication will be used.

File listing: nodes.xml

<!DOCTYPE project PUBLIC
        "-//ControlTier Software Inc.//DTD Project Document 1.0//EN" "project.dtd">
<project>
 
  <node name="ubuntu" type="Node"
    description="an ubuntu host"
    hostname="172.16.167.211"
    osArch="i386" osFamily="unix" osName="Linux" osVersion="2.6.27-7-generic"
    ctlUsername="demo" 
    tags="mac,development"/>
 
  <node name="centos54-vm1" type="Node"
    description="a centos host"
    hostname="172.16.167.129"
    osArch="i686" osFamily="unix" osName="Linux" osVersion="2.6.18-164.el5"
    ctlUsername="demo" 
    tags="server,qa"/>
 
</project>

Loading the definition

On a host where the ControlTier client has been installed and setup, run ProjectBuilder's load-resources command and specify the XML file.

Here load-resources is used to load the "nodes.xml" file into the project called "demo":

ctl -p demo -m ProjectBuilder -c load-resources -- -filename nodes.xml
.
.
Batch request performed successfully.

Successful completion will result with a "Batch request performed successfully." message.

Confirming access

With the hosts defined as Nodes in the project's resource model, it is important to confirm access for the command dispatcher. Do this by running a trivial command across all hosts via the ctl-exec command like so:

ctl-exec -p demo --keepgoing -I '.*' -- uname -a

Output from a successful run of the uname command would look similar to the messages below:

[alexh@strongbad ctl-exec][INFO] Darwin strongbad 10.5.0 Darwin Kernel Version 10.5.0: Fri Nov  5 23:20:39 PDT 2010; root:xnu-1504.9.17~1/RELEASE_I386 i386
[demo@ubuntu ctl-exec][INFO] Linux ubuntu 2.6.27-7-generic #1 SMP Fri Oct 24 06:42:44 UTC 2008 i686 GNU/Linux
[demo@centos54-vm1 ctl-exec][INFO] Linux ubuntu 2.6.27-7-generic #1 SMP Fri Oct 24 06:42:44 UTC 2008 i686 GNU/Linux

Let's imagine the value specifying ctlUsername for the ubuntu Node was incorrect (e.g., a bogus "demox" login) . An incorrect ctlUsername value would cause an error during command dispatch. Here's an example message indicating such an SSH related problem. In this case, a JSchException is thrown because the erroneous "demox" value was used in ubuntu's ctlUsername attribute.

[demox@ubuntu ctl-exec][ERROR] Failed execution for node: ubuntu: com.jcraft.jsch.JSchException: Auth cancel
error: Execution failed on the following 1 nodes: [ubuntu]
error: Execute this command to retry on the failed nodes:
	ctl-exec -K -p demo -I name=ubuntu -- uname -a

The Auth cancel message above shows that when connecting to the ubuntu Node an SSH authentication error occurred. It is possible to mimic the command dispatcher's SSH connection request to ubuntu like so:

ssh -I $(awk '/framework.ssh.keypath/ {print $3}' $CTL_BASE/etc/framework.properties) demox@ubuntu uname -a

The awk command parses the client configuration to lookup the path to the SSH identity file. Had the ctlUsername value been correct and an "Auth cancel" error still occurred it's probable that server's public key was not added to the target hosts user's authorized_keys file.

Querying

Use ctl-exec listing mode to print out the registered nodes.

Example

List the nodes defined in the "demo" project resource model:

$ ctl-exec -p demo
ubuntu centos54-vm1


Personal tools
Namespaces
Variants
Actions
Navigation
Communication
Development
Toolbox
Print/export