dansabel icon indicating copy to clipboard operation
dansabel copied to clipboard

block: and loop: are mutually exclusive

Open jokjr opened this issue 2 years ago • 0 comments

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/

jokjr avatar Mar 03 '22 15:03 jokjr