on 3dcf025 help sign in
57 lines 1.3 kB history raw
1required_packages:
2 pkg.installed:
3 - pkgs:
4 - git
5 - perl
6 - fortune
8cowsay_source:
9 git.latest:
10 - name: https://github.com/jasonm23/cowsay.git
11 - target: /root/cowsay
13run_installer:
14 cmd.run:
15 - name: ./install.sh /usr/local
16 - cwd: /root/cowsay
17 - onchanges:
18 - git: cowsay_source
20{% set cowfiles = salt.cmd.run('cowsay -l').split('\n')[1:] %}
21{% set ascii_arts = cowfiles | join(' ') %}
23{% for ascii_art in ascii_arts.split(' ') %}
24run_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 %}
33echo_pillar_demo_1:
34 cmd.run:
35 - name: "echo {{ pillar.demo_text | default('pillar not defined') }}"
37echo_pillar_demo_2:
38 cmd.run:
39 - name: "echo {{ pillar.demo.text | default('pillar not defined') }}"
41# Comment
42{% set rand = salt['random.get_str'](20) %}
43{% set IP_Address = pillar['IP_Address'] %}
45wait:
46 cmd.run:
47 - name: sleep 210 # another comment
49create_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 }}"