Ask Your Question
1

How to read attributes of existing network in Heat template

asked 2014-12-18 12:04:59 -0500

alex123 gravatar image

updated 2014-12-21 02:24:26 -0500

I'm writing a simple Heat template that deploys new server into existing network and subnet. So I have this in my template:

parameters:
  ...
  public_net:
    type: string
    description: ID of public network into which servers get deployed
  public_subnet:
    type: string
    description: ID of public subnet into which servers get deployed

resources:
  server1_port1:
    type: OS::Neutron::Port
    properties:
      network: { get_param: public_net }
      fixed_ips:
        - subnet: { get_param: public_subnet }

  server1:
    type: OS::Nova::Server
    properties:
      name: sbc1
      image: { get_param: image }
      flavor: { get_param: flavor }
      key_name: { get_param: key_name }
      networks:
        - port: { get_resource: server1_port1 }

It works fine. But now I need to configure something on my server that uses network's CIDR, default gateway and DNS server IP. And here's where I'm stuck. Since subnet was not created in my template (I'm passing its name as parameter) I can't figure out how can I read its attributes.

I'm sure this is trivial. Just point me to the right direction, please...

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2014-12-23 18:55:25 -0500

Darkinvader gravatar image

I am pretty sure you can figure this out when you read this:

https://github.com/openstack/heat-templates/blob/master/hot/autoscaling.yaml (https://github.com/openstack/heat-tem...)

you are looking for part:

$db_host: {get_attr: [db, first_address]}

where db is the name of the server you need the ip of.

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

2 followers

Stats

Asked: 2014-12-18 12:04:59 -0500

Seen: 2,783 times

Last updated: Dec 21 '14