Why my 'hostvars' is undefined ...

Hi Evrybody,

I’m facing to a problem that I don’t understand the origin: Any help will be welcome.

I want to use in a playbook a role where the name depends on a variable defined in the inventory.

I have the following dynamic inventory for a host:

the command ansible-inventory -i /etc/ansible/cobbler.py --host “rhel8-test-2” returns:

{
“cobbler”: {

“image”: “”,
“ks_meta”: {},
“mgmt_classes”: [
“online”,
],
“name”: “rhel8-test-2”,
“netboot_enabled”: true,
“power_user”: “”,
“profile”: “HWCL_402”
}
}

In my playbook I want to acess to the profile variable => “cobbler.profile”: “HWCL_402”
The following playbook works fine:

Hello,