item undefined when try to use through loop 2nd time

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