Registered variable returns expected value but task is skipped

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]

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

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)