---
# No easy way to know OS type without python or without ansible facts.
# Run below raw commands and one would succeed with apt/yum on debian/centos
- name: Install python
  raw:
    test -e /usr/bin/python || (apt-get -y update && apt-get install -y python-minimal)
  become: yes
  ignore_errors: yes

- name: Install python
  raw:
    test -e /usr/bin/python || (yum -y update && yum install -y python)
  become: yes
  ignore_errors: yes

# network-integration test are ran with gather_facts: no
# We need to explicitly call setup so ansible_distribution is set

- name: Gather facts
  setup:
  become: yes

- name: Install openvswitch-switch package if we are on Ubuntu
  apt:
    name: openvswitch-switch
    state: present
    update_cache: yes
  become: yes
  when: ansible_distribution == 'Ubuntu'

- name: Install openvswitch package if we are on Fedora
  yum:
    name: openvswitch
    state: installed
    update_cache: yes
  become: yes
  when: ansible_distribution == 'Fedora'
