[Openstack] Mitaka - Why "OS::Neutron::FloatingIPAssociation" requires "fixed_ips" on "OS::Neutron::Port" ?

Turbo Fredriksson turbo at bayour.com
Sat Oct 15 11:27:19 UTC 2016


On Oct 14, 2016, at 11:13 PM, Martinx - ジェームズ wrote:

> Looks like that it requires fixed_ips! Why is that?

What version have you set for your stack?

Part of my stack looks like:

----- s n i p -----
heat_template_version: 2016-04-08
description: Instance template
[..]
resources:
[..]
  port:
    type: OS::Neutron::Port
    properties:
      name: { get_param: name }
      network: { get_param: network }
      security_groups: { get_param: secgrps }
----- s n i p -----

And that works just fine - no need for fixed_ips.

>      name: {"Fn::Join": ["-", [{ get_param: "OS::stack_name" } ,
> "instance-port-1"]]}

Hint: Use list_join instead..


Oh, and just to 'blow your mind', this is one of my absolute
"worst" :)

----- s n i p -----
  instance:
    [create the instance using OS::Nova::Server]

  record:
    type: Turbo::Record
    properties:
      dnsname: { list_join:
                   ['-', [
                     { get_param: name },
                     { str_split: ['.', { get_attr: [instance, first_address] }, 3] },
                   ] ]
                 }
      dnsdomain: domain.tld.
      data: { get_attr: [instance, first_address] }

  reverse:
    type: Turbo::Record
    properties:
      dnsname: { str_split: ['.', { get_attr: [instance, first_address] }, 3] }
      dnsdomain: { list_join:
                   ['.', [
                     { str_split: ['.', { get_attr: [instance, first_address] }, 2] },
                     { str_split: ['.', { get_attr: [instance, first_address] }, 1] },
                     { str_split: ['.', { get_attr: [instance, first_address] }, 0] },
                     'in-addr.arpa.'
                   ] ]
                 }
      data: { list_join:
                ['.', [
                  { list_join:
                    ['-', [
                      { get_param: name },
                      { str_split: ['.', { get_attr: [instance, first_address] }, 3] },
                    ] ]
                  },
                  'domain.tld.'
                ] ]
            }
      rec_type: PTR
----- s n i p -----

With 'Turbo::Record' defined as

----- s n i p -----
heat_template_version: 2016-04-08
description: Designate domain record template

parameters:
  dnsdomain:
    type: string
    description: Domain name to attach dnsname to
    default: domain.tld
  
  dnsname:
    type: string
    description: Host name to attach to domain
  
  data:
    type: string
    description: IP address to attach to IP
  
  rec_type:
    type: string
    description: DNS record type
    default: A

resources:
  record:
    type: OS::Designate::Record
    properties:
      description: { list_join: [' - ', [ 'Floating IP DNS Record', { get_param: dnsname } ] ] }
      name: { list_join: ['.', [ { get_param: dnsname }, { get_param: dnsdomain } ] ] }
      domain: { get_param: dnsdomain }
      data: { get_param: data }
      type: { get_param: rec_type }
----- s n i p -----

I use it for creating a DNS record for the instance in Designate,
because a auto scaling group doesn't have a "counter" ('%index%')
like a resource group have..
--
Choose a job you love, and you will never have
to work a day in your life.





More information about the Openstack mailing list