Skip to content

Instantly share code, notes, and snippets.

@Slimmons
Last active July 6, 2016 16:36
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 Slimmons/021621ddfe98cb79d7216afa1dc10d8a to your computer and use it in GitHub Desktop.
Save Slimmons/021621ddfe98cb79d7216afa1dc10d8a to your computer and use it in GitHub Desktop.
This state only creates a single file named 5, in /home/user.
The goal was to create 5 files, /home/user/1, 2, 3, 4, 5.
The thing that's weird is that it appears to be rendering correctly.:
test:
local.cmd.run:
- tgt: 'minion_1'
- arg:
- touch /home/user/1
- arg:
- touch /home/user/2
- arg:
- touch /home/user/3
- arg:
- touch /home/user/4
- arg:
- touch /home/user/5
Then it shows this
[DEBUG ] Results of YAML rendering:
OrderedDict([('test', OrderedDict([('local.cmd.run', [OrderedDict([('tgt', 'minion_1')]), OrderedDict([('arg', ['touch /home/user/1'])]), OrderedDict([('arg', ['touch /home/user/2'])]), OrderedDict([('arg', ['touch /home/user/3'])]), OrderedDict([('arg', ['touch /home/user/4'])]), OrderedDict([('arg', ['touch /home/user/5'])])])]))])
Everything looks like it should be working to me.
{% set postdata = data.get('post', {}) %}
test:
local.cmd.run:
- tgt: '{{ postdata.tgt }}'
{% set count = 1 %}
{% for x in range(1,6) %}
- arg:
- touch /home/user/{{ count }}
- arg:
- echo "hello!" >> /home/user/{{ count }}
{% set count = count + 1 %}
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment