Description of problem: Unable to list known health checks Version-Release number of the following components: openshift-ansible-3.7.0-0.190.0.git.0.129e91a.el7 How reproducible: 100% Steps to Reproduce: 1. Run /usr/share/ansible/openshift-ansible/playbooks/byo/openshift-checks/adhoc.yml playbook. 2. 3. Actual results: # grep -nir "openshift_deployment_type" hosts 34:openshift_deployment_type=openshift-enterprise # 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:
Same result in ansible-2.4.0.0-5.el7 & ansible-2.3.2.0-2.el7
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.
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.
https://github.com/openshift/openshift-ansible/pull/6744
Merged to master 3.7 backport https://github.com/openshift/openshift-ansible/pull/6772
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: curator diagnostics disk_availability docker_image_availability docker_storage elasticsearch etcd_imagedata_size etcd_traffic etcd_volume fluentd fluentd_config kibana logging logging_index_time memory_availability ovs_version package_availability package_update package_version 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
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:0636