# This playbook can be used to update running Koschei instance to
# latest upstream version without causing user-visible outage, as long
# as updated version has identical database schema.

- name: Perform Koschei rolling update
  hosts: os_control[0]:os_control_stg[0]
  user: root
  vars_files:
   - /srv/web/infra/ansible/vars/global.yml
   - /srv/private/ansible/vars.yml
   - /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml
   - /srv/web/infra/ansible/roles/openshift-apps/koschei/vars/main.yml
   - /srv/web/infra/ansible/roles/openshift-apps/koschei/vars/{{ env }}.yml
  handlers:
  - import_tasks: "{{ handlers_path }}/restart_services.yml"

  # Simply import latest upstream Koschei image from Quay.io, which
  # should automatically trigger new OpenShift deployments as needed.
  tasks:
  - name: Import upstream image into OpenShift
    include_role: name=openshift/import-image
    vars:
      imagestreamname: koschei
