Bug 1739487

Summary: [Automate] Post-migration playbook doesn't wait for IP address to be inventoried
Product: Red Hat CloudForms Management Engine Reporter: Fabien Dupont <fdupont>
Component: V2VAssignee: Fabien Dupont <fdupont>
Status: CLOSED CURRENTRELEASE QA Contact: Shveta <sshveta>
Severity: urgent Docs Contact: Red Hat CloudForms Documentation <cloudforms-docs>
Priority: urgent    
Version: 5.11.0CC: bthurber, pvauter, simaishi, smallamp
Target Milestone: GAFlags: dmetzger: mirror+
Target Release: 5.11.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.11.0.21 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1772642 (view as bug list) Environment:
Last Closed: 2019-12-13 14:54:52 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: V2V Target Upstream Version:
Embargoed:
Bug Depends On: 1739247    
Bug Blocks:    

Description Fabien Dupont 2019-08-09 12:35:43 UTC
Description of problem:

The method that launches the pre/post-migration playbook doesn't check if the IP address of the VM is present in the inventory. For post-migration, the IP address can take some time to appear once the VM is started: the RHV agent needs to collect it, then CloudForms needs to refresh its inventory.

If the IP address isn't present, the Ansible Playbook service template will use its default, i.e. localhost. The consequence is that the playbook is run with the ManageIQ appliance as only host in the inventory. Depending on the playbook tasks, this could irremediably break the appliance.

How reproducible: depends on inventory refresh

Steps to Reproduce:
1. Create a migration plan with a post-migration playbook
2. Start the migration plan

Actual results:
The post migration playbook is run with only localhost in inventory

Expected results:
The playbook launcher waits for the IP address to be present before starting the playbook.

Additional info:

Comment 3 CFME Bot 2019-08-16 18:17:08 UTC
New commit detected on ManageIQ/manageiq-content/ivanchuk:

https://github.com/ManageIQ/manageiq-content/commit/e0803ee37f51377874b8109de5124c44ca2bcccf
commit e0803ee37f51377874b8109de5124c44ca2bcccf
Author:     tina <tfitzger>
AuthorDate: Fri Aug 16 12:43:33 2019 -0400
Commit:     tina <tfitzger>
CommitDate: Fri Aug 16 12:43:33 2019 -0400

    Merge pull request #560 from fdupont-redhat/v2v_wait_for_ip_ansible_playbook_launch

    V2v wait for ip ansible playbook launch

    (cherry picked from commit f1b641ba294837497c49237791db37474670e117)

    https://bugzilla.redhat.com/show_bug.cgi?id=1739487

 content/automate/ManageIQ/Transformation/Ansible.class/__methods__/launchplaybookasaservice.rb | 35 +-
 content/automate/ManageIQ/Transformation/Ansible.class/__methods__/launchplaybookasaservice.yaml | 2 +
 content/automate/ManageIQ/Transformation/StateMachines/Ansible.class/transformationplaybook.yaml | 1 +
 spec/content/automate/ManageIQ/Transformation/Ansible.class/__methods__/launchplaybookasaservice_spec.rb | 25 +-
 4 files changed, 44 insertions(+), 19 deletions(-)

Comment 4 Shveta 2019-08-27 02:01:54 UTC
ansible post migration playbooks works fine in 5.11.0.21.20190821214526_b0060d0

Comment 5 Fabien Dupont 2019-11-14 18:27:24 UTC
It would be great to backport it to CFME 5.10

Comment 6 Sudhir Mallamprabhakara 2019-11-14 19:13:57 UTC
ack for backport.