Bug 1547727

Summary: Glusterfs installation fails when glusterfs_registry is undefined. Keyword: ansible_managed
Product: OpenShift Container Platform Reporter: Jiří Mencák <jmencak>
Component: InstallerAssignee: Jose A. Rivera <jarrpa>
Status: CLOSED ERRATA QA Contact: Wenkai Shi <weshi>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 3.9.0CC: aos-bugs, jmencak, jokerman, mbruzek, mmccomas, rteague
Target Milestone: ---   
Target Release: 3.9.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: aos-scalability-39
Fixed In Version: Doc Type: No Doc Update
Doc Text:
undefined
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-03-28 14:29:21 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:
Attachments:
Description Flags
Ansible inventory and log file. none

Description Jiří Mencák 2018-02-21 19:58:05 UTC
Created attachment 1398983 [details]
Ansible inventory and log file.

Description of problem:
With recent openshift-ansible, glusterfs installation fails unless "glusterfs_registry" group is also defined.

Version-Release number of the following components:

ansible 2.4.2.0
  config file = /root/.ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /bin/ansible
  python version = 2.7.5 (default, Aug  4 2017, 00:39:18) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]

openshift-ansible-3.9.0-0.47.0-5-g9d319b8

How reproducible:
Always

Steps to Reproduce:
1. Install glusterfs without [glusterfs_registry] group

Actual results:
Failure summary:


  1. Hosts:    b1.lan, b2.lan, b3.lan, b8.lan
     Play:     Load kernel modules for nodes
     Task:     Ensure device mapper modules loaded
     Message:  AnsibleUndefinedVariable: Unable to look up a name or access an attribute in template string (#{{ ansible_managed }}
               dm_thin_pool
               dm_multipath
               target_core_user
               {% if inventory_hostname in groups.glusterfs or inventory_hostname in groups.glusterfs_registry %}
               dm_snapshot
               dm_mirror
               {% endif %}
               ).
               Make sure your variable name does not contain invalid characters like '-': argument of type 'StrictUndefined' is not iterable

Expected results:
Glusterfs installation works even without [glusterfs_registry] group defined.

Additional info:
Ansible run in the attachment.
Workaround: use empty [glusterfs_registry] group in the inventory.
Proposed fix (credits Matt Bruzek): 
--- glusterfs.conf.j2      2018-02-21 16:08:56.194000000 +0100
+++ glusterfs.conf.j2.fixed      2018-02-21 19:40:01.251000000 +0100
@@ -2,7 +2,7 @@
 dm_thin_pool
 dm_multipath
 target_core_user
-{% if inventory_hostname in groups.glusterfs or inventory_hostname in groups.glusterfs_registry %}
+{% if ('glusterfs' in groups and inventory_hostname in groups['glusterfs']) or ('glusterfs_registry' in groups and inventory_hostname in groups['glusterfs_registry']) %}
 dm_snapshot
 dm_mirror
 {% endif %}

With openshift-ansible-3.9.0-0.42.0-48-gdea7e61 I was able to install without any workarounds.

Comment 1 Russell Teague 2018-02-21 21:26:39 UTC
Bug introduced with https://github.com/openshift/openshift-ansible/pull/7028

Jose, could you take a look at this?

Comment 2 Jose A. Rivera 2018-02-21 21:36:53 UTC
PR already submitted: https://github.com/openshift/openshift-ansible/pull/7237

Comment 4 Wenkai Shi 2018-03-05 03:04:52 UTC
Verified with version openshift-ansible-3.9.0-0.53.0.git.0.f8f01ef.el7. Installation works well without [glusterfs_registry] group set(set [glusterfs] group only).

Remove NeedsTestCase Keyword since existing test case can cover it.

Comment 7 errata-xmlrpc 2018-03-28 14:29:21 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/RHBA-2018:0489