Home > Software engineering >  Why can Ansible not loop over block?
Why can Ansible not loop over block?

Time:01-09

While I have seen Issue looping on block module for a set of tasks in Ansible I still do not understand why ansible was designed this way. So why does Ansible insist printing

ERROR! 'with_items' is not a valid attribute for a Block

when stumbling over code like this:

- block:
    - name: print hello
      debug:
        msg: hello
  with_items:
    - Mark
    - Denis
    - Homer

So why was Ansible designed that way? Is there some documented design decision?

CodePudding user response:

You can take a look at the detailed explanation from Ansible maintainers about the reasons behind this decision:

https://github.com/ansible/ansible/issues/13262#issuecomment-335904803

  • Related