0

Using {{ grains['host'] }} in a managed file returns the following error:

 Function: file.managed
      Result: False
     Comment: Unable to manage file: Jinja variable dict object has no element Undefined; line 54

              name = {{ grains['host'] }}    <======================

Sls:

/usr/file.conf:
  file.managed:
    - source: salt://file.jinja
    - template: jinja
    - user: root
    - group: root
    - mode: 644

I have grains working fine elsewhere. Any thoughts?

Joseph Gardner
  • 41
  • 1
  • 1
  • 7

1 Answers1

-2

Clearing the mine data has fixed this problem:

salt '*' mine.flush
Nixphoe
  • 4,524
  • 7
  • 32
  • 51
Joseph Gardner
  • 41
  • 1
  • 1
  • 7