---
- set_fact:
    l_service_name: "cri-o"
  when: openshift_use_crio | bool

- set_fact:
    l_service_name: "{{ openshift_docker_service_name }}"
  when: not openshift_use_crio | bool

- name: Pre-pull OpenVSwitch system container image
  command: >
    atomic pull --storage=ostree {{ 'docker:' if system_images_registry == 'docker' else system_images_registry + '/' }}{{ osn_ovs_image }}:{{ openshift_image_tag }}
  register: pull_result
  changed_when: "'Pulling layer' in pull_result.stdout"

- name: Install or Update OpenVSwitch system container
  oc_atomic_container:
    name: openvswitch
    image: "{{ 'docker:' if system_images_registry == 'docker' else system_images_registry + '/' }}{{ osn_ovs_image }}:{{ openshift_image_tag }}"
    state: latest
    values:
      - "DOCKER_SERVICE={{ l_service_name }}"
