---
- name: make the app be real
  hosts: os_control[0]:os_control_stg[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: openshift/project
    app: compose-tracker
    description: Opens issues for failed Composes against https://pagure.io/releng/failed-composes/
    appowners:
    - dustymabe
    - mizdebsk
    - humaton
    tags:
    - appowner

  - role: openshift/object
    app: compose-tracker
    template: secret.yml
    objectname: secret.yml

  - role: openshift/object
    app: compose-tracker
    template: imagestream.yml
    objectname: imagestream.yml

  - role: openshift/object
    app: compose-tracker
    template: buildconfig.yml
    objectname: buildconfig.yml

  - role: openshift/start-build
    app: compose-tracker
    buildname: compose-tracker-build
    objectname: compose-tracker-build

  - role: openshift/object
    app: compose-tracker
    template: deploymentconfig.yml
    objectname: deploymentconfig.yml

  - role: openshift/rollout
    app: compose-tracker
    dcname: compose-tracker

  ###############################################
  # actions to delete the project from OpenShift
  ###############################################
  # to run: sudo rbac-playbook -l os_control_stg[0] -t delete openshift-apps/compose-tracker.yml
  - role: openshift/object-delete
    app: compose-tracker
    objecttype: project
    objectname: compose-tracker
    tags: [never, delete]
