First, you have to enable templating of this config file:
/etc/newrelic/nrsysmond.cfg:
file.managed:
(...)
- template: jinja
And then this file is treated as jinja template:
hostname={{ grains.id }}
name of the minion is available in grains.id
. (You can run salt-call grains.items
to see
available grains. If you need more flexibility in assigning variables, read up about pillars).