You can use target substitution variables to get values directly from a particular host
Target substitution variables use the following syntaxes:
:[target:varname] :[target(hostname):varname] |
Variable names that begin with target refer to the logical host upon which a plan is currently being run.
The varname parameter you add after the colon represents an attribute value that is specified in the target host's definition for the application you are installing.
If you specify a (hostname) right after target, the value for varname is retrieved from that particular host, which can be a different host than the host the plan is currently being run on. You can also specify another substitution variable for hostname that, when expanded, resolves to the name of a host.
Host Redirects
Host substitution references and external component substitution references may optionally include a host redirect, in which case the host on which the variable or component lookup will occur is redirected from the current target to a named host. A host redirect has one of the following forms:
parent-ref hostname hostname/parent-ref
Where hostname is either the name of a ROX host, or a substitution variable reference that, when expanded, resolves to the name of a ROX host.
And parent-ref is either "/", meaning the root parent host of the named host (or current target host if hostname is omitted), or a series of one or more slash-separated "..", meaning the nth parent of the named host (or current target host if hostname is omitted) where "n" is the number of ".." that appear. The parent-ref operators are meant primarily for use with virtual hosts, though they may be used with physical hosts as well. Applying either operator to a physical host is a no-op.
Here are some examples of using target substitution variables:
This example specifies to look up variable var1 on host myHost.
:[target(myHost):var1] |
This example specifies to look up variable var1 on host named by substitution variable hostName
:[target(:[hostName]):var1] |
This example specifies to look up variable var1 on the logical host on which the plan is currently running.
:[target:var1] |
The following are variables predefined for target hosts:
name – the name of the target host
description – description of the target host
hostTypeName – the name of the host type of the target host
raIP –the IP address of the remote agent on the target host
raPort – port used by the remote agent on the target host
raHomeDir - absolute path of the remote agent home directory on the target host
raDataDir - absolute path of the remote agent data directory on the target host
raTmp Dir - absolute path of the remote agent temporary directory on the target host
raConfigDir - absolute path of the remote agent config directory on the target host
In addition to the predefined variables, you can also reference any host attribute declared by the host type of the target host.
The following is an example of the list of variables defined in a component for apache:
<varList> <var name="domainname" default=":[target: domainname]" /> <var name="name" default="apache" /> <var name="installPath" default="/opt/apache" /> <var name="execNativeShutdown" default=":[installPath]/bin/apachectlstop" /> <var name="execNativeStartUp" default=":[installPath]/bin/apachectlstart" /> </varList> |
This component specifies that the domain name be dynamically retrieved from the target host, defines the default value of `name' to be `apache', and then specifies a variable installPath value to use in the definition of two execNative variables.
Although you cannot use a target substitution variable within a configuration file, you can reference a host-specific value from within a configuration file. This is because the value of the variable you reference may be computed as a host-specific value. For example, you might have the following variable defined within the <varList> section of the component:
<var name="pants" value=":[target:pie]"> |
and then reference :[pants] from within a configuration file. When :[pants] is substituted, it will be substituted with the value of the pie variable defined by the target host.