method for deleting ip sla config lines at different routers

Hi guys, i 've been tasked for deletion of “ip sla x” lines at several routers.
I have created this playbook, that works fine with all routers, except the ones which do not have “ip sla x” configured.
This is the playbook:

You should ha provided the content of the variable showcommand
   - debug: var=showcommand

Since I don't use ios_command and don't have the content this might be completely wrong.

I thing you need to use showcommand.stdout and not showcommand.stdout_lines.
When using that with with_items you will have the content of each of them in the variable item so you need to use item in when:

   with_items: "{{ showcommand.stdout }}"
   when: item != ""