Bug 1487082 - [ovirt-ansible-roles] Ansible caching ovirt-ansible-modules so sometimes they are not loaded from role's library
Summary: [ovirt-ansible-roles] Ansible caching ovirt-ansible-modules so sometimes they...
Keywords:
Status: CLOSED DEFERRED
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-ansible-roles
Version: 4.1.5
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
: ---
Assignee: Ondra Machacek
QA Contact: Petr Kubica
URL:
Whiteboard:
Depends On: 1462821 1487113
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-08-31 08:36 UTC by Petr Kubica
Modified: 2022-06-27 11:46 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1487113 (view as bug list)
Environment:
Last Closed: 2019-01-14 08:36:22 UTC
oVirt Team: Infra
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github ansible ansible issues 17078 0 None None None 2017-08-31 09:33:00 UTC
Github ansible ansible issues 17747 0 None None None 2017-08-31 09:32:32 UTC
Github ansible ansible issues 36028 0 None None None 2018-04-11 10:35:10 UTC
Red Hat Issue Tracker RHV-46682 0 None None None 2022-06-27 11:46:53 UTC

Description Petr Kubica 2017-08-31 08:36:16 UTC
Description of problem:
Ansible caching ovirt-ansible-modules so sometimes they are not loaded from role's library

For example:
When user will use role/module for managing hosts (ovirt-hosts module or ovirt-infra role) it take the module from: /usr/lib/python2.7/site-packages/ansible/modules/cloud/ovirt/ovirt_hosts.py
after in the same playbook when user will use role with this module included in library folder (/usr/share/ansible/roles/ovirt-cluster-upgrade/library/ovirt_hosts.py), the module in library will be ignored because this module is already cached. 


Version-Release number of selected component (if applicable):
ansible-2.3.1.0-3.el7.noarch
ovirt-ansible-roles-1.0.1-1.el7ev.noarch

How reproducible:
Always

Steps to Reproduce:
1. run infra role and host upgrade role in same playbook

Actual results:
affected all modules in library folders (user can run ansible module before role)

Comment 1 Lukas Svaty 2017-09-04 09:19:19 UTC
Can you add extra information on which modules are being used for what roles (Galaxy/included in RPM) and specific use-case where this is a problem?

Comment 2 Petr Kubica 2017-09-04 11:13:38 UTC
Introduction:
- Ansible uses modules merged in version 2.3.1.0-3
location of these modules:
[1] /usr/lib/python2.7/site-packages/ansible/modules/cloud/ovirt/ in the ansible package

- When user use oVirt Ansible module Ansible will take the module from [1]. Roles may have own modules specified in their folder called library
example location: 
[2] /usr/share/ansible/roles/ovirt-cluster-upgrade/library/ from ovirt-ansible rpm

- so for example in ovirt-cluster-upgrade role we have in [2] modules ( ovirt_clusters.py ovirt_hosts.py... and others) which is different than in [1] (fixed some bugs in modules until they will be merged into Ansible)

The problem is:
When user will use:
- oVirt Ansible role which doesn't have fixed modules in library folder and then he will use oVirt Ansible role that have fixed modules in library folder => second role will use some modules from [1] (first role will use modules A,B,C second role needs modules A,C,D specified in library folder so second role now will use A,C from [1] and D from [2])

- users own created playbook that use some oVirt Ansible modules from Ansible and then he run oVirt Ansible role => ansible will cache modules from [1] and the next role will use cached modules (same as before)

- directly oVirt Ansible module and after that he will use oVirt Ansible role => every module used before will be cached and after it will be ignored in oVirt Ansible role

Conclusion:
using older module from [1] (directly or in any role) before oVirt Ansible role which has these modules fixed in library folder [2] may result into different and unpredictable behavior

worst scenario: ignored all modules in all library folders [2] (all modules are cached from [1])

- affected RPM and Galaxy as well.

example problem (there are many cases):
- using module ovirt_hosts (directly or in ovirt-infra role...etc), have a host in maintenance, upgrade hosts with status [Maintenance] ([Maintenance, UP]..) via role ovirt-cluster-upgrade - role will freeze on maintenance hosts
=> ovirt-cluster-upgrade should use module ovirt_hosts.py from [2] but it will use module from [1])

Comment 3 Martin Perina 2019-01-14 08:36:22 UTC
Closing as the issue is in Ansible itself and it will most probably be fixed once Ansible as a platform will switch to ansible-collections


Note You need to log in before you can comment on or make changes to this bug.