- name: make the app be real
  hosts: os_control_stg[0]:os_control[0]
  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:
  - role: rabbit/queue
    username: the-new-hotness{{ env_suffix }}
    queue_name: the-new-hotness{{ env_suffix }}
    routing_keys:
      - "org.release-monitoring.*.anitya.project.version.update.v2"
      - "org.release-monitoring.*.anitya.project.version.update"
      - "org.release-monitoring.*.anitya.project.map.new"
      - "org.fedoraproject.*.buildsys.task.state.change"
    thresholds:
      warning: 10
      critical: 100
    sent_topics: ^org\.fedoraproject\.{{ env_short }}\.hotness\..*

  - role: openshift/project
    app: the-new-hotness
    description: Fedora-messaging consumer that listens to the-new-hotness.org and files bugzilla bugs in response.
    appowners:
    - zlopez

  - role: openshift/keytab
    app: the-new-hotness
    key: koji-keytab
    secret_name: the-new-hotness-keytab
    service: the-new-hotness
    host: "release-monitoring.org"
    when: env == "production"

  - role: openshift/keytab
    app: the-new-hotness
    key: koji-keytab
    secret_name: the-new-hotness-keytab
    service: the-new-hotness
    host: "stg.release-monitoring.org"
    when: env == "staging"

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

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

  - role: openshift/secret-file
    app: the-new-hotness
    secret_name: the-new-hotness-fedora-messaging-cert
    key: fedora-messaging-the-new-hotness.crt
    privatefile: "rabbitmq/{{env}}/pki/issued/the-new-hotness{{env_suffix}}.crt"

  - role: openshift/object
    app: the-new-hotness
    file: imagestream.yml
    objectname: imagestream.yml

  - role: openshift/object
    app: the-new-hotness
    file: service.yml
    objectname: service.yml

  - role: openshift/object
    app: the-new-hotness
    template: buildconfig.yml
    objectname: buildconfig.yml

  - role: openshift/object
    app: the-new-hotness
    template: configmap.yml
    objectname: configmap.yml

  - role: openshift/start-build
    app: the-new-hotness
    buildname: the-new-hotness-build
    objectname: the-new-hotness-build

  - role: openshift/object
    app: the-new-hotness
    template: deploymentconfig.yml
    objectname: deploymentconfig.yml

  - role: openshift/rollout
    app: the-new-hotness
    dcname: the-new-hotness
