- name: make the app be real
  hosts: os-masters-stg[0]:os-masters[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: websites
    description: Fedora websites
    appowners:
    - codeblock
    - ryanlerch

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

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

  - role: openshift/start-build
    app: websites
    buildname: websites-build
    objectname: websites-build

  - role: openshift/object
    app: websites
    file: service.yml
    objectname: service.yml

  - role: openshift/route
    app: websites
    routename: websites
    host: "stg.getfedora.org"
    serviceport: 8080-tcp
    servicename: websites
    when: env == "staging"

  - role: openshift/route
    app: websites
    routename: websites
    host: "getfedora.org"
    serviceport: 8080-tcp
    servicename: websites
    when: env == "production"

  - role: openshift/object
    app: websites
    file: deploymentconfig.yml
    objectname: deploymentconfig.yml

  - role: openshift/rollout
    app: websites
    dcname: websites
