mirror of
https://github.com/linux-system-roles/network.git
synced 2026-07-23 02:47:37 +00:00
The wireless test setup/cleanup had a lot of duplicated code scattered among a few task files. This unifies the setup and cleanup code and gets rid of redundant files. This also enables all of the wireless tests on CentOS 7 and later, and RHEL 8 and later. Signed-off-by: Rich Megginson <rmeggins@redhat.com>
86 lines
3.1 KiB
YAML
86 lines
3.1 KiB
YAML
# SPDX-License-Identifier: BSD-3-Clause
|
|
---
|
|
- name: Play for testing wireless connection
|
|
hosts: all
|
|
vars:
|
|
interface: wlan0
|
|
tasks:
|
|
- name: "INIT: wireless tests"
|
|
debug:
|
|
msg: "##################################################"
|
|
- name: Include the task 'setup_mock_wifi.yml'
|
|
include_tasks: tasks/setup_mock_wifi.yml
|
|
- name: Test wireless connection with WPA-PSK
|
|
block:
|
|
- name: "TEST: wireless connection with WPA-PSK"
|
|
debug:
|
|
msg: "##################################################"
|
|
- name: Import network role
|
|
include_tasks: tasks/run_role_with_clear_facts.yml
|
|
vars:
|
|
network_allow_restart: true
|
|
network_connections:
|
|
- name: "{{ interface }}"
|
|
state: up
|
|
type: wireless
|
|
ip:
|
|
address:
|
|
- 203.0.113.2/24
|
|
dhcp4: "no"
|
|
auto6: "no"
|
|
wireless:
|
|
ssid: "mock_wifi"
|
|
key_mgmt: "wpa-psk"
|
|
password: "p@55w0rD"
|
|
- name: Import network role
|
|
include_tasks: tasks/run_role_with_clear_facts.yml
|
|
vars:
|
|
network_connections:
|
|
- name: "{{ interface }}"
|
|
persistent_state: absent
|
|
state: down
|
|
- name: "TEST: wireless connection with 802.1x TLS-EAP"
|
|
debug:
|
|
msg: "##################################################"
|
|
- name: Import network role
|
|
include_tasks: tasks/run_role_with_clear_facts.yml
|
|
vars:
|
|
network_allow_restart: true
|
|
network_connections:
|
|
- name: "{{ interface }}"
|
|
state: up
|
|
type: wireless
|
|
ip:
|
|
address:
|
|
- 203.0.113.2/24
|
|
dhcp4: "no"
|
|
auto6: "no"
|
|
wireless:
|
|
ssid: "mock_wifi"
|
|
key_mgmt: "wpa-eap"
|
|
ieee802_1x:
|
|
identity: myhost
|
|
eap: tls
|
|
private_key: /etc/pki/tls/client.key
|
|
private_key_password: test
|
|
private_key_password_flags:
|
|
- none
|
|
client_cert: /etc/pki/tls/client.pem
|
|
ca_cert: /etc/pki/tls/cacert.pem
|
|
always:
|
|
- name: Clean up the test device and the connection profile
|
|
tags:
|
|
- "tests::cleanup"
|
|
block:
|
|
- name: Import network role
|
|
include_tasks: tasks/run_role_with_clear_facts.yml
|
|
vars:
|
|
network_connections:
|
|
- name: "{{ interface }}"
|
|
persistent_state: absent
|
|
state: down
|
|
__sr_failed_when: false
|
|
- name: Include the task 'cleanup_mock_wifi.yml'
|
|
include_tasks: tasks/cleanup_mock_wifi.yml
|
|
- name: Verify network state restored to default
|
|
include_tasks: tasks/check_network_dns.yml
|