Error: grains.domain fails to populate during Jinja rendering on Azure Salt Minions
search cancel

Error: grains.domain fails to populate during Jinja rendering on Azure Salt Minions

book

Article ID: 445660

calendar_today

Updated On:

Products

VCF Operations/Automation (formerly VMware Aria Suite)

Issue/Introduction

  • 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

  1. Cloud-Init Fix: Ensure the cloud-init script explicitly sets the FQDN/domain before the Salt Minion service starts or registers.
  2. Pre-Execution: If using custom images, verify that /etc/hosts and hostname configurations are finalized before the minion heartbeat.
  3. 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.