Skip to content

Instantly share code, notes, and snippets.

@benhosmer
Created September 18, 2013 20:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benhosmer/6614817 to your computer and use it in GitHub Desktop.
Save benhosmer/6614817 to your computer and use it in GitHub Desktop.
Populate a jinja variable in a configuration file.
/srv/salt/populate/init.sls:
{% set host_name = grains['host'] -%}
testfile:
file:
- managed
- name: /home/vagrant/testfile
- source: salt://populate/testfile
- template: jinja
- defaults:
name: {{ host_name }}
/srv/salt/populate/testfile:
This is a test-file that contains some stuff.
This is a jinja variable: {{ name }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment