on master help sign in
Add Salt State (SLS) test file
commitb07f3b4e74b104b40b4b79e2a7094cd18b9ec1c2 authorubaumann <github@m.ubaumann.ch> dateFri 23 Oct 2020, 17:04 (6 years ago) parenta3f0377
2 files changed+114
tests/syntax-tests/highlighted/SLS/test.sls+57 tests/syntax-tests/source/SLS/test.sls+57
tests/syntax-tests/highlighted/SLS/test.slsnew file+57
@@ -0,0 +1,57 @@
1+required_packages:
2+ pkg.installed:
3+ - pkgs:
4+ - git
5+ - perl
6+ - fortune
7+
8+cowsay_source:
9+ git.latest:
10+ - name: https://github.com/jasonm23/cowsay.git
11+ - target: /root/cowsay
12+
13+run_installer:
14+ cmd.run:
15+ - name: ./install.sh /usr/local
16+ - cwd: /root/cowsay
17+ - onchanges:
18+ - git: cowsay_source
19+
20+{% set cowfiles = salt.cmd.run('cowsay -l').split('\n')[1:] %}
21+{% set ascii_arts = cowfiles | join(' ') %}
22+
23+{% for ascii_art in ascii_arts.split(' ') %}
24+run_cowsay_{{ ascii_art }}: # name must be unique
25+ cmd.run:
26+ {% if ascii_art is in ['head-in', 'sodomized', 'telebears'] %}
27+ - name: echo cowsay -f {{ ascii_art }} should not be used
28+ {% else %}
29+ - name: fortune | cowsay -f {{ ascii_art }}
30+ {% endif %}
31+{% endfor %}
32+
33+echo_pillar_demo_1:
34+ cmd.run:
35+ - name: "echo {{ pillar.demo_text | default('pillar not defined') }}"
36+
37+echo_pillar_demo_2:
38+ cmd.run:
39+ - name: "echo {{ pillar.demo.text | default('pillar not defined') }}"
40+
41+# Comment
42+{% set rand = salt['random.get_str'](20) %}
43+{% set IP_Address = pillar['IP_Address'] %}
44+
45+wait:
46+ cmd.run:
47+ - name: sleep 210 # another comment
48+
49+create_roster_file:
50+ file.managed:
51+ - name: /tmp/salt-roster-{{ rand }}
52+ - contents:
53+ - 'switch:'
54+ - ' host: {{ IP_Address }}'
55+ - " user: test"
56+ - " passwd: {{ passwd }}"
57+
tests/syntax-tests/source/SLS/test.slsnew file+57
@@ -0,0 +1,57 @@
1+required_packages:
2+ pkg.installed:
3+ - pkgs:
4+ - git
5+ - perl
6+ - fortune
7+
8+cowsay_source:
9+ git.latest:
10+ - name: https://github.com/jasonm23/cowsay.git
11+ - target: /root/cowsay
12+
13+run_installer:
14+ cmd.run:
15+ - name: ./install.sh /usr/local
16+ - cwd: /root/cowsay
17+ - onchanges:
18+ - git: cowsay_source
19+
20+{% set cowfiles = salt.cmd.run('cowsay -l').split('\n')[1:] %}
21+{% set ascii_arts = cowfiles | join(' ') %}
22+
23+{% for ascii_art in ascii_arts.split(' ') %}
24+run_cowsay_{{ ascii_art }}: # name must be unique
25+ cmd.run:
26+ {% if ascii_art is in ['head-in', 'sodomized', 'telebears'] %}
27+ - name: echo cowsay -f {{ ascii_art }} should not be used
28+ {% else %}
29+ - name: fortune | cowsay -f {{ ascii_art }}
30+ {% endif %}
31+{% endfor %}
32+
33+echo_pillar_demo_1:
34+ cmd.run:
35+ - name: "echo {{ pillar.demo_text | default('pillar not defined') }}"
36+
37+echo_pillar_demo_2:
38+ cmd.run:
39+ - name: "echo {{ pillar.demo.text | default('pillar not defined') }}"
40+
41+# Comment
42+{% set rand = salt['random.get_str'](20) %}
43+{% set IP_Address = pillar['IP_Address'] %}
44+
45+wait:
46+ cmd.run:
47+ - name: sleep 210 # another comment
48+
49+create_roster_file:
50+ file.managed:
51+ - name: /tmp/salt-roster-{{ rand }}
52+ - contents:
53+ - 'switch:'
54+ - ' host: {{ IP_Address }}'
55+ - " user: test"
56+ - " passwd: {{ passwd }}"
57+