---
- name: check required packages
  include: check-package.yaml
  with_items:
  - curl
  - python
  - which
  - openssl
  - git
  - python-libcloud
  - python2-jmespath

- name: check required packages for enterprise deployments
  include: check-package.yaml
  with_items:
  - tar
  - qemu-img
  when: openshift_deployment_type == 'openshift-enterprise'

- name: check required packages for metrics
  include: check-package.yaml
  with_items:
  - java-1.8.0-openjdk-headless
  - httpd-tools
  - python2-passlib
  when: openshift_hosted_metrics_deploy

- name: check gcloud utility
  command: which gcloud
  ignore_errors: true
  changed_when: false
  register: gcloud_state

- name: assert that gcloud is present
  assert:
    that:
    - gcloud_state | succeeded
    msg: gcloud utility seems to be missing. For installation information, see https://cloud.google.com/sdk/downloads

- block:
  - name: stat rhel image file
    stat:
      path: '{{ rhel_image_path }}'
    register: rhel_image_path_stat

  - name: verify that the image is readable
    assert:
      that:
      - 'rhel_image_path_stat.stat.exists'
      - 'rhel_image_path_stat.stat.readable'
      msg: RHEL image file must exist and it must be readable
  when: openshift_deployment_type == 'openshift-enterprise'
