- name: make the app be real
  hosts: os_control_stg[0]:os_control
  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
  vars:
    - ocp4: true

  roles:
  - role: openshift/project
    app: monitor-gating
    description: Monitor the packager and gating workflow
    appowners:
    - nphilipp
    - zlopez
    - patrikp

  - role: rabbit/user
    username: "monitor-gating{{ env_suffix }}"
    sent_topics: ^org\.fedoraproject\.{{ env_short }}\.monitor-gating\..*

  - role: openshift/keytab
    app: monitor-gating
    key: monitor-gating-keytab
    secret_name: monitor-gating-keytab
    service: packagerbot

  - role: openshift/secret-file
    app: monitor-gating
    secret_name: monitor-gating-fedora-messaging-key
    key: monitor-gating.key
    privatefile: "rabbitmq/{{env}}/pki/private/monitor-gating{{env_suffix}}.key"

  - role: openshift/secret-file
    app: monitor-gating
    secret_name: monitor-gating-fedora-messaging-crt
    key: monitor-gating.crt
    privatefile: "rabbitmq/{{env}}/pki/issued/monitor-gating{{env_suffix}}.crt"

  - role: openshift/secret-file
    app: monitor-gating
    secret_name: monitor-gating-fedora-messaging-ca
    key: monitor-gating.ca
    privatefile: "rabbitmq/{{env}}/pki/ca.crt"

  - role: openshift/object
    app: monitor-gating
    template: imagestream.yml
    objectname: imagestream.yml

  - role: openshift/object
    app: monitor-gating
    template: buildconfig.yml
    objectname: buildconfig.yml

  - role: openshift/object
    app: monitor-gating
    template: secret.yml
    objectname: secret.yml

  - role: openshift/object
    app: monitor-gating
    template: configmap.yml
    objectname: configmap.yml

  - role: openshift/secret-file
    app: monitor-gating
    secret_name: monitor-gating-ssh
    key: id_rsa
    privatefile: "git-ssh/monitor_gating"

  - role: openshift/object
    app: monitor-gating
    template: deploymentconfig.yml
    objectname: deploymentconfig.yml

  - role: openshift/start-build
    app: monitor-gating
    buildname: monitor-gating-build
    objectname: monitor-gating-build
    tags:
        - build

  - role: openshift/object
    app: monitor-gating
    template: dashboard_config.yml
    objectname: dashboard_config.yml

  - role: openshift/object
    app: monitor-gating
    template: dashboard_configmap.yml
    objectname: dashboard_configmap.yml

  - role: openshift/object
    app: monitor-gating
    template: dashboard_configmap.yml
    objectname: dashboard_configmap.yml

  - role: openshift/object
    app: monitor-gating
    template: dashboard_route.yml
    objectname: dashboard_route.yml

  - role: openshift/object
    app: monitor-gating
    template: dashboard_serviceaccount.yml
    objectname: dashboard_serviceaccount.yml

  - role: openshift/object
    app: monitor-gating
    template: dashboard_deploymentconfig.yml
    objectname: dashboard_deploymentconfig.yml
