This can be annoying when using SaltStack, you run
saltutil.sync_grains, or a
highstate, but your custom grain is never synced to the minion. This happened to me while using multiple environments and when the grain was not in the base environment. What worked for me to get a successful sync was to pass the
saltenv argument with the value of the environment that had the grain.
$ salt "theminion" saltutil.sync_grains saltenv=env_with_grain