- name: Make fedora-packages-static
  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: fedora-packages-static
    description: Fedora fedora-packages-static apps
    appowners:
    - mymindstorm
    - kevin

  - role: openshift/object
    app: fedora-packages-static
    file: imagestream.yml
    objectname: imagestream.yml

  - role: openshift/object
    app: fedora-packages-static
    template: buildconfig.yml
    objectname: buildconfig.yml

  - role: openshift/object
    app: fedora-packages-static
    template: storage.yml
    objectname: storage.yml

  - role: openshift/object
    app: fedora-packages-static
    template: configmap.yml
    objectname: configmap.yml

  - role: openshift/start-build
    app: fedora-packages-static
    buildname: fedora-packages-static-build
    objectname: fedora-packages-static-build

  - role: openshift/object
    app: fedora-packages-static
    file: service.yml
    objectname: service.yml

  - role: openshift/route
    app: fedora-packages-static
    routename: fedora-packages-static
    host: "packages{{ env_suffix }}.fedoraproject.org"
    serviceport: 8080-tcp
    servicename: fedora-packages-static

  - role: openshift/object
    app: fedora-packages-static
    template: deploymentconfig.yml
    objectname: deploymentconfig.yml

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

  # to run: sudo rbac-playbook -l staging -t deletesolr openshift-apps/fedora-packages-static.yml
  - role: openshift/object-delete
    app: solr
    objecttype: project
    objectname: solr
    tags: [ never, deletesolr ]
