VMware Employee
VMware Employee

Find IP Address of Machine

Jump to solution

How do I specify the IP address of a vRA machine in my yaml code?  I have tried ${resource.componentname.address} and ${resource.componentname.ipaddr} and they both return null.  In the cloudConfig section of my blueprint i want to echo the IP address of one machine into a configuration file for a second machine in my blueprint.

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
VMware Employee
VMware Employee

Solution:

Using ${resource.componentname.address} is correct, but the cloudConfig section is evaluated before the machine is provisioned, so therefore is null.  If I could look at that property after the machine was provisioned, I would see its IP address. 

So if your blueprint has two machine: webserver and dbserver.  And the webserver was dependent on the dbserver, then in the cloudConfig section for the webserver, you could do this:

${resource.dbserver.address} and it will evaluate the dbserver's IP address.  So maybe you want to store the dbserver IP address in some configuration file on the webserver.

If you needed the IP address of the server itself, then use OS commands, like ipconfig or ifconfig to find its IP address.

I did get the two machine blueprint to work.  I had some help on this solution.  Thank you to all that helped.

View solution in original post

0 Kudos
3 Replies
VMware Employee
VMware Employee

Hello,

Could please try:

${resource["db-tier"].address}
0 Kudos
VMware Employee
VMware Employee

Still get a null value.

Here is more details about my attempts.  If we don't specify the count property, vRA defaults to 1.  But if I don't explicitly set the count property and log it with ${resource.componentname.count}, I get a null value.  If I explicitly the count property to 1, I get "1" logged.

I created an ABX action to set the address property to a fixed IP address.  When I do that, that IP address does get logged via ${resource.compenentname.address}.  This ABX action though did not actually set the IP address of the machine, just the address property for me to log it.

So I am still struggling trying figure out how to specify the IP address of the machine in my yaml code.

0 Kudos
VMware Employee
VMware Employee

Solution:

Using ${resource.componentname.address} is correct, but the cloudConfig section is evaluated before the machine is provisioned, so therefore is null.  If I could look at that property after the machine was provisioned, I would see its IP address. 

So if your blueprint has two machine: webserver and dbserver.  And the webserver was dependent on the dbserver, then in the cloudConfig section for the webserver, you could do this:

${resource.dbserver.address} and it will evaluate the dbserver's IP address.  So maybe you want to store the dbserver IP address in some configuration file on the webserver.

If you needed the IP address of the server itself, then use OS commands, like ipconfig or ifconfig to find its IP address.

I did get the two machine blueprint to work.  I had some help on this solution.  Thank you to all that helped.

View solution in original post

0 Kudos