cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
897
Views
0
Helpful
4
Replies

Using an input variable as hostname in a target

Prakash Hemchand
Cisco Employee
Cisco Employee

Hi All,

To automate the installation of the Tidal Agent for TES, I'm setting up a workflow in CPO.

The hostnames where the agent will be installed should be an input variable supplied by the person running the workflow.

Here is the variable we’d like to use to identify the target host.

However I’m not able to select this variable in the target tab.

I was wondering if there is some type of conversion we need to do on the input variable so it can be used to define the target?

Thanks!

1 Accepted Solution

Accepted Solutions

Shaun Roberts
Cisco Employee
Cisco Employee

You might be interested in my blog, particularly my "One interface to rule them all" series where I take PO and write a demi-TES API/adapter for the TES Web services as well.

https://supportforums.cisco.com/community/netpro/data-center/intelligent_automation/blog/2012/06/30/pondering-automation-the-one-interface-to-rule-them-all

https://supportforums.cisco.com/community/netpro/data-center/intelligent_automation/blog/2012/07/23/pondering-automation-the-one-interface-to-rule-them-all-part-2

If the name input is the same as the hostname, then like Mike says, do a find targets where the hostname = input.

Another more complete option would be ...

1) take the hostname as an input

2) use the NBWS to dynamically create a windows target to that hostname on the fly

3) use an XPATH query to pull the resultant target GUID from that NBWS call

4) Do a find-target where the Target.Id = Your XPATHed GUID

5) Do your work on the new target

6) delete target if you wish

I use steps 2-4 in *ALOT* of my stuff and it works quite well. You'll find it all over my blog posts too... feel free to email me if you need further info.

--Shaun Roberts
Principal Engineer, CX
shaurobe@cisco.com

View solution in original post

4 Replies 4

meisenst
Level 4
Level 4

There are two ways to do this.

First, use the "Find Targets" activity to match target names (string) to your input variable (string).  It will return a set of Target objects that you can either loop through (for-each) or can just choose the first or last.  First is a good way to do it if you know you'll only have one returned.

The second way is to use the Target Group rules.  You can tell the activity to target "all targets of a particular type" and then use a rule to say "where Target.Name = Process.Variables.Input.Target_Name" so that you have a string-string comparison again.  This will "broadcast" the activity to run on all targets that match, which of course is a field of one if your target name is a perfect match for the input string.

There are other options, such as picking the target for the process at runtime.  I can't see your images in the post above, so I'm just talking about available options.

Thank you MIchael for taking the time to respond.  To add some complexity here (which I didn't mention), a lot of our provisoning of TAU agents will be on new hosts which are not currently defined in CPO as targets so I'm not sure we can use the find targets activity in this case.  I wonder if there is an easy way to dynamically create the target on the fly..  I'm just reading Christopher's response below. I'll give that one a try.

Thanks again,

Prakash

Shaun Roberts
Cisco Employee
Cisco Employee

You might be interested in my blog, particularly my "One interface to rule them all" series where I take PO and write a demi-TES API/adapter for the TES Web services as well.

https://supportforums.cisco.com/community/netpro/data-center/intelligent_automation/blog/2012/06/30/pondering-automation-the-one-interface-to-rule-them-all

https://supportforums.cisco.com/community/netpro/data-center/intelligent_automation/blog/2012/07/23/pondering-automation-the-one-interface-to-rule-them-all-part-2

If the name input is the same as the hostname, then like Mike says, do a find targets where the hostname = input.

Another more complete option would be ...

1) take the hostname as an input

2) use the NBWS to dynamically create a windows target to that hostname on the fly

3) use an XPATH query to pull the resultant target GUID from that NBWS call

4) Do a find-target where the Target.Id = Your XPATHed GUID

5) Do your work on the new target

6) delete target if you wish

I use steps 2-4 in *ALOT* of my stuff and it works quite well. You'll find it all over my blog posts too... feel free to email me if you need further info.

--Shaun Roberts
Principal Engineer, CX
shaurobe@cisco.com

Thank you Christopher (or Shaun?).  Looks like you've already done a lot of work in this domain.  I'll review your blog posts and we definitely should work together going forward.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: