138 lines
4.7 KiB
YAML
138 lines
4.7 KiB
YAML
# SPDX-License-Identifier: BSD-3-Clause
|
|
---
|
|
- hosts: all
|
|
vars:
|
|
interface: statebr
|
|
profile: "{{ interface }}"
|
|
lsr_fail_debug:
|
|
- __network_connections_result
|
|
tasks:
|
|
- debug:
|
|
msg: "this is: playbooks/tests_states.yml"
|
|
tags:
|
|
- always
|
|
|
|
|
|
- block:
|
|
- include_tasks: tasks/run_test.yml
|
|
vars:
|
|
lsr_description: I can create a profile
|
|
lsr_setup:
|
|
- tasks/delete_interface.yml
|
|
- tasks/assert_device_absent.yml
|
|
lsr_test:
|
|
- tasks/create_bridge_profile.yml
|
|
lsr_assert:
|
|
- tasks/assert_profile_present.yml
|
|
lsr_assert_when:
|
|
# Device should be present because of autoconnect: true by
|
|
# default for NM (this might be considered a bug)
|
|
- what: tasks/assert_device_present.yml
|
|
when: "{{ network_provider == 'nm' }}"
|
|
lsr_cleanup:
|
|
- tasks/cleanup_profile+device.yml
|
|
tags:
|
|
- tests::states:create
|
|
|
|
- block:
|
|
- include_tasks: tasks/run_test.yml
|
|
vars:
|
|
lsr_description: I can create a profile without autoconnect
|
|
lsr_setup:
|
|
- tasks/delete_interface.yml
|
|
- tasks/assert_device_absent.yml
|
|
lsr_test:
|
|
- tasks/create_bridge_profile_no_autoconnect.yml
|
|
lsr_assert:
|
|
# Device should be absent because of autoconnect: false
|
|
- tasks/assert_device_absent.yml
|
|
- tasks/assert_profile_present.yml
|
|
lsr_cleanup:
|
|
- tasks/cleanup_profile+device.yml
|
|
tags:
|
|
- tests::states:create_without_autoconnect
|
|
|
|
- block:
|
|
- include_tasks: tasks/run_test.yml
|
|
vars:
|
|
lsr_description: I can activate an existing profile
|
|
lsr_setup:
|
|
- tasks/create_bridge_profile.yml
|
|
lsr_test:
|
|
- tasks/activate_profile.yml
|
|
lsr_assert:
|
|
- tasks/assert_device_present.yml
|
|
- tasks/assert_profile_present.yml
|
|
lsr_cleanup:
|
|
- tasks/cleanup_profile+device.yml
|
|
tags:
|
|
- tests::states:activate
|
|
|
|
- block:
|
|
- include_tasks: tasks/run_test.yml
|
|
vars:
|
|
lsr_description: I can remove an existing profile without taking it
|
|
down
|
|
lsr_setup:
|
|
- tasks/create_bridge_profile.yml
|
|
- tasks/activate_profile.yml
|
|
lsr_test:
|
|
- tasks/remove_profile.yml
|
|
lsr_assert:
|
|
- tasks/assert_device_present.yml
|
|
- tasks/assert_profile_absent.yml
|
|
lsr_cleanup:
|
|
- tasks/cleanup_profile+device.yml
|
|
tags:
|
|
- tests::states:remove_up
|
|
|
|
- block:
|
|
- include_tasks: tasks/run_test.yml
|
|
vars:
|
|
lsr_description: I can take a profile down that is absent
|
|
lsr_setup:
|
|
- tasks/create_bridge_profile.yml
|
|
- tasks/activate_profile.yml
|
|
- tasks/remove_profile.yml
|
|
lsr_test:
|
|
- tasks/remove+down_profile.yml
|
|
lsr_assert:
|
|
- tasks/assert_profile_absent.yml
|
|
lsr_assert_when:
|
|
- what: tasks/assert_device_absent.yml
|
|
when: "{{ network_provider == 'nm' }}"
|
|
lsr_cleanup:
|
|
- tasks/cleanup_profile+device.yml
|
|
tags:
|
|
- tests::states:remove_down
|
|
|
|
- block:
|
|
- include_tasks: tasks/run_test.yml
|
|
vars:
|
|
lsr_description: I will not get an error when I try to
|
|
remove an absent profile
|
|
lsr_setup:
|
|
- tasks/create_bridge_profile.yml
|
|
- tasks/activate_profile.yml
|
|
- tasks/remove+down_profile.yml
|
|
lsr_test:
|
|
- tasks/remove+down_profile.yml
|
|
lsr_assert:
|
|
- tasks/assert_profile_absent.yml
|
|
# FIXME: This needs to be included before lsr_assert_when but
|
|
# after the role ran to ensure that NetworkManager is actually
|
|
# installed but it is not an assert.
|
|
- tasks/get_NetworkManager_NVR.yml
|
|
lsr_assert_when:
|
|
- what: tasks/assert_device_absent.yml
|
|
# NetworkManager 1.18.4 from CentOS does not seem to remove the
|
|
# virtual interface in this case but it seems to work with
|
|
# 1:NetworkManager-1.27.0-26129.d0a2eb8f05.el7
|
|
when: "{{ network_provider == 'nm' and
|
|
NetworkManager_NVR != 'NetworkManager-1.18.4-3.el7'
|
|
}}"
|
|
lsr_cleanup:
|
|
- tasks/cleanup_profile+device.yml
|
|
tags:
|
|
- tests::states:remove_down_twice
|