Hi Guys,
I am trying to iterate one database using the item keyword in Ansible Playbook. But it is showing me the below error.
fatal: [192.168.0.129]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'item' is undefined\n\nThe error appears to be in '/root/haproxy/user.yml': line 12, column 5, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n  tasks:\n  - group:\n    ^ here\n"}
I am using the below playbook.
- hosts: all
  vars:
    password: "password"
    userdb:
      - name: nadim
        password: "nadim"
        group: "mygrp"
      - name: akhtar
        password: akhtar
        group: mygrp1
  tasks:
  - group:
      name: "{{ item.group }}"
      state: present