Browse Source

defining values from a template

master
Nicolas Massé 8 years ago
parent
commit
adc128fd2d
  1. 1
      value-from-template/output.j2
  2. 14
      value-from-template/value-from-template.yaml

1
value-from-template/output.j2

@ -0,0 +1 @@
Hello {{ myname }}, foo = {{ foo }}

14
value-from-template/value-from-template.yaml

@ -0,0 +1,14 @@
- name: The value of a variable can be computed from a Jinja template, stored in a file
gather_facts: no
hosts: localhost
vars:
foo: 'bar'
myname: 'Nicolas'
output: '{{ lookup(''template'', ''output.j2'') }}'
tasks:
- debug:
var: 'output'
- assert:
that:
- output == 'Hello Nicolas, foo = bar'
Loading…
Cancel
Save