mirror of
https://github.com/linux-system-roles/network.git
synced 2026-01-23 10:25:28 +00:00
The old ansible-community ansible-lint is deprecated. There is a new ansible-lint github action. The new ansible-lint has several checks related to ansible-test and the ignore files. Many of our ignore settings are not allowed any more and are required to be fixed or addressed in the Ansible preferred way. The python imports have to be wrapped in a try/except ImportError, and where possible, an error must be returned from the module explaining what was not able to be imported. The module documentation must comply with the Ansible standards. One aspect of this is the `version_added` must be a valid ansible-core version in X.Y.Z format. Note that this version isn't really used anywhere, so it doesn't matter for users of the role, it is purely an `ansible-test` and import gating issue. The result of this is that the .sanity files can be reduced to the bare minimum which will greatly reduce the maintenance burden of those files, make it easier to support newer versions of Ansible, and make it easier to import the system roles collection into Galaxy and Automation Hub. The latest Ansible repo gating tests run ansible-lint against the collection format instead of against individual roles. We have to convert the role to collection format before running ansible-test. Role developers can run this locally using `tox -e collection,ansible-lint-collection` See https://github.com/linux-system-roles/tox-lsr/pull/125 Add `---` doc start to .markdownlint.yaml The file `examples/down_profile+delete_interface.yml` was not used and was causing ansible-lint errors. ansible-lint enforces the order of keywords in plays - `name`, then `hosts`, then `vars`, then `tasks`. Signed-off-by: Rich Megginson <rmeggins@redhat.com>
94 lines
3.4 KiB
YAML
94 lines
3.4 KiB
YAML
# SPDX-License-Identifier: BSD-3-Clause
|
|
# This file was generated by ensure_provider_tests.py
|
|
---
|
|
- name: Test change indication on repeat run
|
|
hosts: all
|
|
vars:
|
|
interface: testnic1
|
|
type: veth
|
|
tasks:
|
|
- name: Determine if system is ostree and set flag
|
|
when: not __network_is_ostree is defined
|
|
block:
|
|
- name: Check if system is ostree
|
|
stat:
|
|
path: /run/ostree-booted
|
|
register: __ostree_booted_stat
|
|
|
|
- name: Set flag to indicate system is ostree
|
|
set_fact:
|
|
__network_is_ostree: "{{ __ostree_booted_stat.stat.exists }}"
|
|
- name: Include the task 'manage_test_interface.yml'
|
|
include_tasks: tasks/manage_test_interface.yml
|
|
vars:
|
|
state: present
|
|
- name: Include the task 'assert_device_present.yml'
|
|
include_tasks: tasks/assert_device_present.yml
|
|
- name: Test change indication on repeat run
|
|
block:
|
|
- name: Configure the static IPv4 address for ethernet device
|
|
vars:
|
|
network_connections:
|
|
- name: "{{ interface }}"
|
|
state: up
|
|
type: ethernet
|
|
ip:
|
|
address:
|
|
- 192.0.2.2/24
|
|
block:
|
|
- name: Include the network role
|
|
include_role:
|
|
name: linux-system-roles.network
|
|
register: __network_connections_result
|
|
- name: Assert change:true
|
|
assert:
|
|
that: __network_connections_result is changed
|
|
- name: Include the network role
|
|
include_role:
|
|
name: linux-system-roles.network
|
|
register: __network_connections_result
|
|
- name: Assert change:false
|
|
assert:
|
|
that: not __network_connections_result is changed
|
|
- name: Configure the ethernet device without enabling the IPv4 and IPv6
|
|
vars:
|
|
network_connections:
|
|
- name: "{{ interface }}"
|
|
state: up
|
|
type: ethernet
|
|
ip:
|
|
dhcp4: "no"
|
|
auto6: "no"
|
|
block:
|
|
- name: Include the network role
|
|
include_role:
|
|
name: linux-system-roles.network
|
|
register: __network_connections_result
|
|
- name: Assert change:true
|
|
assert:
|
|
that: __network_connections_result is changed
|
|
- name: Include the network role
|
|
include_role:
|
|
name: linux-system-roles.network
|
|
register: __network_connections_result
|
|
- name: Assert change:false
|
|
assert:
|
|
that: not __network_connections_result is changed
|
|
always:
|
|
- name: Clean up the test device and the connection profile
|
|
tags:
|
|
- "tests::cleanup"
|
|
block:
|
|
- name: Include the network role
|
|
include_role:
|
|
name: linux-system-roles.network
|
|
vars:
|
|
network_connections:
|
|
- name: "{{ interface }}"
|
|
persistent_state: absent
|
|
state: down
|
|
ignore_errors: true # noqa ignore-errors
|
|
- name: Include the task 'manage_test_interface.yml'
|
|
include_tasks: tasks/manage_test_interface.yml
|
|
vars:
|
|
state: absent
|