ansible with_items - dictionary


Example

You can use a dictionary for a slightly more complex loop.

- name: manage packages
  package: name={{ item.name }} state={{ item.state }}
  with_items:
    - { name: tree, state: present }
    - { name: nmap, state: present }
    - { name: apache2, state: absent }