diff --git a/kubernetes/ansible/roles/deploy-player/tasks/main.yml b/kubernetes/ansible/roles/deploy-player/tasks/main.yml
index 003528cd54fdad492c26df4cb90927a353027d32..d3a478d957ac46b00f1b7ccb6b9d4491c999648b 100644
--- a/kubernetes/ansible/roles/deploy-player/tasks/main.yml
+++ b/kubernetes/ansible/roles/deploy-player/tasks/main.yml
@@ -9,11 +9,11 @@
 
 - name: copy new index file
   copy: src="{{cdn_file_path}}" dest="/var/lib/jenkins/player_config/index_cdn.ejs" mode=0644
-  when: sunbird_portal_cdn_url is undefined and cdn_file_path is undefined
+  when: sunbird_portal_cdn_url is defined and  cdn_file_path is defined
 
 - name: remove whitespaces in index file
   shell: 'sed -i s/\\s\\+$//e /var/lib/jenkins/player_config/index_cdn.ejs'
-  when: sunbird_portal_cdn_url is undefined and cdn_file_path is undefined
+  when: sunbird_portal_cdn_url is defined and cdn_file_path is defined
 
 - name: Remove the existing CDN config
   shell: "kubectl delete configmap player-cdn-config --namespace={{namespace}}"
@@ -21,7 +21,7 @@
 
 - name: Create player-cdn configmap
   shell: "kubectl create configmap player-cdn-config --from-file=/var/lib/jenkins/player_config/index_cdn.ejs --namespace={{namespace}}"
-  when: sunbird_portal_cdn_url is undefined and cdn_file_path is undefined
+  when: sunbird_portal_cdn_url is defined and cdn_file_path is defined
 
 - name: rename template
   template: