The conditional check 'cmdb_hwmodel.startswith('HP ')' failed

can you pelase someone let me know what i am missing here:

Error:

TASK [hp : hpilo_info] **************************************************************************************************************************************
task path: /data01/ansible/playbooks/roles/hp/tasks/main.yml:1
fatal: [localhost]: FAILED! => {
“msg”: “The conditional check 'cmdb_hwmodel.startswith('HP ‘)’ failed. The error was: error while evaluating conditional (cmdb_hwmodel.startswith('HP ')): ‘cmdb_hwmodel’ is undefined\n\nThe error appears to be in ‘/data01/ansible/playbooks/roles/hp/tasks/main.yml’: line 1, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- hpilo_info:\n ^ here\n”
}

Playbook:

  • hpilo_info:
    host: “{{ host }}”
    login: “{{ login }}”
    password: “{{ password }}”
    ssl_version:
    description:
  • The SSL version used to authenticate to the HP iLO interface.
    default: tlsv1
    when: cmdb_hwmodel.startswith('HP ')
    delegate_to: localhost
    register: results
  • fail:
    msg: ‘CMDB serial ({{ cmdb_serialno }}) does not match hardware serial ({{ results.hw_system_serial }}) !’
    when: cmdb_serialno != results.hw_system_serial

Link:

https://docs.ansible.com/ansible/latest/modules/hpilo_info_module.html#hpilo-info-module

Read the error more carefully, it says exactly what is the matter

Hi Dick,

worked … I need output results like below , do we have a call back plugin for this?