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?

| improve this question | | | | |
-2

Clearing the mine data has fixed this problem:

salt '*' mine.flush
| improve this answer | | | | |
  • That command doesn't make sense to fix grains issues. Probably you had wrong hostname or a wrong /etc/hosts file. – Diego Woitasen Feb 22 '16 at 1:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.