Bug 1474630 - Install CRS as docker registry storage failed due to AnsibleUndefinedVariable error
Install CRS as docker registry storage failed due to AnsibleUndefinedVariable...
Status: CLOSED ERRATA
Product: OpenShift Container Platform
Classification: Red Hat
Component: Installer (Show other bugs)
3.6.0
Unspecified Unspecified
high Severity high
: ---
: 3.7.0
Assigned To: Andrew Butcher
Johnny Liu
: TestBlocker
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-07-25 01:30 EDT by Wenkai Shi
Modified: 2017-11-28 17:05 EST (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-11-28 17:05:56 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Wenkai Shi 2017-07-25 01:30:09 EDT
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 05:54:22 EDT
This block all CRS relate testing.
Comment 3 Jose A. Rivera 2017-07-26 15:37:01 EDT
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-26 22:17:49 EDT
(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 03:14:20 EDT
(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 08:12:34 EDT
https://github.com/openshift/openshift-ansible/pull/4891 should fix this
Comment 7 Wenkai Shi 2017-07-27 14:29:32 EDT
(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-27 23:10:19 EDT
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 17:05:56 EST
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

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