-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Module/NM: Try to reapply connections
- Loading branch information
Showing
4 changed files
with
123 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
--- | ||
- hosts: all | ||
vars: | ||
interface: rpltstbr | ||
profile: "{{ interface }}" | ||
network_provider: nm | ||
pre_tasks: | ||
- debug: | ||
msg: Inside states tests | ||
- include_tasks: tasks/show-interfaces.yml | ||
- include_tasks: tasks/assert-device_absent.yml | ||
roles: | ||
- linux-system-roles.network | ||
tasks: | ||
- block: | ||
# create test profile | ||
- include_role: | ||
name: linux-system-roles.network | ||
vars: | ||
network_connections: | ||
- name: "{{ interface }}" | ||
state: up | ||
type: bridge | ||
ip: | ||
dhcp4: false | ||
auto6: false | ||
- include_tasks: tasks/assert-device_present.yml | ||
- include_tasks: tasks/assert-profile_present.yml | ||
# Use internal module to get output | ||
- network_connections: | ||
provider: nm | ||
connections: | ||
- name: "{{ interface }}" | ||
state: up | ||
type: bridge | ||
ip: | ||
address: | ||
- 192.0.2.72/31 | ||
dhcp4: false | ||
auto6: false | ||
ignore_errors: true | ||
register: test_module_run | ||
- debug: | ||
var: test_module_run | ||
- name: Assert that reapply is found in log output | ||
assert: | ||
fail_msg: Reapply not found in log output | ||
that: "{{ 'connection reapplied' in test_module_run.warnings[2] }}" | ||
always: | ||
- block: | ||
# Use internal module directly for speedup | ||
- network_connections: | ||
provider: nm | ||
connections: | ||
- name: "{{ interface }}" | ||
persistent_state: absent | ||
state: down | ||
- command: ip link del "{{ interface }}" | ||
ignore_errors: true | ||
tags: | ||
- "tests::cleanup" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
# set network provider and gather facts | ||
- hosts: all | ||
tasks: | ||
- name: Set network provider to 'nm' | ||
set_fact: | ||
network_provider: nm | ||
|
||
# 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/CentOS 6 | ||
- import_playbook: playbooks/tests_reapply.yml | ||
when: | ||
- ansible_distribution_major_version != '6' |