Commit graph

256 commits

Author SHA1 Message Date
Wen Liang
cac2bbb43e fix: Remove MAC address matching from SysUtil.link_info_find()
The link_info_find() function previously allowed searching for links by
MAC address, but this introduced ambiguity and could cause false alarms
in certain cases (e.g. retrieving the link info by MAC might return the
link info that only matches the current MAC instead of the permanent
MAC). To ensure reliable behavior, this function should accept and match
the link info only by interface name.

To address the issues, the following changes were made:
- Removed MAC address matching logic to eliminate ambiguity.
- Simplified the function to only check ifname, making it more
  predictable.
- Updated all callers to adapt to this change, ensuring correctness.
- When a profile is tied to an interface via mac only, the validation of
  the existence of interface will now be delegated to NetworkManager
instead.

Resolves: https://issues.redhat.com/browse/RHEL-84197

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2025-03-31 22:21:18 -04:00
Rich Megginson
e5aca936e5 test: do not need to install from epel or pip
The tests should not install anything from outside of the distribution
unless absolutely necessary, like the copr repos.

All of the EPEL dependencies have been removed or replaced
with coprs.

We do not need to install pytest from pip since it is available
as `pytest-3` from `python3-pytest`.

We do not need `git` or `rsync` in the tests.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2025-03-17 12:02:42 -06:00
Sergei Petrosian
62d3bdc110 ci: Check spelling with codespell
* You can ignore words inline by adding a comment like `# codespell:ignore word`.
* You can ignore words by adding them to the `.codespell_ignores` file.
* You can ignore files and directories by adding them with `skip = ` to the `.codespellrc` file.

Signed-off-by: Sergei Petrosian <spetrosi@redhat.com>
2025-02-14 11:06:01 +00:00
Rich Megginson
e890ab5813 refactor: fix python black formatting
Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2025-01-31 08:02:52 -07:00
Wen Liang
d92baacf1f feat: Support wait_ip property
Add support for the `wait_ip` property, the system will consider
connection activated only when specific IP stack is configured.
This enables flexibility in scenarios such as
IPv6-only networks, where the overall network configuration can still
succeed when IPv4 configuration fails but IPv6 completes successfully.

The `wait_ip` can be configured with the following possible values:
  * "any": System will consider interface activated when any IP stack is
           configured.
  * "ipv4": System will wait IPv4 been configured.
  * "ipv6": System will wait IPv6 been configured.
  * "ipv4+ipv6": System will wait both IPv4 and IPv6 been configured.

Resolves: https://issues.redhat.com/browse/RHEL-63026

Signed-off-by: Wen Liang <wenliang@redhat.com>
2024-10-29 09:43:38 -04:00
Rich Megginson
38a61f76e9 refactor: Use vars/RedHat_N.yml symlink for CentOS, Rocky, Alma wherever possible
We have a lot of requests to support Rocky and Alma in various system roles. The
first part of adding support is adding `vars/` files for these platforms. In
almost every case, for a given major version N, the vars file RedHat_N.yml can
be used for CentOS, Rocky, and Alma.  Rather than making a copy of the
RedHat_N.yml file, just use a symlink to reduce size and maintenance burden, and
standardize this across all system roles for consistency.

NOTE: There is no Alma or Rocky version 7 or less.

NOTE: OracleLinux is not a strict clone, so we are not going to do this for
OracleLinux at this time.  Support for OracleLinux will need to be done in
separate PRs. For more information, see
https://github.com/linux-system-roles/cockpit/issues/130

**Question**: Why not just use `ansible_facts["os_family"] == "RedHat"`?

**Answer**:  This is what Ansible uses as the RedHat os_family:
1e6ffc1d02/lib/ansible/module_utils/facts/system/distribution.py (L511)
There are a lot of distributions in there. I know that Fedora is not a clone of
RHEL, but it is very closely related. Most of the others are not clones, and it
would generally not work to replace ansible_distribution in ['CentOS', 'Fedora',
'RedHat'] with ansible_facts['os_family'] == 'RedHat' (but it would probably
work in specific cases with specific distributions).  For example, OracleLinux
is in there, and we know that doesn't generally work.  The only ones we can be
pretty sure about are `RedHat`, `CentOS`, `Fedora`, `AlmaLinux`, and `Rocky`.

**Question**: Does my role really need this because it should already work on
RHEL clones?

**Answer**: Maybe not - but:

* it doesn't hurt anything
* it's there if we need it in the future
* the role will be inconsistent with the other system roles if we don't have this

**Question**: Why do I need the `tests/vars/rh_distros_vars.yml` file?  Doesn't
the test load the vars from the role?

**Answer**: No, the test does not load the vars from the role until the role is
included, and many tests use version and distribution before including the role.

**Question**: Do we need to change the code now to use the new variables?

**Answer**: No, not now, in subsequent PRs, hopefully by Alma and Rocky users.

Note that there may be more work to be done to the role to fully support Rocky
and Alma.  Many roles have conditionals like this:

```yaml
some_var: "{{ 'some value' if ansible_distribution in ['CentOS', 'RedHat'] else 'other value' }}"
another_var: "{{ 'some value' if ansible_distribution in ['CentOS', 'Fedora', 'RedHat'] else 'other value' }}"

...

- name: Do something
  when: ansible_distribution in ['CentOS', 'RedHat']
  ...
- name: Do something else
  when: ansible_distribution in ['CentOS', 'Fedora', 'RedHat']
  ...
```

Adding Rocky and AlmaLinux to these conditionals will have to be done
separately. In order to simplify the task, some new variables are being
introduced:

```yaml
__$rolename_rh_distros:
  - AlmaLinux
  - CentOS
  - RedHat
  - Rocky

__$rolename_rh_distros_fedora: "{{ __$rolename_rh_distros + ['Fedora'] }}"

__$rolename_is_rh_distro: "{{ ansible_distribution in __$rolename_rh_distros }}"
__$rolename_is_rh_distro_fedora: "{{ ansible_distribution in __$rolename_rh_distros_fedora }}"
```

Then the conditionals can be rewritten as:

```yaml
some_var: "{{ 'some value' if __$rolename_is_rh_distro else 'other value' }}"
another_var: "{{ 'some value' if __$rolename_is_rh_distro_fedora else 'other value' }}"

...

- name: Do something
  when: __$rolename_is_rh_distro | bool
  ...
- name: Do something else
  when: __$rolename_is_rh_distro_fedora | bool
  ...
```

For tests - tests that use such conditionals will need to use `vars_files` or
`include_vars` to load the variables that are defined in
`tests/vars/rh_distros_vars.yml`:

```yaml
vars_files:
  - vars/rh_distros_vars.yml
```

We don't currently have CI testing for Rocky or Alma, so someone wanting to run
tests on those platforms would need to change the test code to use these.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2024-10-25 12:06:55 -06:00
Wen Liang
5d73511d64 feat: Support autoconnect_retries
There is no fine-grained control over the number of retries for
automatically reconnecting a network connection in the role. This
limitation can be problematic for certain use cases where extending the
retry process is critical, particularly in environments with unstable
networks. Introduce support for the `autoconnect_retries` property in nm
provider of `network_connections` variable. This feature allows users to
configure how many times NetworkManager will attempt to reconnect a
connection after a autoconnect failure, providing more control over
network stability and performance.

Resolves: https://issues.redhat.com/browse/RHEL-61599

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2024-10-08 10:25:58 -04:00
Rich Megginson
fe439dbe4d test: use is-active instead of is-enabled to check for firewalld
Need to test if firewalld is running - the is-active test is
for that, not is-enabled

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2024-08-20 11:16:28 -06:00
Rich Megginson
e55e2a77ab test: allow dhcp service if firewall is active
If firewall is active, the dhcp services do not work.  Change the test
to add and remove the dhcp services if firewall is active.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2024-08-17 17:30:00 -06:00
Jakub Haruda
3841192f9f Tests: Use EPEL-7 from archive
Signed-off-by: Jakub Haruda <64086699+jharuda@users.noreply.github.com>
2024-08-16 07:52:44 -06:00
Rich Megginson
931cdb335d test: skip integration pytest on fedora 39 and later
Something has changed in python, similar to the change between
el8 and el9, that causes the test to fail on f39 and later, so
skip it.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2024-08-15 09:26:54 -06:00
Wen Liang
8195188d29 feat: Add the support for the optional route source parameter in nm provider
Enhancement: Add the optional route source parameter for the nm provider

Reason: In a scenario where you have a machine with multiple public IP
addresses, typically due to a multi-WAN setup, the src parameter in the
context of routes allows you to specify which source IP address should
be used when sending packets via a specific route.  This is crucial when
you want to ensure that outbound traffic uses a specific IP address tied
to a particular network interface, especially when dealing with multiple
WAN connections.

Result: Adding support for the src parameter in routes results in a
more powerful and flexible network configuration capability, especially
important in environments with multiple network interfaces or multiple
IP addresses, it provides better control over traffic routing.

Resolves: https://issues.redhat.com/browse/RHEL-3252

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2024-08-05 11:58:23 -04:00
Rich Megginson
b7c6a253ab test: fix some Ansible warnings not caught by lint
Do not use templating in `when:`, `that:`, `until:`.  These
are evaluated as Jinja statements.  In cases where the string
used is long or awkward to generate in-line, use an
intermediate var for the value.

Use a unique loop var instead of `item` in cases where a loop
may be called in a nested context.

Fix some formatting.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2024-07-25 08:35:17 -06:00
Rich Megginson
a2dd3ce11a test: team plugin test does not clean up properly
The team plugin test does not clean up properly causing the following team
test to fail.  The fix is to use the network standard run_test.yml interface
to ensure proper preconditions and cleanup for the team plugin test.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2024-07-24 15:49:08 -06:00
Rich Megginson
9e6e150a6e fix: add support for EL10
According to the Ansible team, support for listing platforms in
role `meta/main.yml` files is being removed.
Instead, they recommend using `galaxy_tags`

https://github.com/ansible/ansible/blob/stable-2.17/changelogs/CHANGELOG-v2.17.rst
"Remove the galaxy_info field platforms from the role templates"
https://github.com/ansible/ansible/issues/82453

Many roles already have tags such as "rhel", "redhat", "centos", and "fedora".
I propose that we ensure all of the system roles have these tags.
Some of our roles support Suse, Debian, Ubuntu, and others.
We should add tags for those e.g. the ssh role already has tags for "debian" and "ubuntu".

In addition - for each version listed under `platforms.EL` - add a tag like `elN`.

Q: Why not use a delimiter between the platform and the version e.g. `el-10`?

This is not allowed by ansible-lint:

```
meta-no-tags: Tags must contain lowercase letters and digits only., invalid: 'el-10'
meta/main.yml:1
```

So we cannot use uppercase letters either.

Q: Why not use our own meta/main.yml field?

No other fields are allowed by ansible-lint:

```
syntax-check[specific]: 'myfield' is not a valid attribute for a RoleMetadata
```

Q: Why not use some other field?

There are no other applicable or suitable fields.

Q: What happens when we want to support versions like `N.M`?

Use the word "dot" instead of "." e.g. `el10dot3`.
Similarly - use "dash" instead of "-".

We do not need tags such as `fedoraall`.
The `fedora` tag implies that the role works on all supported versions of fedora.
Otherwise, use tags such as `fedora40` if the role only supports specific versions.

Teaming support is dropped in EL10.  Provide an error to users who attempt
to use teaming and suggest that they use bonding instead.  Skip teaming
tests on EL10.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2024-07-02 09:09:05 -06:00
Rich Megginson
5e384bbe8d test: debug deprecated bond test failures
When the test fails, gather additional information to help
diagnose the failure.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2024-07-02 09:02:23 -06:00
Rich Megginson
b2fdc87366 fix python black formatting
Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2024-06-04 18:09:20 -06:00
Rich Megginson
ab77dd159e test: improve name text for skipped ostree tests
Improve the name text for skipped ostree tests to explain
why the test is skipped.
Add tests/tasks/ostree_systems_check.yml for use by test
playbooks that may be skipped on ostree systems.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2024-03-25 17:30:00 -06:00
Wen Liang
44f937d82b tests: Consent to restart network when specifying wireless or team connections
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2024-03-15 17:33:36 -04:00
Wen Liang
66c3eef7e3 fix: Ask user's consent to restart NM due to wireless or team interfaces
If updates for network packages are available and wireless or team
connections are specified, NetworkManager must be restarted, the role
requires user's consent to restart NetworkManager. Otherwise, there
might be property conflicts between NetworkManager daemon and plugin, or
NetworkManager plugin is not taking effect.

`update_cache` is enabled in the module tasks to check if updates for
network packages are available due to wireless or team interfaces, in
that case, NetworkManager needs user's explicit consent to be restarted
after the network package updates. And using `state: latest` for
checking the network package updates because we have to guarantee that
NetworkManager and its plugin have the same and most recent version for
configuring the network connections settings in the backend. It is
worthwhile to mention that we have both tasks using dnf and yum module
for checking available updates for network packages. Because checking
package cache update is not supported in Ansible package module, Fedora
and RHEL8+ use DNF package manager by default, RHEL7 uses yum package
manager by default.

This commit will address the situation that users forget to explicitly
specify `network_allow_restart: true` when specifying wireless or team
connections.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2024-03-15 17:33:36 -04:00
Wen Liang
b90e123708 tests: Team interface is indeed supported on Fedora
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2024-03-14 17:07:34 -04:00
Rich Megginson
e681c3fea5 test: improve bond test failure debugging
Improve bond test failure debugging
* put test setup into block/always so that cleanup happens for setup failures
* trace shell commands so that we can determine exactly which command failed
* add error reporting so that when certain commands fail, we can determine the error code

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2024-02-27 13:17:16 -05:00
Wen Liang
c6be8dfde5 test: Purge DNS config at the end of tests_network_state.yml
Without purging the DNS testing config at the end
`tests_network_state.yml`, the managed hosts can not properly resolve
certain hosts (e.g. mirrors.fedoraproject.org, mirrors.centos.org )
in the package installation task of other tests.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2024-02-14 20:20:49 -07:00
Wen Liang
b4f51e2691 test: Add DNS, routes and network connectivity checks during cleanup
In order to guarantee each test is cleaned up properly in the end, it
is important to add a post-test check to each test checking that:

- Routes and DNS are restored.
- Network connectivity to certain hosts are preserved.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2024-02-14 20:20:49 -07:00
Wen Liang
ae9f212086 test: Retry until success when installing package
Sometimes the rpm download returns a 403, which is likely caused by
too many parallel jobs attempt the download from the same controller in
too short a period of time, so the epel server throttles additional
downloads - use a retry here to mitigate.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2024-02-14 20:20:49 -07:00
Wen Liang
910ddd20a9 test: Rewrite tests_bond_options.yml in the new testing format
The new testing format is more concise and easier to debug when test
failure happens.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2024-02-14 20:20:49 -07:00
Wen Liang
9b76608757 test: Clean up mock wifi at the end of each wireless test
Baseos CI runs different wireless tests in a sequence, the mock wifi
needs to be cleaned up properly at the end of each wireless test,
otherwise, it will cause the failure during the setup of mock wifi
for the next wireless test.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2024-01-29 14:44:04 -07:00
Wen Liang
b7492a27ba feat: Support blackhole, prohibit and unreachable route types
It is useful and common practice to configure the routes with blackhole,
prohibit, and unreachable route types when users have BGP routing
setups.

Notice that this feature is only for nm provider using
`network_connections` variable. Configuring blackhole, prohibit, and
unreachable route types is also supported by using `network_state` since
nmstate version 2.2.20 (the setting name is `route-type`).

Resolves: https://issues.redhat.com/browse/RHEL-19579

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2024-01-12 14:14:50 -07:00
Rich Megginson
e4d499763c ci: Use supported ansible-lint action; run ansible-lint against the collection
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>
2024-01-05 17:36:07 -07:00
Wen Liang
bbdc7f77c4 test: Fix wifi test failures
CentOS Stream build process has been moved to
https://kojihub.stream.centos.org.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-12-23 13:51:06 -07:00
Wen Liang
55e953099a tests: Fix installing kernel module in Fedora
`uname -m` will show the machine hardware name.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-12-23 13:49:48 -07:00
Wen Liang
eab5cccfcc test: Skip running tests where initscripts is not supported
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-12-21 08:24:55 -07:00
Rich Megginson
428273cf2a refactor: get_ostree_data.sh use env shebang - remove from .sanity*
Use the `#!/usr/bin/env bash` shebang which is ansible-test friendly.
This means we can remove get_ostree_data.sh from the .sanity* files.
This also means we can remove the .sanity* files if we do not need
them otherwise.  Fix other shell scripts to use the friendly shebang
and remove from the .sanity* files.

Rename `pth` to `path` in honor of nscott

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-12-07 07:25:47 -07:00
Wen Liang
ed93bed847 refractor: Use meaningful variable
Some variables used in the module code are not meaningful at all, which
might be hard to read and understand. Therefore, replace them with
meaningful variables.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-12-01 13:39:57 -07:00
Wen Liang
7c4f11f1d9 tests: Fix tests_network_state_nm.yml CI failure
Since the merge of nmstate commit 'nm dns: Support appending static DNS
before dynamic DNS' (https://github.com/nmstate/nmstate/pull/2438),
nmstate treats interface with `auto-dns: true` as valid to store DNS
and tries to use NetworkManager global DNS as much as possible. However,
in NM, `dns=systemd-resolved` does not support global DNS configuration,
because systemd-resolved only supports per-interface DNS servers (via
the D-Bus API). Therefore, write and validate the DNS configuration in
/run/NetworkManager/no-stub-resolv.conf, which contains the original
DNS settings pushed to the DNS plugin.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-11-29 16:29:50 -07:00
Rich Megginson
0c590cdf5a refactor: improve support for ostree systems
The dependency on `ansible.utils.update_fact` is causing issue with
some users who now must install that collection in order to run
the role, even if they do not care about ostree.

The fix is to stop trying to set `ansible_facts.pkg_mgr`, and instead
force the use of the ostree package manager with the `package:` module
`use:` option.  The strategy is - on ostree systems, set the flag
`__$ROLENAME_is_ostree` if the system is an ostree system.  The flag
will either be undefined or `false` on non-ostree systems.
Then, change every invocation of the `package:` module like this:

```yaml
- name: Ensure required packages are present
  package:
    name: "{{ __$ROLENAME_packages }}"
    state: present
    use: "{{ (__$ROLENAME_is_ostree | d(false)) |
      ternary('ansible.posix.rhel_rpm_ostree', omit) }}"
```

This should ensure that the `use:` parameter is not used if the system
is non-ostree.  The goal is to make the ostree support as unobtrusive
as possible for non-ostree systems.
The user can also set `__$ROLENAME_is_ostree: true` in the inventory or play
if the user knows that ostree is being used and wants to skip the check.
Or, the user is concerned about the performance hit for ostree detection
on non-ostree systems, and sets `__$ROLENAME_is_ostree: false` to skip
the check.
The flag `__$ROLENAME_is_ostree` can also be used in the role or tests to
include or exclude tasks from being run on ostree systems.

This fix also improves error reporting in the `get_ostree_data.sh` script
when included roles cannot be found.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-11-29 07:05:00 -07:00
Wen Liang
c7a31e7079 fix: Allow address 0.0.0.0/0 or ::/0 for 'from'/'to' in routing rule validation
`from 0.0.0.0/0` means from all IPv4 addresses, `from ::/0` means from
all IPv6 addresses. In NM, if `from` property is not specified in a
routing rule, NM still appends `from 0.0.0.0/0` or `from ::/0` to the
rule. NM also allows to specify `to 0.0.0.0/0` or `to ::/0` in a
routing rule, but the connection profiles will only show the `from`
setting for the rule.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-11-13 14:06:53 -07:00
Rich Megginson
9a16583783 feat: support for ostree systems
Feature: Allow running and testing the role with ostree managed nodes.

Reason: We have users who want to use the role to manage ostree
systems.

Result: Users can use the role to manage ostree managed nodes.

NOTE: The .ostree/packages-*.txt are generated by running the
script https://github.com/linux-system-roles/auto-maintenance/blob/main/check-logs-for-packages.sh
which is used with an integration test CI run with the
https://github.com/linux-system-roles/auto-maintenance/blob/main/callback_plugins/dump_packages.py
plugin.  An example of such a CI run is
https://github.com/linux-system-roles/network/pull/647

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-10-30 12:02:20 -06:00
Wen Liang
ca2180e659 test: Remove bond tests tag expfail
Since the root cause of the bond tests failure is already found and
fixed (by the commit 'fix: Add dhcp client package dependency for
initscripts provider'). Therefore, remove the bond tests tag `expfail`
and enable the bond tests in the downstream testing.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-10-05 15:11:02 -06:00
Wen Liang
17922ca6f3 fix: Install yum-utils package
`yum-config-manager` is provided by the yum-utils package, thus, install
the package as the dependency before using `yum-config-manager`.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-10-05 15:11:02 -06:00
Wen Liang
94254894de test(infiniband): Negate the error message in assertion
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-09-25 14:40:16 -06:00
Wen Liang
b97c9bd01e test: Use variable to hold infiniband interface name
To avoid hard coded interface name used all over the place in
`tests_infiniband.yml`, specify a variable to hold the infiniband
interface name instead.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-09-25 14:40:16 -06:00
Wen Liang
835872e681 feat: Support "no-aaaa" DNS option
reason: The administrator wants to suppress the AAAA queries made by
the stub resolver, including AAAA lookups triggered by NSS-based
interfaces such as getaddrinfo. Only the DNS lookups are affected.

result: The administrator is able to suppress AAAA queries made by the
stub resolver.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-06-29 13:10:20 +02:00
Wen Liang
ffe01a5f8b feat: Support ipv4_ignore_auto_dns and ipv6_ignore_auto_dns settings
reason: The user wants to ignore automatically configured name servers and
search domains (e.g. dns record from DHCP), and only use the name
servers and search domains specified in the `dns` and `dns_search`
properties.

result: The user is able to ignore automatically configured name servers
and search domains.

Notice that there are two settings here distinguished by the address
families, which aims to be compatible with NetworkManager
(`ipv4.ignore-auto-dns` and `ipv6.ignore-auto-dns`)and Nmstate (setting
`auto-dns` on `ipv4` or `ipv6` section). Also, the users can get auto
DNS from DHCPv4, DHCPv6, modem etc, and they may want to ignore auto
DNS on Ipv4 but not on IPv6, in this case, it is better to have two
settings distinguished by the address families.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-05-29 12:56:41 +02:00
Rich Megginson
c144794faa style: ansible-lint - remove line-length files from .yamllint.yml
Rather than having to maintain .yamllint.yml with a list of files
exempt from yamllint line-length checking, either fix the code
to abide by the line length restriction, or put the yamllint
exceptions in-line in the code.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-04-28 09:41:30 -06:00
Rich Megginson
211412d035 style: ansible-lint - fix missing YAML document start
ansible-lint requires that YAML documents begin with a line
consisting of `---`

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-04-28 09:15:50 -06:00
Rich Megginson
c0a626ddbb style: Use standard Ansible braces and brackets spacing
Use standard Ansible spacing for braces and brackets.  This
allows us to remove those rule exceptions from .yamllint.yml

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-04-28 09:13:55 -06:00
Wen Liang
b02e58db76 Fix the failure of running ANSIBLE_GATHERING=explicit on tests_switch_provider.yml
The test `tests_switch_provider.yml` fails to run with
`ANSIBLE_GATHERING=explicit` with the error described below. Therefore,
include the task 'el_repo_setup.yml' before running the test which
supports gathering the minimum subset of facts required.

```
TASK [set fact to use initscripts network_provider]
task path: /tmp/tmp.Q6nP8W4iPS/rhel_system_roles/tests/network/playbooks/tests_switch_provider.yml:8
fatal: [/tmp/tmp.Q6nP8W4iPS/RHEL_8_8_TESTING.qcow2]: FAILED! => {}
MSG:
The conditional check 'ansible_distribution in ['CentOS', 'RedHat'] and
ansible_distribution_major_version in ['7', '8']' failed. The error
was: error while evaluating conditional (ansible_distribution in
['CentOS', 'RedHat'] and ansible_distribution_major_version in
['7', '8']): 'ansible_distribution' is undefined.
```

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-04-27 15:14:49 -06:00
Wen Liang
5ff1189409 ansible-lint: Fix name[missing] and name[play] failures
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-04-10 17:49:07 +02:00
Wen Liang
aa3b6bd8dc ansible-lint: Fix remaining name[casing] warnings
More name[casing] warnings are discovered by ansible-lint,
this may be due to the upgrade of ansible-lint.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-04-05 16:52:39 -06:00