How to include/import yml files based on condition

Hi

Im a newbie on Ansible. I have a scenario where

Steps:
I look for a version of an application.
If version is present call uninstall.yml else call install.yml

snippet i tried

  • win_shell: D:\Build\regread2.vbs XXX InstallLocation
    register: result
  • set_fact:
    signup_token: ‘{{ result.stdout | regex_search(qry)| replace(“[”,“”)|replace(“]”,“”) }}’
    vars:
    qry: ‘[(.*?)]’
  • debug: msg={{ signup_token }}