Bug 1509157

Summary: Unable to list known health checks
Product: OpenShift Container Platform Reporter: Wenkai Shi <weshi>
Component: InstallerAssignee: Luke Meyer <lmeyer>
Status: CLOSED ERRATA QA Contact: Wenkai Shi <weshi>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.7.0CC: aos-bugs, jokerman, mmccomas, sdodson
Target Milestone: ---   
Target Release: 3.7.z   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: In order for the adhoc.yml playbook to list health checks, they are all loaded, and one failed to load in that environment. Consequence: Listing health checks failed with an error. Fix: The problem health check was adjusted. Result: Listing works again.
Story Points: ---
Clone Of:
: 1538407 (view as bug list) Environment:
Last Closed: 2018-04-05 09:30:40 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:
Bug Depends On:    
Bug Blocks: 1538407    

Description Wenkai Shi 2017-11-03 08:29:50 UTC
Description of problem:
Unable to list known health checks

Version-Release number of the following components:

How reproducible:

Steps to Reproduce:
1. Run /usr/share/ansible/openshift-ansible/playbooks/byo/openshift-checks/adhoc.yml playbook.

Actual results:
# grep -nir "openshift_deployment_type" hosts

# ansible-playbook -i hosts -v /usr/share/ansible/openshift-ansible/playbooks/byo/openshift-checks/adhoc.yml
TASK [List known health checks] **************************************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "This check expects the 'openshift_deployment_type' inventory variable to be defined\nin order to proceed, but it is undefined. There may be a bug\nin Ansible, the checks, or their dependencies.", "playbook_context": "adhoc"}
	to retry, use: --limit @/usr/share/ansible/openshift-ansible/playbooks/byo/openshift-checks/adhoc.retry

PLAY RECAP ***********************************************************************************************************************************************************************************
localhost                  : ok=1    changed=0    unreachable=0    failed=1   

Expected results:
Should list known health checks successfully
Additional info:

Comment 1 Wenkai Shi 2017-11-03 09:37:14 UTC
Same result in ansible- & ansible-

Comment 2 Tim Bielawa 2017-11-03 14:31:12 UTC
I ran into an issue like this recently while writing up the 'add container provider' playbooks for openshift-management. Specifically, in my playbook it was not picking up variables I had defined in my inventory, just like you have.

I looked quickly at the playbook you referenced, playbooks/byo/openshift-checks/adhoc.yml and confirmed you ran into the same 'issue' as me. That is to say, inventory variables are not being picked up.

This is caused by the definition of the 'hosts' in the adhoc checks playbook:

> - name: OpenShift health checks
>   hosts: localhost
>   connection: local

When `hosts` is 'localhost' I found that ansible does not consider the provided '-i hosts' inventory file.

I do not know if historically Ansible used to read the inventory file, but I know that the present behavior is to ignore the inventory. I'm tagging Russell to check this out, too.

Comment 4 Luke Meyer 2018-01-15 19:58:38 UTC
The play runs against localhost, and the code aborts because openshift_deployment_type is not defined for localhost. Defining it (or just deployment_type) in the [OSEv3:vars] subsection does not define it for localhost. You can set it for localhost explicitly by adding at the top of the inventory file:

localhost openshift_deployment_type=openshift-enterprise

...or by specifying it as an extra variable. Obviously, you shouldn't have to do that to get this to list checks. Unrelated changes to initialization code broke this path.

Comment 6 Luke Meyer 2018-01-18 12:33:26 UTC
Merged to master
3.7 backport https://github.com/openshift/openshift-ansible/pull/6772

Comment 8 Wenkai Shi 2018-01-25 02:47:50 UTC
Verified with version openshift-ansible-3.7.26-1.git.0.f87f1af.el7, known health checks can be list with command [1].

[1]. ansible-playbook -i hosts -v /usr/share/ansible/openshift-ansible/playbooks/byo/openshift-checks/adhoc.yml

     Message:  This playbook is meant to run health checks, but no checks were requested. Set the `openshift_checks` variable to a comma-separated list of check names or a YAML list. Available checks:
               Tags can be used as a shortcut to select multiple checks. Available tags and the checks they select:
                 @etcd = etcd_imagedata_size,etcd_traffic,etcd_volume
                 @health = curator,diagnostics,docker_storage,elasticsearch,etcd_traffic,etcd_volume,fluentd,fluentd_config,kibana,logging_index_time,ovs_version
                 @logging = curator,elasticsearch,fluentd,kibana,logging_index_time
                 @preflight = disk_availability,docker_image_availability,docker_storage,memory_availability,package_availability,package_update,package_version

Comment 12 errata-xmlrpc 2018-04-05 09:30:40 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.