# Registered variable returns expected value but task is skipped

**URL:** <https://forum.ansible.com/t/registered-variable-returns-expected-value-but-task-is-skipped/36097>\
**Category:** Ansible Project\
**Created:** [December 10, 2021, 12:04am UTC](https://forum.ansible.com/t/registered-variable-returns-expected-value-but-task-is-skipped/36097 "2021-12-10T00:04:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lucas\_Possamai](https://avatars.discourse-cdn.com/v4/letter/l/5fc32e/32.png) [@Lucas\_Possamai](https://forum.ansible.com/u/Lucas_Possamai)\
**Post date:** [December 10, 2021, 12:04am UTC](https://forum.ansible.com/t/registered-variable-returns-expected-value-but-task-is-skipped/36097/1 "2021-12-10T00:04:52Z")

</div>

I'm trying to only run a task if the previous task returned a 0 stdout.

- name: Check if efs-utils is already installed  
ansible.builtin.shell: dpkg -l | grep efs-utils | wc -l  
register: is\_installed  
ignore\_errors: "{{ ansible\_check\_mode }}"  
when: efs\_id != "" and not ansible\_check\_mode

- name: Debugging  
ansible.builtin.debug:  
msg:  
- "{{ is\_installed.stdout }}"

- name: Install efs-utils  
ansible.builtin.shell: cd /opt/efs-utils && ./build-deb.sh && sudo apt-get  
-y install /opt/efs-utils/build/amazon-efs-utils\*deb  
when: is\_installed.stdout == 0 and not ansible\_check\_mode

However, when executing the playbook, the "Install efs-utils" task is being  
skipped.

Debug shows the "is\_installed.stdout" output returning 0, as expected:  
TASK [Check if efs-utils is already installed]

---

<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:** [December 10, 2021, 8:17am UTC](https://forum.ansible.com/t/registered-variable-returns-expected-value-but-task-is-skipped/36097/2 "2021-12-10T08:17:24Z")

</div>

The output is a string “0” but your condition uses a bare 0 which is interpreted as a Boolean false.

But why use a shell workaround, if there is package\_facts:

[https://docs.ansible.com/ansible/latest/collections/ansible/builtin/package\_facts\_module.html](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/package_facts_module.html)

Ideally AWS would provide apt repositories but that’s not the case (yet - I see it’s been requested, for instance  
[https://github.com/aws/efs-utils/issues/111](https://github.com/aws/efs-utils/issues/111))
