Re: Retrieving external ip in .erb template


Stevo Slavić <sslavic at gmail.com...>
 

Thanks for reply Dmitriy!


I needed a script that gives me static vip of instance, one which does not
change (without changes to deployment manifest).
I tried and found out that spec.networks.marshal_dump.first[1].ip gives me
elastic ip, not the static vip of instance.

I'm worried, if templates get applied only during "bosh deploy", if events,
other than "bosh deploy", are possible where elastic ip can change without
templates being reevaluated, then advertised ip in configuration file will
be stale/outdated, not in sync with actual elastic ip of vm, and kafka will
not be reachable through advertised ip, but it will be accessible through
static vip, resulting in all sorts of failures.

So, is it possible that elastic ip changes without templates being
reevaluated? If yes, then I need a way to determine instance static vip in
configuration file template.

Kind regards,
Stevo Slavic.

On Wed, May 27, 2015 at 3:02 AM, Dmitriy Kalinin <dkalinin(a)pivotal.io>
wrote:

Concourse release (github.com/concourse/concourse) does something like
this:
https://github.com/concourse/concourse/blob/master/jobs/atc/templates/atc_ctl.erb#L18-L39

Your example should work also.

On Fri, May 22, 2015 at 8:16 AM, Stevo Slavić <sslavic(a)gmail.com> wrote:

Hello Bosh community,

Is it possible to retrieve external ip in .erb template?

I'd like to release/deploy Apache Kafka using Bosh, and one of the
properties to configure in Kafka server.properties is
advertised.host.name - every instance needs to know it's external ip, to
advertise it to others.

Should something like:

advertised.host.name=<%= spec.networks.marshal_dump.first[1].ip %>

work?

Kind regards,
Stevo Slavic.

_______________________________________________
cf-bosh mailing list
cf-bosh(a)lists.cloudfoundry.org
https://lists.cloudfoundry.org/mailman/listinfo/cf-bosh

Join cf-bosh@lists.cloudfoundry.org to automatically receive all group messages.