grains.domain or grains.fqdn values are blank or "dot-less" (shortname) during state.apply.
Running salt-call grains.get domain locally on the minion returns the correct value, but the Master-rendered template remains empty.
Log snippets show Jinja variables evaluating to empty strings in files like /etc/opt/quest/vas/vas.conf.
Environment
. Environment
Cloud Provider: Microsoft Azure
Product: VMware Aria Automation Config
Cause
Azure DHCP Race: Salt Minion starts before Azure DHCP assigns the DNS suffix/FQDN. The Master caches the initial stale hostname.
Rendering Phase: Jinja renders the entire SLS file at compile-time. A saltutil.refresh_grains state within the same file cannot update variables already processed during the rendering phase.
Resolution
Cloud-Init Fix: Ensure the cloud-init script explicitly sets the FQDN/domain before the Salt Minion service starts or registers.
Pre-Execution: If using custom images, verify that /etc/hosts and hostname configurations are finalized before the minion heartbeat.
Manual Refresh: If a stale cache exists on the Master, run salt '*' saltutil.refresh_grains and salt '*' saltutil.refresh_pillar separately before the next state application.