Hi,
I'm looking for a way to setup as early as possible some settings on my new minion instantiated on AWS EC2, and in particular setting up the hostname.
I'm currently creating these instances via salt-cloud and the ec2 driver, and I'm using an AMI which is launching "cloud-init" at startup time. When I run my highstate on the new instances, on the first thing I'm doing is to set up the hostname, but grains don't get reloaded after that, and grains['fqdn'] is still giving the original name given by AWS until I run a second highstate. And so for a while, I got minions which have a seemlessly random hostname which is used by some applications, until the second highstate finished and everything is in order again.
So, I thought I could use the cloud-init package and passing the related hostname settings into the instance's "user-data". Apparently, passing user-data is now supported, although it's not documented (cf.
https://github.com/saltstack/salt/issues/12072#issuecomment-151155379).
I wonder however how I could set different user-data per-minion, using salt-cloud? Is there a way to configure the new instances configuration from salt-cloud? I can't find this anywhere in the documentation. What I'm looking to do is to have a salt-cloud profile definition with a way to say "this value here is the minion ID which I'm creating a new instance", or something similar.
Thanks for your help!
Jonathan