diff --git a/ansible/roles/es6/tasks/azure-plugin.yml b/ansible/roles/es6/tasks/azure-plugin.yml
index 0a4ceed96705883030925ebc36a382c19807a81a..46d3079babcde748ebecc55f0d1d7fa7a4488454 100644
--- a/ansible/roles/es6/tasks/azure-plugin.yml
+++ b/ansible/roles/es6/tasks/azure-plugin.yml
@@ -1,5 +1,5 @@
 - name: Check if plugin already installed or not
-  shell: "curl -s localhost:9200/_cat/plugins | awk '{print $2}'"
+  shell: "curl -s localhost:9200/_cat/plugins | awk '{print $2}' |head -1"
   register: plugin_output
 
 - name: check the output
@@ -8,4 +8,4 @@
 
 - name: Install plugin
   shell: ES_PATH_CONF=/etc/elasticsearch/"{{ es_instance_name }}" /usr/share/elasticsearch/bin/elasticsearch-plugin install repository-azure
-  when: plugin_output.stdout_lines[0] != "repository-azure"
+  when: plugin_output.stdout != "repository-azure"