# offending line appears to be state: directory

**URL:** <https://forum.ansible.com/t/offending-line-appears-to-be-state-directory/33172>\
**Category:** Ansible Project\
**Created:** [June 14, 2020, 5:34pm UTC](https://forum.ansible.com/t/offending-line-appears-to-be-state-directory/33172 "2020-06-14T17:34:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tony\_Wong](https://avatars.discourse-cdn.com/v4/letter/t/3ab097/32.png) [@Tony\_Wong](https://forum.ansible.com/u/Tony_Wong)\
**Post date:** [June 14, 2020, 5:34pm UTC](https://forum.ansible.com/t/offending-line-appears-to-be-state-directory/33172/1 "2020-06-14T17:34:13Z")

</div>

any idea what is wrong with my playbook here?

- name: Retrieve info about the mount directory  
stat:  
path: “{{ mount\_dir\_path }}”  
register: mount\_dir\_stat\_first  
tags:
- prereqs

# If the mount directory doesn’t already exist it is created

- name: Create the mount directory  
become: yes  
become\_method: yes  
file:  
path: “{{ mount\_dir\_path }}”  
state: directory  
mode: 0777  
become: yes  
become\_method: sudo  
when: mount\_dir\_stat\_first.stat.exists == False  
tags:
- prereqs

# We run stat again to get info about the mount directory post-creation. This info will be used

# within when statements to make sure that the directory exists and isn’t already being used.

# It’s a crude check and I would like to devise a better method.

- name: Retrieve info about the mount directory  
stat:  
path: “{{ mount\_dir\_path }}”  
register: mount\_dir\_stat\_created  
tags:

- prereqs

- name: Mount the ISO  
mount:  
path: “{{ mount\_dir\_path }}”  
src: “{{ repo\_dir }}/{{ vcsa\_iso}}”  
fstype: iso9660  
opts: ro,noauto  
state: mounted  
become: yes  
become\_method: sudo  
when: mount\_dir\_stat\_created.stat.wusr == True  
tags:

---

<div class="post-metadata">

**Author:** ![David\_Shrewsbury](https://avatars.discourse-cdn.com/v4/letter/d/aeb1de/32.png) [@David\_Shrewsbury](https://forum.ansible.com/u/David_Shrewsbury)\
**Post date:** [June 15, 2020, 12:53pm UTC](https://forum.ansible.com/t/offending-line-appears-to-be-state-directory/33172/2 "2020-06-15T12:53:53Z")

</div>

‘register’ indented too much on your ‘stat’ task

---

<div class="post-metadata">

**Author:** ![Asiful\_Haque](https://avatars.discourse-cdn.com/v4/letter/a/9de053/32.png) [@Asiful\_Haque](https://forum.ansible.com/u/Asiful_Haque)\
**Post date:** [June 17, 2020, 6:18am UTC](https://forum.ansible.com/t/offending-line-appears-to-be-state-directory/33172/3 "2020-06-17T06:18:51Z")

</div>

Can you try wih this. And if there is any error please the details error you can try with -vv flag while running the playbook.

# If the mount directory doesn't already exist it is created  
- name: Create the mount directory  
file:  
path: "{{ mount\_dir\_path }}"  
state: directory  
mode: 0777  
become: yes  
become\_method: sudo  
when: mount\_dir\_stat\_first.stat.exists == False  
tags:  
- prereqs
