- name: make the app be real
  hosts: os_masters_stg[0] # only in staging for the ARC deployment
  user: root
  gather_facts: False

  vars_files:
    - /srv/web/infra/ansible/vars/global.yml
    - "/srv/private/ansible/vars.yml"
    - /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml

  roles:
  # oc new-project application-monitoring
  - role: openshift/project
    app: application-monitoring
    description: Hosts the application monitoring operator
    appowners:
    - asaleh
    - siddharthvipul1

  post_tasks:
  - name: Apply node labels
    command: oc label --overwrite namespace application-monitoring monitoring-key=cpe

  - name: Apply node labels for bodhi POC
    command: oc label --overwrite namespace bodhi monitoring-key=cpe

  - name: Make other pods available to the application-monitoring project
    command: oc adm pod-network make-projects-global application-monitoring

  - name: Copy files
    copy: src={{roles_path}}/openshift-apps/application-monitoring/files/ dest=/etc/openshift_apps/application-monitoring/

  - name: Prometheus CRDs
    command: oc -n application-monitoring apply -f /etc/openshift_apps/application-monitoring/prometheus-operator/example/prometheus-operator-crd/

  - name: Prometheus CRD RBAC
    command: oc -n application-monitoring apply -f /etc/openshift_apps/application-monitoring/prometheus-operator/example/rbac/prometheus-operator-crd/

  - name: Prometheus Operator RBAC
    command: oc -n application-monitoring apply -f /etc/openshift_apps/application-monitoring/prometheus-operator/example/rbac/prometheus-operator/

  - name: Prometheus RBAC
    command: oc -n application-monitoring apply -f /etc/openshift_apps/application-monitoring/prometheus-operator/example/rbac/prometheus/

