I have a question about the use of group_vars in Ansible. I would like to use the data dictionaries values from swtich.json, I also need it to be global set of values almost like all. When I call it in Ansible it becomes unknown... Is there a way to do it?
Ansible debug output:
TASK [basebmc : debug] *********************************************************
task path: /mnt/c/Users/emarq/Documents/Source/Repos/Solutions.Network.Automation/MAS/Ansible/hpe/roles/basebmc/tasks/main.yml:20
fatal: [b43-1u15-d00-5900AFbmc]: FAILED! => {
"failed": true,
"msg": "the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: dict object has no element 5900\n\nThe error appears to have been in '/mnt/c/Users/emarq/Documents/Source/Repos/Solutions.Network.Automation/MAS/Ansible/hpe/roles/basebmc/tasks/main.yml': line 20, 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- debug:\n ^ here\n"
}
group_vars/
baseagg.yml basebmc.yml basetor.yml switch.json
Ansible.hosts:
[swtich:children]
basebmc
[basebmc]
bmcdevice1
Role baesbmc/tasks/main.yml:
- debug:
msg: "name: {{ inventory_hostname }} {{ portmap.HPE.5900.Port.46.Port }}"
verbosity: 4
with_dict: "{{ portmap }}"
playbook.yml