---
- name: make the app be real
  hosts: os_control:os_control_stg
  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

  ############################################
  # actions to create the project in OpenShift
  ############################################
  # to run: sudo rbac-playbook -l os_control_stg openshift-apps/fedora-ostree-pruner.yml
  roles:
  - role: openshift/project
    app: fedora-ostree-pruner
    description: Prunes OSTree repositories based on policy
    appowners:
    - dustymabe
    - jlebon
    - kevin

  - role: openshift/object
    app: fedora-ostree-pruner
    template: imagestream.yml
    objectname: imagestream.yml

  - role: openshift/object
    app: fedora-ostree-pruner
    template: buildconfig.yml
    objectname: buildconfig.yml

  - role: openshift/object
    app: fedora-ostree-pruner
    template: deploymentconfig.yml
    objectname: deploymentconfig.yml

  - role: openshift/object
    app: fedora-ostree-pruner
    template: pvc.yml
    objectname: pvc.yml

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