- name: make the app be real
  hosts: os-masters-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: accountsystem
    description: CAIAPI and Noggin
    appowners:
    - puiterwijk
  - role: openshift/imagestream
    app: accountsystem
    imagename: caiapi
  - role: openshift/imagestream
    app: accountsystem
    imagename: noggin
  - role: openshift/object
    app: accountsystem
    objectname: buildconfig_caiapi.yml
    template: buildconfig_caiapi.yml
  - role: openshift/start-build
    app: accountsystem
    buildname: caiapi-build
  - role: openshift/object
    app: accountsystem
    template: configmap_caiapi.yml
    objectname: configmap_caiapi.yml
  - role: openshift/secret-file
    app: accountsystem
    key: oidc
    secret_name: oidc
    privatefile: "caiapi/{{env}}/oidc.json"
  - role: openshift/object
    app: accountsystem
    file: service_caiapi.yml
    objectname: service_caiapi.yml
  - role: openshift/route
    app: accountsystem
    routename: caiapi
    host: "caiapi{{ env_suffix }}.fedoraproject.org"
    servicename: caiapi
    serviceport: 8080
  - role: openshift/object
    app: accountsystem
    file: deploymentconfig_caiapi.yml
    objectname: deploymentconfig_caiapi.yml
  - role: openshift/rollout
    app: accountsystem
    dcname: caiapi
