Bug 1474630

Summary: Install CRS as docker registry storage failed due to AnsibleUndefinedVariable error
Product: OpenShift Container Platform Reporter: Wenkai Shi <weshi>
Component: InstallerAssignee: Andrew Butcher <abutcher>
Status: CLOSED ERRATA QA Contact: Johnny Liu <jialiu>
Severity: high Docs Contact:
Priority: high    
Version: 3.6.0CC: aos-bugs, jarrpa, jokerman, mmccomas, rcyriac
Target Milestone: ---Keywords: TestBlocker
Target Release: 3.7.0   
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: 2017-11-28 22:05:56 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Wenkai Shi 2017-07-25 05:30:09 UTC
Description of problem:
Install OCP with CRS as docker-registry back end storage, installation failed due to AnsibleUndefinedVariable error. According to code, seems "openshift.common.examples_content_version" not found.

Version-Release number of the following components:
openshift-ansible-3.6.169-1.git.0.440d532.el7
ansible-2.2.3.0-1.el7

How reproducible:
100%

Steps to Reproduce:
1. install OCP with CRS
# cat hosts
[OSEv3:children]
masters
nodes
glusterfs

[OSEv3:vars]
...
openshift_hosted_registry_storage_kind=glusterfs
openshift_storage_glusterfs_is_native=false
openshift_storage_glusterfs_heketi_is_native=false
openshift_storage_glusterfs_heketi_url=glusterfs-1.example.com
openshift_storage_glusterfs_heketi_admin_key=redhat
[masters]
master-1.example.com

[nodes]
master-1.example.com
node-1.example.com

[glusterfs]
glusterfs-1.example.com
glusterfs-2.example.com
glusterfs-3.example.com


2.
3.

Actual results:
# ansible-playbook -i hosts -v /usr/share/ansible/openshift-ansible/playbooks/byo/config.yml
...
TASK [openshift_storage_glusterfs : Generate topology file] ********************
Tuesday 25 July 2017  02:54:08 +0000 (0:00:00.039)       0:08:59.614 ********** 
fatal: [master-1.example.com]: FAILED! => {
    "changed": false, 
    "failed": true
}

MSG:

AnsibleUndefinedVariable: 'dict object' has no attribute 'openshift'
...

Expected results:
Installation succeed.

Additional info:

Comment 2 Wenkai Shi 2017-07-26 09:54:22 UTC
This block all CRS relate testing.

Comment 3 Jose A. Rivera 2017-07-26 19:37:01 UTC
I just saw the problem. The entries in the [glusterfs] group each need 'glusterfs_devices' and 'glusterfs_ip' variables defined.

Comment 4 Wenkai Shi 2017-07-27 02:17:49 UTC
(In reply to Jose A. Rivera from comment #3)
> I just saw the problem. The entries in the [glusterfs] group each need
> 'glusterfs_devices' and 'glusterfs_ip' variables defined.

Sorry for modify the inventory file, did this for protect hostname. in my true inventory file, it included the 'glusterfs_devices' variables.

Comment 5 Wenkai Shi 2017-07-27 07:14:20 UTC
(In reply to Jose A. Rivera from comment #3)
> I just saw the problem. The entries in the [glusterfs] group each need
> 'glusterfs_devices' and 'glusterfs_ip' variables defined.

I checked the jinja2 file, it should use "hostvars[node].openshift.common.ip" when "glusterfs_ip" not defined, this could works very well when using CNS.

# cat roles/openshift_storage_glusterfs/templates/v3.6/topology.json.j2
...
{%- if 'glusterfs_ip' in hostvars[node] -%}
                "{{ hostvars[node].glusterfs_ip }}"
{%- else -%}
                "{{ hostvars[node].openshift.common.ip }}"
{%- endif -%}
...

By the way, according to document, it mentioned each node must have "glusterfs_hostname" and "glusterfs_devices" variables defined as minimum configure.

# vim /usr/share/doc/openshift-ansible-docs-3.6.169/docs/example-inventories/hosts.byo.glusterfs.external.example
...
# Specify the glusterfs group, which contains the nodes of the external
# GlusterFS cluster. At a minimum, each node must have "glusterfs_hostname" 
# and "glusterfs_devices" variables defined.
...

There is a PR which could fix this issue I believe, or just update the document to tell customer should defined 'glusterfs_ip'. 

https://github.com/openshift/openshift-ansible/pull/4885

Comment 6 Scott Dodson 2017-07-27 12:12:34 UTC
https://github.com/openshift/openshift-ansible/pull/4891 should fix this

Comment 7 Wenkai Shi 2017-07-27 18:29:32 UTC
(In reply to Scott Dodson from comment #6)
> https://github.com/openshift/openshift-ansible/pull/4891 should fix this

Seems [1] better, please also merge [2] to avoid future issue.

[1] https://github.com/openshift/openshift-ansible/pull/4891
[2] https://github.com/openshift/openshift-ansible/pull/4905

Comment 8 Wenkai Shi 2017-07-28 03:10:19 UTC
Verified with version openshift-ansible-3.6.172.0.0-1.git.0.d90ca2b.el7, it could pass "Generate topology file" task without AnsibleUndefinedVariable error.

Comment 13 errata-xmlrpc 2017-11-28 22:05:56 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

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

https://access.redhat.com/errata/RHSA-2017:3188