Openshift-ansible: AnsibleError during task Create virtual machine list fact

Created on 29 Jan 2019  路  10Comments  路  Source: openshift/openshift-ansible

Description

When running openshift-ansible/playbooks/ovirt/openshift-cluster/ovirt-vm-infra.yml, an Ansible error is thrown near the very beginning of the playbook. See here: https://pastebin.com/18Gardw3
It seems like it's connected with variable openshift_ovirt_vm_manifest. But I don't think I have a configuration problem with this variable, because my configuration is quite simple.

Version
  • Your ansible version per ansible --version
    ansible 2.7.6
    config file = /root/ansible.cfg
    configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
    ansible python module location = /usr/lib/python2.7/site-packages/ansible
    executable location = /usr/bin/ansible
    python version = 2.7.5 (default, May 31 2018, 09:41:32) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]

  • The output of rpm -q openshift-ansible
    openshift-ansible-3.11.59-1.git.0.ba8e948.el7.noarch

Steps To Reproduce
  1. Have this inventory: https://pastebin.com/VjfuJ57e
  2. Have this file with additional variables: https://pastebin.com/izCsgncm
  3. Replace all instances of <edit> in file from step 2 with information that is applicable for your environment.
  4. Run this: ansible-playbook -i inventory -e '@provisioning-vars.yaml' /usr/share/ansible/openshift-ansible/playbooks/ovirt/openshift-cluster/ovirt-vm-infra.yml
Expected Results

I would expect the playbook to successfully run and create 5 VMs.

Observed Results

Error is thrown. See here: https://pastebin.com/18Gardw3

Additional Information
  • OS: RHEL7.6
  • Inventory: https://pastebin.com/VjfuJ57e
  • This I think is crucial information: If I run the playbook on the same machine, with the same inventory and the same additional variables, if works with downgraded version of openshift-ansible RPM package. I tested it with openshift-ansible-playbooks-3.11.51-2.git.0.51c90a3.el7.noarch

All 10 comments

I encountered the same error with openshift-ansible-3.11.69-1.git.0.2ff281f.el7.noarch as well.

Hey, could you please share the variable file with this one: openshift_ovirt_vm_manifest I think that the problem could be there.

Hi, I already referenced it in Steps to Reproduce, here's the link again: https://pastebin.com/izCsgncm

Do you have this line on ansible.cfg file?

jinja2_extensions = jinja2.ext.do

Ohh I think I got it, try to add those lines to openshift_ovirt_vm_profile on this example:

    infra_vm:
        cluster: "{{ openshift_ovirt_cluster }}"
        template: "{{ template_name }}"
        memory: 8GiB
        cores: 1
        disks:
            - size: 50GiB
              storage_domain: "{{ openshift_ovirt_data_store }}"
              name: docker_disk
              interface: virtio
        cloud_init:                                                     <--------
            authorized_ssh_keys: '{{ openshift_ovirt_ssh_key }}'        <--------
        state: running

I do not. My ansible.cfg looked like this:

[defaults]
forks = 10
host_key_checking = False
gathering = smart
roles_path = /usr/share/ansible/roles
remote_user = root

I tried adding it there and got this error:

TASK [openshift_ovirt : Create virtual machine list fact] ************************************************************
fatal: [localhost]: FAILED! => {"msg": "An unhandled exception occurred while running the lookup plugin 'template'. Error was a <class 'ansible.errors.AnsibleFilterError'>, original message: |combine expects dictionaries, got Undefined"}

btw add it to your ansible.cfg it is necessary for the xxxx.update jinja plugin at the end of the template.

After updateing both my ansible.cfg and provisioning-vars.yaml the playbook worked correctly. So it seems there must have been a changes since openshift-ansible-3.11.51. Does this mean that cloud_init is not a mandatory key for profile? If so, it seems to me like a bug. If it isn't a bug though, I believe it should be at least documented there: https://github.com/oVirt/ovirt-ansible-vm-infra/blob/master/README.md

Nope, the mandatory key is the cloud_init field, but I added this because is useful to me :). I'm agree with you that this must be documented, thanks for the suggestion :), I will try to add those changes soon.

Thank you for such a quick reaction!

Was this page helpful?
0 / 5 - 0 ratings