Ask Your Question
1

Get ip address of instance

asked 2015-08-01 20:15:53 -0600

Sihan gravatar image

The example below shows how the IP address of a compute resource can be defined as an output parameter:

resources:
  my_instance:
    type: OS::Nova::Server
    # ...

outputs:
  instance_ip:
    description: IP address of the deployed compute instance
    value: { get_attr: [my_instance, first_address] }
  instance_private_ip:
    description: Private IP address of the deployed compute instance
   value: { get_attr: [my_instance, networks, private, 0] }

i am wondering where does 'first address' come from? i check the document, i did not find this attribute in OS::Nova::Server

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2015-09-14 16:49:19 -0600

vikomall gravatar image

"first_address" is an attribute of Heat (Orchestration) Nova plugin/resource. It returns the first network address of the server. This attribute ('first_address') was deprecated back in Apr 11, 2014 and correct usage is to explicitly specify the network name. So, following is an example of correct usage.

{ get_attr: [nova_instance, networks, some-valid-network-name, 0] }

edit flag offensive delete link more
0

answered 2015-08-04 10:30:48 -0600

mpetason gravatar image

updated 2015-08-04 10:31:43 -0600

I believe this is configured in case an instance has multiple network interfaces. The first address is normally going to be the default IP and is in the Network associated with the Instance's gateway. For example:

ip1 : 192.168.1.17
ip2 : 192.168.2.17

Gateway:

Default: 192.168.1.1

You could test this out by adding multiple interfaces to an instance and see if the value matches.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2015-08-01 20:15:53 -0600

Seen: 1,216 times

Last updated: Aug 04 '15