I am trying to use ec2 metadata variables in cloud-init. I need to pass local-ipv4 address as argument to consul container:
#cloud-config
rancher:
cloud_init:
datasources:
- ec2
services:
consul:
image: progrium/consul
net: host
command: -server -node=consul -bootstrap -bind=${local-ipv4} -client=${local-ipv4} -advertise=${local-ipv4}
after instance boot i got such messages in logs:
==> Starting Consul agent...
==> Error starting agent: Failed to parse advertise address: ${local-ipv4}
and here is a part of "docker inspect "
"Args": [
"-server",
"-log-level",
"debug",
"-node=consul",
"-bootstrap",
"-bind=${local-ipv4}",
"-client=${local-ipv4}",
"-advertise=${local-ipv4}"
I can use /opt/rancher/bin/start.sh script for those purposes, but is there any way to use EC2 metadata variables.
thank you
ok it was my mistake, correct syntax for metadata variables is: $private_ipv4
Hi,
local-ipv4 maps to $private_ipv4? Is there a reference for this? What do the other variables map to (e.g. instance-id)?
pavlod
4
I don’t sure about any documentation about it, I found it in:
If you will find more info about it pls. share.
Thank you.
Was looking around those. Seem to be the only available.