---
# set network provider and gather facts
- hosts: all
  tasks:
    - name: Set network provider to 'nm'
      set_fact:
        network_provider: nm
    - name: Install NetworkManager
      package:
        name: NetworkManager
        state: present
    - name: Get NetworkManager version
      command: rpm -q --qf "%{version}" NetworkManager
      args:
        warn: "no"
      when: true
      register: NetworkManager_version

# workaround for: https://github.com/ansible/ansible/issues/27973
# There is no way in Ansible to abort a playbook hosts with specific OS
# releases Therefore we include the playbook with the tests only if the hosts
# would support it.
# The test should run with NetworkManager, therefore it cannot run on RHEL 6 or CentOS 6.
- import_playbook: playbooks/tests_ethtool_features.yml
  when:
    - ansible_distribution_major_version != '6'
    # NetworkManager 1.20.0 introduced ethtool settings support
    - NetworkManager_version.stdout is version('1.20.0', '>=')
