---
- name: Metrics Install Checkpoint Start
  hosts: all
  gather_facts: false
  tasks:
  - name: Set Metrics install 'In Progress'
    run_once: true
    set_stats:
      data:
        installer_phase_metrics:
          title: "Metrics Install"
          playbook: "playbooks/openshift-metrics/config.yml"
          status: "In Progress"
          start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"

- name: OpenShift Metrics
  hosts: oo_first_master
  roles:
  - role: openshift_metrics

# Workaround:
# When using cri-o networking metrics do
# not appear unless the -node.service is restarted
# BZ(s):
# https://bugzilla.redhat.com/show_bug.cgi?id=1646886
# https://bugzilla.redhat.com/show_bug.cgi?id=1631300
# https://bugzilla.redhat.com/show_bug.cgi?id=1649984
# https://bugzilla.redhat.com/show_bug.cgi?id=1647707
- import_playbook: ../../openshift-node/private/restart.yml
  when: openshift_use_crio | default(false) | bool
  vars:
    openshift_node_restart_docker_required: False
    openshift_node_restart_drain: True

- name: Metrics Install Checkpoint End
  hosts: all
  gather_facts: false
  tasks:
  - name: Set Metrics install 'Complete'
    run_once: true
    set_stats:
      data:
        installer_phase_metrics:
          status: "Complete"
          end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
