I'm trying to look through a loop of users to get their email addresses 
from an IPA server.  When I run it, I get an error stating that "name" is 
an undefined variable.  Can anyone see what I'm doing wrong?

---
- hosts: localhost
  become: yes
  become_method: sudo
  gather_facts: no

  vars_files:
    - /etc/ansible/vault.yml

  vars:
    - users:
      - { name: "user1 }
      - { name: "user2" }

  tasks:

  - name: Get User's Email Address
    shell: "set -o pipefail && /bin/ipa user-show {{ item.name }} --all 
--raw | grep mail: | awk '{print $2}'"
    register: email
    loop:
    - "{{ users }}"

  - name: Print email
    debug:
      msg: "{{ email.stdout }}"

The error states  "The task includes an option with an undefined variable.  
The error was: 'list object' has no attribute 'name'".

Thanks,
Harry

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/ac83150f-a884-4a72-8024-330f5ce8b0fen%40googlegroups.com.

Reply via email to