- name: OpenScanHub
  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

  vars:
    - ocp4: true

  pre_tasks:
  - include_vars: dir=/srv/web/infra/ansible/vars/all/ ignore_files=README

  roles:
  - role: openshift/project
    app: openscanhub
    description: openscanhub
    appowners:
    - svashisht
    - kevin
    tags:
      - apply-appowners
    when: env == "production"
  - role: openshift/project
    app: openscanhub
    description: openscanhub
    appowners:
    - svashisht
    - kevin
    tags:
      - apply-appowners
    when: env == "staging"
  - role: openshift/object
    app: openscanhub
    template: pvc-var-lib-osh.yml
    objectname: pvc-var-lib-osh.yml
  - role: openshift/keytab
    app: openscanhub
    key: service.keytab
    secret_name: openscanhub-keytab
    service: HTTP
    # https://pagure.io/fedora-infra/ansible/pull-request/1669#comment-195794
    # We should get separate approval for "opencanhub.fedoraproject.org"
    # Fix below line if correct route is not generated.
    # https://pagure.io/fedora-infra/ansible/pull-request/1669#comment-195809
    host: "staging-openscanhub.apps.ocp.stg.fedoraproject.org"
    when: env == "staging"
