Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combining Hostname / Ip /MAN into dictionary fails #11

Open
ykhanal123 opened this issue Sep 13, 2019 · 0 comments
Open

Combining Hostname / Ip /MAN into dictionary fails #11

ykhanal123 opened this issue Sep 13, 2019 · 0 comments

Comments

@ykhanal123
Copy link

ykhanal123 commented Sep 13, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant