[Openstack-operators] [heat] Is there a way to create a OS::Neutron::Net from a network parameter?
rezroo
openstack at roodsari.us
Wed Nov 2 05:29:34 UTC 2016
Hi - I'm trying to create a OS::Neutron::LoadBalancer on the first
subnet of a network being supplied as a parameter. So I don't want to
create the network - it's an input parameter - and I don't want/need the
subnet as a parameter - any subnet defined on the network will do.
I cannot figure out how to get the subnet id of the network. In the code
below I tried to create a port on the network and then extract the value
of the subnet to use in creating the OS::Neutron::Pool but I end up with
an extra port. I tried to use the port ip address for the VIP but
OS::Neutron::Pool wants to create the vip port, and complains that the
IP address is already in use.
My question is how do we create a resource from a parameter when we
already have the resource id or name, so the attributes can be queried
in subsequent resource definitions? Is there a way to do that in heat?
heat_template_version: 2015-10-15
description: Make a load balancer with a floating ip without a subnet
parameters:
network:
type: string
description: Network used by the server
external_network_id:
type: string
description: UUID of a Neutron external network
resources:
make_port_on_the_net:
type: OS::Neutron::Port
properties:
name : {list_join : [":", ["vip" , {get_param: network}]] }
network: {get_param: network }
monitor:
type: OS::Neutron::HealthMonitor
properties:
type: TCP
delay: 5
max_retries: 5
timeout: 5
pool:
type: OS::Neutron::Pool
properties:
protocol: HTTP
monitors: [{get_resource: monitor}]
subnet: {get_attr: [make_port_on_the_net, fixed_ips, 0, subnet_id]}
lb_method: ROUND_ROBIN
vip:
protocol_port: 80
address: {get_attr: [make_port_on_the_net, fixed_ips, 0,
ip_address]}
lb:
type: OS::Neutron::LoadBalancer
properties:
protocol_port: 80
pool_id: {get_resource: pool}
# assign a floating ip address to the load balancer
# pool.
lb_floating:
type: OS::Neutron::FloatingIP
properties:
floating_network_id: {get_param: external_network_id}
port_id: {get_attr: [pool, vip, port_id]}
outputs:
port_show:
value: {get_attr: [make_port_on_the_net]}
description: Dump all the port attributes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-operators/attachments/20161101/9812833e/attachment.html>
More information about the OpenStack-operators
mailing list