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

2016-10-17 Thread Martinx - ジェームズ
That's an amazing tip, thank you!

On 15 October 2016 at 07:27, Turbo Fredriksson  wrote:

> 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?
>

I was still using 2013-05-23 specs, lol...


>
> 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.
>

Awesome, it worked!


>
> >  name: {"Fn::Join": ["-", [{ get_param: "OS::stack_name" } ,
> > "instance-port-1"]]}
>
> Hint: Use list_join instead..
>

Good, working too...


>
>
> 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..
>

Hmmm... This is very interesting... I was expecting to use the %index% with
AutoScaling but, now that you said it doesn't work, I'll definitely give
Designate a try.


> --
> Choose a job you love, and you will never have
> to work a day in your life.


Absolutely!

Cheers!
Thiago
___
Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
Post to : openstack@lists.openstack.org
Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack


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

2016-10-15 Thread Turbo Fredriksson
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.


___
Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
Post to : openstack@lists.openstack.org
Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack