Skip to content

block: and loop: are mutually exclusive #15

Description

@jokjr

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/

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions