-
Notifications
You must be signed in to change notification settings - Fork 4
/
c0021.yml
53 lines (48 loc) · 1.27 KB
/
c0021.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
doc_meta: |
folder: vars
title: use golang template
head: |
Demo to show using template
Please note that you can not reference to a sub element if it is in string literal, such as example of .info.school
sections:
- title: Demo
log: yes
notes:
goal:
- to show using template
tasks:
- name: task
task:
-
func: shell
vars:
student: Tom
gender: Male
school: Sydney Grammar
info: |
student: Tom
gender: Male
school: Sydney Grammar
do:
- |
echo """my student: {{.student}}
student's gender: {{.gender}}
school's name: {{.school}}"""
- |
{{$details := .}}
echo """my student: {{$details.student}}
student's gender: {{$details.gender}}
school's name: {{$details.school}}"""
- |
{{$a := .student}}
{{$b := .gender}}
{{$c := .school}}
echo """my student: {{$a}}
student's gender: {{$b}}
school's name: {{$c}}"""
- |
echo """my school: {{.info.school}}"""
- |
echo """my student: {{.info}}"""
flags:
- ignoreError