Code: - name: check previous kafka broker server.properties
shell: "ps -ef | grep -i kafka | grep -i server.properties | awk '{print $NF}'" register: serverfile tags: - upgrade - upgrade12 - name: debug grepout set_fact: srvfilepath: "{{ item }}" loop: "{{ serverfile.stdout_lines }}" when: "'server' in item" tags: - upgrade - upgrade12 - name: get the interbroker and messge format version details if set shell: 'grep -e inter.broker.protocol.version -e log.message.format.version {{srvfilepath}}' register: regintbrkpt tags: - upgrade12 - name: display interbroker version debug: msg: "{{ item }}" loop: - "{{regintbrkpt.stdout_lines}}" tags: - upgrade12 ===================================================== tal: [host1]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'item' is undefined. 'item' is undefined\n\nThe error appears to be in '/Users/sameer_modak/ansibledemo/kafkainstall.yml': line 353, column 5, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - name: display interbroker version\n ^ here\n"} fatal: [host2]]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'item' is undefined. 'item' is undefined\n\nThe error appears to be in '/Users/sameer_modak/ansibledemo/kafkainstall.yml': line 353, column 5, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - name: display interbroker version\n ^ here\n"} fatal: [host3]FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'item' is undefined. 'item' is undefined\n\nThe error appears to be in '/Users/sameer_modak/ansibledemo/kafkainstall.yml': line 353, column 5, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - name: display interbroker version\n ^ here\n"} -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/bb0dbae7-46c1-46f2-bced-e3a7cc914b2dn%40googlegroups.com.