Bug 1574226

Summary: Can't specify variables with scope to only one role
Product: [oVirt] ovirt-ansible-collection Reporter: Petr Kubica <pkubica>
Component: image-templateAssignee: Ondra Machacek <omachace>
Status: CLOSED CURRENTRELEASE QA Contact: Petr Kubica <pkubica>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 1.1.6CC: mperina
Target Milestone: ovirt-4.2.4Flags: rule-engine: ovirt-4.2+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ovirt-ansible-image-template-1.1.7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-06-26 08:46:21 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Infra RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Petr Kubica 2018-05-02 20:26:47 UTC
Description of problem:
Uploading one image into two different datacenters will fail:
  vars:
    qcow_url: http://server.com/image.qcow2
    template_cluster: 
    template_name: pkubica-rhevm30-rhel62
    template_memory: 4GiB
    template_cpu: 4
    template_disk_size: 50GiB

  roles:
    - role: oVirt.image-template
      template_cluster: cluster_in_datacenter1
      template_disk_storage: storage_in_datacenter1
    - role: oVirt.image-template
      template_cluster: cluster_in_datacenter2
      template_disk_stroage: storage_in_datacenter2

Separate into two different plays will work but template_name must be different to each datacenter.

when image doesn't exist in engine:
TASK [oVirt.image-template : Fetch storages] **********************
task path: /home/pkubica/.ansible/roles/oVirt.image-template/tasks/qcow2_image.yml:42
...
The full traceback is:
Traceback (most recent call last):
  File "/tmp/ansible_6Xuc6e/ansible_module_ovirt_storage_domains_facts.py", line 87, in main
    connection = create_connection(auth)
  File "/tmp/ansible_6Xuc6e/ansible_modlib.zip/ansible/module_utils/ovirt.py", line 146, in create_connection
    headers=auth.get('headers', None),
  File "/usr/lib64/python2.7/site-packages/ovirtsdk4/__init__.py", line 303, in __init__
    raise Error('The \'url\' parameter is mandatory')
Error: The 'url' parameter is mandatory

fatal: [engine.example.com]: FAILED! => {
    "changed": false, 
    "invocation": {
        "module_args": {
            "fetch_nested": false, 
            "nested_attributes": [], 
            "pattern": ""
        }
    }, 
    "msg": "The 'url' parameter is mandatory"
}

when image exist in engine:
same traceback but in task:
TASK [oVirt.image-template : Check if template already exists]

Version-Release number of selected component (if applicable):
ansible-2.5.1-1.el7.noarch
oVirt.image-template (1.1.6)

How reproducible:
always

Steps to Reproduce:
see description

Actual results:
User must separate roles into plays but using variable with role should work.
Also specify only qcow_url and template_name to upload multiple images should also work

Comment 1 Petr Kubica 2018-06-25 12:26:13 UTC
Verified in
ovirt-ansible-image-template-1.1.7-1.el7ev.noarch

Comment 2 Sandro Bonazzola 2018-06-26 08:46:21 UTC
This bugzilla is included in oVirt 4.2.4 release, published on June 26th 2018.

Since the problem described in this bug report should be
resolved in oVirt 4.2.4 release, it has been closed with a resolution of CURRENT RELEASE.

If the solution does not work for you, please open a new bug report.