# SPDX-License-Identifier: BSD-3-Clause
# This file was generated by ensure_provider_tests.py
---
# set network provider and gather facts
- hosts: all
  name: Run playbook 'playbooks/tests_provider.yml' with nm as provider
  tasks:
    - include_tasks: tasks/el_repo_setup.yml
    - name: Set network provider to 'nm'
      set_fact:
        network_provider: nm
      tags:
        - always

    - block:
        - name: Install NetworkManager
          package:
            name: NetworkManager
            state: present
        - name: Get NetworkManager version
          command: rpm -q --qf "%{version}" NetworkManager
          register: NetworkManager_version
          when: true
      when:
        - ansible_distribution_major_version != '6'
      tags:
        - always


# The test requires or should run with NetworkManager, therefore it cannot run
# on RHEL/CentOS 6
# NetworKmanager 1.20.0 added support for forgetting profiles
- import_playbook: playbooks/tests_provider.yml
  when:
    - ansible_distribution_major_version != '6'

    - NetworkManager_version.stdout is version('1.20.0', '>=')
    - ansible_distribution != 'RedHat' or ansible_distribution_major_version | int < 9
