Can I perform these below in single task? If so, what shall be the approach?
- name: fetch configuration
command: "oc get disk -n **xyz** -o json"
when: vars.version == **"2.1"**
register: oc_result
- name: fetch configuration
command: "oc get disk -n **abc** -o json"
when: vars.version == **"3.0"**
register: oc_result
So, if the version is 2.1, then, the command should be run with xyz namespace, else with abc namespace.
The version will be from another YAML variable, which I will refer using {{ vars.version }}.