openshift4-rhv-upi
openshift4-rhv-upi copied to clipboard
Combining Hostname / Ip /MAN into dictionary fails
Hi,
I was working on deploying a openshift 4.1 cluster on RHEV utilizing this Ansible playbook. As I was going through the setup and running the playbook I ran into a few issues. 1st on the task to combine mac /hostname/ip into a dictionary it runs into a templating error. Here is the traceback: fatal: [localhost]: FAILED! => {"msg": "Unexpected templating type error occurre d on ({{\n host_mac_list | default([]) +\n [\n {\n 'name': item.it em,\n 'mac': item.ansible_facts.ovirt_nics[0].mac.address,\n ' ip': hostvars[item.item]['ip']\n }\n ]\n}}): coercing to Unicode: need strin g or buffer, list found"} Here is the portion of the code in roles/rhv/tasks/main.yaml where it is getting an error:
- name: Combine Hostname/IP/MAC into Dictionary for Easy Lookup
set_fact:
host_mac_list: >-
{{
host_mac_list | default([]) +
[
{
'name': item.item,
'mac': item.ansible_facts.ovirt_nics[0].mac.address,
'ip': hostvars[item.item]['ip']
}
]
}}
with_items:
- "{{ ovirt_nic_facts_results.results }}"
I temporarily created a fix where I messed around with the variables and got the ip and hostname to be saved correctly but the mac address is not so I worked around that and set a static value for now. Here is my current configuration.
set_fact:
host_mac_list: >-
{{
host_mac_list | default([]) +
[
{
'name': item,
'mac': item.nics.mac_address | default('56:6f:68:f0:00:06'),
'ip': hostvars[item]['ip'] | default([])
}
]
}}
with_items:
- "{{ groups[provision_group] }}"
Any help would be appreciated Thanks, Yajan