I tried to follow along with a similar approach to the docs on *read_csv *
here <https://docs.ansible.com/ansible/latest/modules/read_csv_module.html>. 
I'm not sure why I'm getting this error returned when the value of *systems 
*is defined just above the *set_fact*:


fatal: [127.0.0.1]: FAILED! => {"msg": "The task includes an option with an 
undefined variable. The error was: 'systems' is undefined\n\nThe error 
appears to have been in 'system_info.yaml': line 7, column 7, but may\nbe 
elsewhere in the file depending on the exact syntax problem.\n\nThe 
offending line appears to be:\n\n  tasks:\n    - name: Read the CSV & Set 
Values\n      ^ here\n"}

Here's what my playbook looks like:


---

- name: Import CSV Containing Info For System(s) To Prep
  hosts: 127.0.0.1

  tasks:
  - name: Read the CSV & Set Values
    read_csv:
      path: systems.csv
    register: systems
    delegate_to: localhost
 
    set_fact:
      IP: "{{ systems.list.1.IPAddress }}"

Any ideas on this?

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/fb23477d-ebfc-4018-a512-c190225f108d%40googlegroups.com.

Reply via email to