dansabel
dansabel copied to clipboard
block: and loop: are mutually exclusive
Below an example of invalid syntax; should be easy enough to add linting of this to the code that generates the "more than one module" warnings in jinjalint.py
- name: do lots of things
loop: "{{ my_collection }}"
block:
- name: foo
debug: msg=foomsg
- name: bar
debug: msg=barmsg
Eric Anderson has a neat workaround that we could suggest to the user: https://ericsysmin.com/2019/06/20/how-to-loop-blocks-of-code-in-ansible/