# Ansible 1.8 ansible\_check\_mode

**URL:** <https://forum.ansible.com/t/ansible-1-8-ansible-check-mode/21614>\
**Category:** Ansible Project\
**Created:** [May 31, 2016, 6:37pm UTC](https://forum.ansible.com/t/ansible-1-8-ansible-check-mode/21614 "2016-05-31T18:37:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anderson.goulart](https://avatars.discourse-cdn.com/v4/letter/a/f19dbf/32.png) [@anderson.goulart](https://forum.ansible.com/u/anderson.goulart)\
**Post date:** [May 31, 2016, 6:37pm UTC](https://forum.ansible.com/t/ansible-1-8-ansible-check-mode/21614/1 "2016-05-31T18:37:38Z")

</div>

Hi,

Some remote modules doesn’t support check\_mode, which means they break every time I use them on some role. I saw [1] that the variable ansible\_check\_mode is only available on ansible 1.9, but we are still using 1.8. Is there any way of skipping the task when in check mode on this version?

The problem is, one task register a variable and the other tries to access its attribute, which fails because it is not defined. I tried to use ec2\_volume.skipped check, but it stills tries to access some its attribute and fail the check.

ec2\_volume": {  
“changed”: false,  
“invocation”: {  
“module\_args”: “”,  
“module\_name”: “ec2\_vol”  
},  
“msg”: “remote module does not support check mode”,  
“skipped”: true  
}

Thanks,

– Anderson

---

<div class="post-metadata">

**Author:** ![Johannes\_Kastl](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@Johannes\_Kastl](https://forum.ansible.com/u/Johannes_Kastl)\
**Post date:** [May 31, 2016, 7:36pm UTC](https://forum.ansible.com/t/ansible-1-8-ansible-check-mode/21614/2 "2016-05-31T19:36:05Z")

</div>

If the first task does not harm (e.g. just look up a file or list a  
directory) then set it to 'always\_run: yes'. So the task is executed  
even in check mode, and thus the variable is correctly registered.

Unfortunately that won't work if the task uses a file that a previous  
task would create, were it not in check mode...

Johannes

---

<div class="post-metadata">

**Author:** ![anderson.goulart](https://avatars.discourse-cdn.com/v4/letter/a/f19dbf/32.png) [@anderson.goulart](https://forum.ansible.com/u/anderson.goulart)\
**Post date:** [May 31, 2016, 7:40pm UTC](https://forum.ansible.com/t/ansible-1-8-ansible-check-mode/21614/3 "2016-05-31T19:40:47Z")

</div>

Hi,

Thanks for the tip. The first task is harmful, as it creates an EBS volume in AWS. I tricked ansible creating a fact when thevar.skipped is defined, adding the pending attribute to it and then following on check mode. If the variable is registered (not on check mode), then the fact will not be set.

-- anderson
