HP ILO Firmware info

Hello Guys ,
Need help.Written code as below ,

Hello Guys ,
Need help.Written code as below ,

---
- hosts: localhost
vars:
iLo_IP: 'XXXXXXXXXXX'
iLo_username: 'test'
iLo_password: 'testuser'
tasks:
- name: Get iLO firmware version
uri:
url: "https://{{ iLo_IP }}/rest/v1/managers/1"
method: GET
user: "{{ ilo_user }}"
password: "{{ ilo_password }}"
force_basic_auth: true
validate_certs: false
status_code: 200
with_items: "{{ ilo_addr.results | map(attribute='ansible_facts.ipmi') | list }}"
register: ilo_version

- set_fact:
ilo_firmware: "{{ item.json.Firmware.Current.VersionString.split(' v')[-1] | replace('.', '') }}"
with_items: "{{ ilo_version.results }}"
no_log: true

when i execute this ,I am getting below error.can someone pls help me out..

*Fatal : [localhost] : FAILED! => { "msg" : "'ilo_addr' is undefined"}*

That's a kind of surprise when ilo_addr is not defined in your playbook, isn't it?

Regards
         Racke

Hello Guys ,
Need help.Written code as below ,

  ---
- hosts: localhost
  vars:
    iLo_IP: 'XXXXXXXXXXX'
    iLo_username: 'test'
    iLo_password: 'testuser'
  tasks:
  - name: Get iLO firmware version
    uri:
      url: "https://{{ iLo_IP }}/rest/v1/managers/1"
      method: GET
      user: "{{ ilo_user }}"
      password: "{{ ilo_password }}"
      force_basic_auth: true
      validate_certs: false
      status_code: 200
    with_items: "{{ ilo_addr.results | map(attribute='ansible_facts.ipmi') | list }}"
    register: ilo_version

- set_fact:
     ilo_firmware: "{{ item.json.Firmware.Current.VersionString.split(' v')[-1] | replace('.', '') }}"
   with_items: "{{ ilo_version.results }}"
   no_log: true

when i execute this ,I am getting below error.can someone pls help me out..

Fatal : [localhost] : FAILED! => { "msg" : "'ilo_addr' is undefined"}

You're using a variable that is not defined, while looping over the uri task.
That must have come from somewhere.
So... did you actually write it? Or perhaps copied part of something
else and expected it to magically work.

Actually copied .few of them modified…

How to declare that variable to resolve the issue?

Judging by its name, it isn't defined manually, but rather the result
of some previous task (which we don't know anything about).