Bug 1534096

Summary: Adding credentials is broken in the latest drop due to tower defaulting to v2 api - This makes it impossible to create a ansible_playbook with a vault
Product: Red Hat CloudForms Management Engine Reporter: ldomb
Component: ProvidersAssignee: James Wong <jwong>
Status: CLOSED DUPLICATE QA Contact: Dave Johnson <dajohnso>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 5.9.0CC: gblomqui, jfrey, jhardy, kmorey, mkanoor, obarenbo, tfitzger
Target Milestone: GA   
Target Release: cfme-future   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-01-13 13:54:56 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: Ansible Target Upstream Version:
Embargoed:

Description ldomb 2018-01-13 02:39:57 UTC
Description of problem:
It looks like that the credentials part of ansible inside in CFME is not updated in the latest drop of the appliance. For example, it is not possible anymore to create a machine credential with a vault as the tower api has changed!

Since tower 3.2.x you have to do 3 steps to achieve this: 

[root@host160 ~]# tower-cli credential create --name="rhv-ocp" --organization=CFME --credential-type="Machine" --inputs='{"username":"root","password":"redhat"}'
Resource changed.
== ======= =============== 
id  name   credential_type 
== ======= =============== 
 5 rhv-ocp               1
== ======= =============== 

[root@host160 ~]# tower-cli credential create --name="rhv-ocp-vault" --organization=CFME --inputs='{"vault_password":"redhat"}'  --credential-type="Vault"
Resource changed.
== ============= =============== 
id     name      credential_type 
== ============= =============== 
 6 rhv-ocp-vault               3
== ============= =============== 
[root@host160 ~]# tower-cli inventory list
== ====================== ============ 
id          name          organization 
== ====================== ============ 
 2 CFME Default Inventory            2
== ====================== ============ 
[root@host160 ~]# tower-cli job_template create --name ocp-rhv --project=rhv-ocp --inventory=2 --credential rhv-ocp --vault-credential rhv-ocp-vault --playbook ocp-deploy-rhv.yml
Resource changed.
== ======= ========= ======= ================== 
id  name   inventory project      playbook      
== ======= ========= ======= ================== 
 7 ocp-rhv         2       6 ocp-deploy-rhv.yml
== ======= ========= ======= ================== 

So what it means is that the method needs to be rewritten which communicates with tower 3.2.x. What's worse is that when creating a catalog item now I can only choose machine creds. These Machine creds do NOT have vaults anymore. Thus I cannot decrypt my vault during the run. 

This needs to be adapted/fixed to the behavior of tower 3.2 where multiple creds can be select to run a job. Unless we fall back to v1 tower api we will have to make multi creds available for the ansible inside playbook job.

Version-Release number of selected component (if applicable):
5.9.0.16.20180109204148_7ac9852

How reproducible:


Steps to Reproduce:
1. Create a ansible inside machine credential and add vault variables
2.
3.

Actual results:
This will fail


Expected results:
This should work

Additional info:

You can use my step to create one. Then go to the catalog item and try to add the vault variable which was just created. You won't be able to add it as the UI does not let me choose 2 creds. Which would be machine + vault. Or ec2 plus vault etc...

Please let me know if there are any questions.

Comment 2 Greg McCullough 2018-01-13 13:54:56 UTC
Thanks

*** This bug has been marked as a duplicate of bug 1533630 ***