← Back to team overview

cloud-init team mailing list archive

cloud-config YAML variable substitution

 

Hello,

I'm not sure this is the place to ask my question, and it any case
this is something which looks so trivial that I must be missing
something, but - how to parametrize the cloud-config YAML files with
variable expansion?

Specifically, I need it for a scenario where I'm installing chef with
cloud-init, and one of the attributes chef has is "node_name" which if
not set defaults to the instance id, a string of the form
"i-0000009f". This non-human-readable string then gets registered as
the node name in Chef, but instead of that, I'd like to use the
hostname as created and passed by the cloud infrastructure (OpenStack
in my case).

I'm sure this is not the only place where it would be nice to
customize the cloud-config data with some actual dynamic information
so - how can it be done? I've tested some of the "usual suspects" in a
string like "test %(hostname) %(fqdn) %(instance_id) $fqdn %f
$INSTANCE_ID" but none of those work.

Any ideas?


Follow ups