Bug 1849517

Summary: [RFE] Allow passing arbitrary vars to ansible
Product: [oVirt] ovirt-hosted-engine-setup Reporter: Yedidyah Bar David <didi>
Component: GeneralAssignee: Yedidyah Bar David <didi>
Status: CLOSED CURRENTRELEASE QA Contact: Nikolai Sednev <nsednev>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 2.4.1CC: arachman, bugs, dholler, mavital, stirabos
Target Milestone: ovirt-4.4.2Keywords: Triaged
Target Release: 2.4.6Flags: sbonazzo: ovirt-4.4?
sbonazzo: planning_ack?
sbonazzo: devel_ack+
mavital: testing_ack+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ovirt-hosted-engine-setup-2.4.6-1.el8ev Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1851677 (view as bug list) Environment:
Last Closed: 2020-09-18 07:11:51 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Integration RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1785014    

Description Yedidyah Bar David 2020-06-22 05:52:27 UTC
Description of problem:

Current ovirt-hosted-engine-setup is a wrapper to several ansible playbooks.

The actual code is in a separate project, ovirt-ansible-hosted-engine-setup, with its own documentation - in particular, allowing passing specific variables to affects its behavior.

IMO it should be possible to allow passing such variables directly from 'hosted-engine --deploy', based on the documentation of ovirt-ansible-hosted-engine-setup, and with the understanding that this can conflict with variables otherwise already set by 'hosted-engine --deploy'.

I am currently opening this bug because we recently fixed bug 1816619, adding a new variable to affect the deploy process, but provide no easy means for the user to use this new functionality. While it can be even more helpful to add to 'hosted-engine --deploy' specific functionality for each such variable (including, perhaps, user interaction, validation, etc.), as we usually do, I do not think this is mandatory.

Version-Release number of selected component (if applicable):
Current master, probably since 4.3

How reproducible:
Always

Steps to Reproduce:
1. Install ovirt-ansible-hosted-engine-setup with a version that includes a fix to bug 1816619. 
2. Deploy hosted-engine with an old appliance and a broken mirror, such that 'dnf update ovirt-engine' on the engine VM fails, 
3.

Actual results:
Fails

Expected results:
Be able to easily pass some option that will cause the ansible code to run with he_offline_deployment=true, so that deploy will succeed

Additional info:
Already pushed a patch to do this, adding a new option:

    --ansible-extra-vars=VARS
        Pass '--extra-vars=VARS' to all ansible calls

This should allow to do (2.) as:

hosted-engine --deploy --ansible-extra-vars=he_offline_deployment=true

Opening this bug currently only on the CLI 'hosted-engine --deploy'. We probably want a similar bug for the cockpit UI - but I do not know the code there well, no idea how hard/easy it is to do.

Comment 1 Yedidyah Bar David 2020-06-22 05:58:42 UTC
This was also reported in ovirt-users mailing list, thread subject was:

[ovirt-users] Hosted engine deployment fails consistently when trying to download files.

Comment 2 Yedidyah Bar David 2020-06-28 05:53:18 UTC
bug 1851677 is a clone for cockpit.

Comment 3 Nikolai Sednev 2020-08-13 14:11:59 UTC
alma03 ~]# hosted-engine --deploy --ansible-extra-vars=he_offline_deployment=true

alma03 ~]# grep "he_offline_deployment"  /var/log/ovirt-hosted-engine-setup/ovirt-hosted-engine-setup-20200813170207-x8q8o7.log
2020-08-13 17:02:07,101+0300 DEBUG otopi.context context.dumpEnvironment:775 ENV OVEHOSTED_CORE/ansibleUserExtraVars=str:'he_offline_deployment=true'
2020-08-13 17:02:07,764+0300 DEBUG otopi.context context.dumpEnvironment:775 ENV OVEHOSTED_CORE/ansibleUserExtraVars=str:'he_offline_deployment=true'
2020-08-13 17:02:18,677+0300 DEBUG otopi.ovirt_hosted_engine_setup.ansible_utils ansible_utils.run:194 ansible-playbook: cmd: ['/bin/ansible-playbook', '--module-path=/usr/share/ovirt-hosted-engine-setup/ansible', '--inventory=localhost,', '--extra-vars=@/tmp/tmplys4rby6', '--extra-vars=he_offline_deployment=true', '--tags=get_network_interfaces', '--skip-tags=always', '/usr/share/ovirt-hosted-engine-setup/ansible/trigger_role.yml']
2020-08-13 17:07:46,049+0300 DEBUG otopi.context context.dumpEnvironment:775 ENV OVEHOSTED_CORE/ansibleUserExtraVars=str:'he_offline_deployment=true'
2020-08-13 17:07:49,049+0300 DEBUG otopi.ovirt_hosted_engine_setup.ansible_utils ansible_utils.run:194 ansible-playbook: cmd: ['/bin/ansible-playbook', '--module-path=/usr/share/ovirt-hosted-engine-setup/ansible', '--inventory=localhost,nsednev-he-1.qa.lab.tlv.redhat.com', '--extra-vars=@/tmp/tmpri7u02xe', '--extra-vars=he_offline_deployment=true', '--tags=initial_clean', '--skip-tags=always', '/usr/share/ovirt-hosted-engine-setup/ansible/trigger_role.yml']

ovirt-hosted-engine-setup-2.4.6-1.el8ev.noarch
ovirt-hosted-engine-ha-2.4.4-1.el8ev.noarch
vdsm-4.40.25-1.el8ev.x86_64
rhvm-appliance-4.4-20200707.0.el8ev.src.rpm
Linux 4.18.0-193.14.3.el8_2.x86_64 #1 SMP Mon Jul 20 15:02:29 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Red Hat Enterprise Linux release 8.2 (Ootpa)

Comment 4 Nikolai Sednev 2020-08-13 14:13:43 UTC
ansible-extra-vars being passed as expected and deployment continued even with disabled repos and with an old appliance, locally installed on host.

Comment 5 Sandro Bonazzola 2020-09-18 07:11:51 UTC
This bugzilla is included in oVirt 4.4.2 release, published on September 17th 2020.

Since the problem described in this bug report should be resolved in oVirt 4.4.2 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.