# Why is this telling me the variable is undefined?

**URL:** <https://forum.ansible.com/t/why-is-this-telling-me-the-variable-is-undefined/31123>\
**Category:** Ansible Project\
**Created:** [August 26, 2019, 1:44am UTC](https://forum.ansible.com/t/why-is-this-telling-me-the-variable-is-undefined/31123 "2019-08-26T01:44:40Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chrono\_7](https://avatars.discourse-cdn.com/v4/letter/c/7c8e57/32.png) [@Chrono\_7](https://forum.ansible.com/u/Chrono_7)\
**Post date:** [August 26, 2019, 1:44am UTC](https://forum.ansible.com/t/why-is-this-telling-me-the-variable-is-undefined/31123/1 "2019-08-26T01:44:40Z")

</div>

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:

`

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [August 26, 2019, 7:42am UTC](https://forum.ansible.com/t/why-is-this-telling-me-the-variable-is-undefined/31123/2 "2019-08-26T07:42:04Z")

</div>

You are missing the dash in front of set\_fact.

---

<div class="post-metadata">

**Author:** ![Chrono\_7](https://avatars.discourse-cdn.com/v4/letter/c/7c8e57/32.png) [@Chrono\_7](https://forum.ansible.com/u/Chrono_7)\
**Post date:** [August 26, 2019, 12:34pm UTC](https://forum.ansible.com/t/why-is-this-telling-me-the-variable-is-undefined/31123/3 "2019-08-26T12:34:40Z")

</div>

I get an error stating:

`  
ERROR! no action detected in task. This often indicates a misspelled module name, or incorrect module path.

The error appears to have been in ‘system\_info.yaml’: line 7, column 7, but may  
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

tasks:

- name: Read the CSV & Set Values  
^ here  
`

That’s with my file being reworked to:

`

---

<div class="post-metadata">

**Author:** ![racke](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/racke/32/4767_2.png) [@racke](https://forum.ansible.com/u/racke)\
**Post date:** [August 26, 2019, 12:46pm UTC](https://forum.ansible.com/t/why-is-this-telling-me-the-variable-is-undefined/31123/4 "2019-08-26T12:46:30Z")

</div>

From the docs:

# Read a CSV file and access the first item  
- name: Read users from CSV file and return a list  
&nbsp;&nbsp;read\_csv:  
&nbsp;&nbsp;&nbsp;&nbsp;path: users.csv  
&nbsp;&nbsp;register: users  
&nbsp;&nbsp;delegate\_to: localhost

You need to intend the parameters for the Ansible module (path in your case).

Regards  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Racke

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [August 26, 2019, 1:11pm UTC](https://forum.ansible.com/t/why-is-this-telling-me-the-variable-is-undefined/31123/5 "2019-08-26T13:11:00Z")

</div>

Your indentation is wrong.

try:

---

<div class="post-metadata">

**Author:** ![Karl\_Auer](https://avatars.discourse-cdn.com/v4/letter/k/cc9497/32.png) [@Karl\_Auer](https://forum.ansible.com/u/Karl_Auer)\
**Post date:** [August 26, 2019, 2:55pm UTC](https://forum.ansible.com/t/why-is-this-telling-me-the-variable-is-undefined/31123/6 "2019-08-26T14:55:56Z")

</div>

path: is not indented?

---

<div class="post-metadata">

**Author:** ![Zolvaring](https://avatars.discourse-cdn.com/v4/letter/z/ce73a5/32.png) [@Zolvaring](https://forum.ansible.com/u/Zolvaring)\
**Post date:** [August 26, 2019, 3:02pm UTC](https://forum.ansible.com/t/why-is-this-telling-me-the-variable-is-undefined/31123/7 "2019-08-26T15:02:53Z")

</div>

Your original spacing looks fine other than missing the dash for set fact. The original error is indicating that the "system" doesn't exist when your CSV read task looks for "system.csv". I would check that "system.csv" is defined and add this before the csv read task to troubleshoot:

- debug:  
&nbsp;&nbsp;&nbsp;&nbsp;var: system  
- debug:  
&nbsp;&nbsp;&nbsp;&nbsp;var: system.csv

---

<div class="post-metadata">

**Author:** ![Chrono\_7](https://avatars.discourse-cdn.com/v4/letter/c/7c8e57/32.png) [@Chrono\_7](https://forum.ansible.com/u/Chrono_7)\
**Post date:** [August 26, 2019, 10:15pm UTC](https://forum.ansible.com/t/why-is-this-telling-me-the-variable-is-undefined/31123/8 "2019-08-26T22:15:03Z")

</div>

Appreciate the responses so far everyone. I’ve indented the **path** line as suggested but still get the following error:

`

ERROR! no action detected in task. This often indicates a misspelled module name, or incorrect module path.

The error appears to have been in ‘system\_info.yaml’: line 7, column 7, but may  
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

tasks:

- name: Read the CSV & Set Values  
^ here  
`

Here’s the latest of what my file currently looks like:

`

---

<div class="post-metadata">

**Author:** ![Zolvaring](https://avatars.discourse-cdn.com/v4/letter/z/ce73a5/32.png) [@Zolvaring](https://forum.ansible.com/u/Zolvaring)\
**Post date:** [August 26, 2019, 10:36pm UTC](https://forum.ansible.com/t/why-is-this-telling-me-the-variable-is-undefined/31123/9 "2019-08-26T22:36:03Z")

</div>

Hello,

I was having a moment earlier when I read your path as an actual variable that was my mistake. To be more helpful though, I replicated your code on my setup and ran into the same error. On checking the docs I saw that read\_csv was added in 2.8, and after updating to 2.8 the “no action detected in task” error is gone.

Hopefully this helps

---

<div class="post-metadata">

**Author:** ![Chrono\_7](https://avatars.discourse-cdn.com/v4/letter/c/7c8e57/32.png) [@Chrono\_7](https://forum.ansible.com/u/Chrono_7)\
**Post date:** [August 26, 2019, 10:46pm UTC](https://forum.ansible.com/t/why-is-this-telling-me-the-variable-is-undefined/31123/10 "2019-08-26T22:46:33Z")

</div>

Woohoo, that was it. Updated and it’s working now. Thanks a lot, checking my version was the last thing on my mind for whatever reason
