Commit graph

817 commits

Author SHA1 Message Date
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
008fe5cd3b ci: ansible-lint action now requires absolute directory
the change made for
b4018c22f8
means that ansible-lint now needs an absolute path for the working directory

Go ahead and make ansible-test use absolute path too just in case they decide
to make the same change.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2024-06-26 08:53:58 -06:00
maritu
0ba8dd7073 docs: network_connections module is only meant for internal usage by the role
Signed-off-by: maritu <marehone12@gmail.com>
2024-06-11 15:03:42 -04:00
Israel'[s Repo
d98948b31e docs: Add documentation for specifying VLAN ID
Signed-off-by: Israel'[s Repo <108451228+Precious000@users.noreply.github.com>
2024-06-11 14:20:06 -04:00
Rich Megginson
973a515d26 docs(changelog): version 1.15.3 [citest skip]
Update changelog and .README.html for version 1.15.3

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2024-06-11 11:11:23 -06:00
Rich Megginson
5b8d09795c ci: Add supported_ansible_also to .ansible-lint
This fixes the breakage of ansible-test.

We want to advertise support for ansible 2.14 since some of
our collections will be supported for a long time on this
version.  The latest version of ansible-lint requires 2.15
in meta/runtime.yml, but it also adds support for a way to
tell ansible-lint other versions which are acceptable, using
the new `supported_ansible_also` configuration option
in .ansible-lint

With this fix, we can support both the latest version of
ansible-test and ansible-lint.

See https://github.com/linux-system-roles/auto-maintenance/pull/341
for more information.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2024-06-05 14:46:27 -06:00
Rich Megginson
a8d381751a fix ansible-lint issues in example code
Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2024-06-04 18:09:20 -06:00
Rich Megginson
0f3f437e72 disable pylint warning caused by use of python3 pylint
Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2024-06-04 18:09:20 -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
b0517d1cfb ci: tox-lsr 3.4.0 - fix py27 tests; move other checks to py310
The latest version of virtualenv does not support creating
python 2.7 virtualenvs.  Change our CI tests to restrict the version
of virtualenv<20.22.0 and tox<4.15 for py27 environments

Move pylint, flake8, and black checks to the py310 environment
which is currently supported by ansible-core 2.17 and its related
checkers such as ansible-lint and ansible-test

pylint now uses ansible-core 2.17 and restricts the version of
pylint to 3.1.0 which is the version used by ansible-test 2.17

Remove `extends: default` for .yamllint.yml.  The latest version
of ansible-lint will automatically incorporate local yamllint
settings unless there is an `extends:`.

The above changes require some fixes to the role code.

For more information, see
https://github.com/linux-system-roles/tox-lsr/pull/168
and
https://github.com/linux-system-roles/tox-lsr/pull/170

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2024-06-04 18:09:20 -06:00
Rich Megginson
03e3b788ff ci: use tox-lsr 3.3.0 which uses ansible-test 2.17
Upgrade ci tests to use tox-lsr 3.3.0

tox-lsr 3.3.0 uses ansible-test 2.17

Create the ansible-test ignore file for 2.17

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2024-05-31 09:10:47 -06:00
Sergei Petrosian
34d1f2d53e docs(changelog): version 1.15.2 [citest skip]
Update changelog and .README.html for version 1.15.2

Signed-off-by: Sergei Petrosian <spetrosi@redhat.com>
2024-04-04 15:19:37 -06:00
dependabot[bot]
b4174b837f ci: Bump mathieudutour/github-tag-action from 6.1 to 6.2
Bumps [mathieudutour/github-tag-action](https://github.com/mathieudutour/github-tag-action) from 6.1 to 6.2.
- [Release notes](https://github.com/mathieudutour/github-tag-action/releases)
- [Commits](https://github.com/mathieudutour/github-tag-action/compare/v6.1...v6.2)

---
updated-dependencies:
- dependency-name: mathieudutour/github-tag-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-02 10:56:39 -04:00
maritu
4bc36b3484 docs: Add MAC VTAP example
Signed-off-by: maritu <marehone12@gmail.com>
2024-03-28 13:22:41 -04: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
94aeedb64a docs: Update the description about the variable network_allow_restart
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
dependabot[bot]
4aef173aea
ci: Bump ansible/ansible-lint from 6 to 24 (#677)
Bumps [ansible/ansible-lint](https://github.com/ansible/ansible-lint) from 6 to 24.
- [Release notes](https://github.com/ansible/ansible-lint/releases)
- [Commits](https://github.com/ansible/ansible-lint/compare/v6...v24)

---
updated-dependencies:
- dependency-name: ansible/ansible-lint
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-01 15:46:58 +01: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
Rich Megginson
4b12e154a6 docs(changelog): version 1.15.1 [citest skip]
Update changelog and .README.html for version 1.15.1

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2024-02-14 20:32:54 -07: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
Rich Megginson
6c74dee859 ci: fix python unit test - copy pytest config to tests/unit
This is fixed by tox-lsr 3.2.2 - all actions that use tox-lsr are updated to
3.2.2, not just the python unit tests, even though the fix is only related to
pytest.  All roles are updated to use tox-lsr 3.2.2 for the sake of consistency
even if not affected by the pytest issue.

Something changed recently in the way github actions provisions systems which
means some of the directories are not readable by the python unit test actions.
In addition, the python unit tests were causing a lot of unnecessary directory
traversal doing collection/discovery of unit test files, because of using
`pytest -c /path/to/tox-lsr/pytest.ini` Unfortunately, with `pytest`, the
directory of the config file is the root directory for the tests and tests
discovery, and there is no way around this.

Therefore, the only solution is to copy the tox-lsr `pytest.ini` to the
`tests/unit` directory, which makes that the test root directory.

See also https://github.com/linux-system-roles/tox-lsr/pull/160

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2024-02-05 17:14:33 -07:00
dependabot[bot]
779eb87a31 ci: Bump codecov/codecov-action from 3 to 4
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 3 to 4.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-01 14:36:29 -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
Rich Megginson
4f1137415c docs(changelog): version 1.15.0 [citest skip]
Update changelog and .README.html for version 1.15.0

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2024-01-17 13:34:45 -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
735d4befa7 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 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.

This also requires tox-lsr 3.2.1 - bump other actions to use 3.2.1

Role developers can run this locally using
`tox -e collection,ansible-lint-collection`
See https://github.com/linux-system-roles/tox-lsr/pull/125

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2024-01-12 07:46:51 -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
dependabot[bot]
15e705dd95 ci: Bump actions/setup-python from 4 to 5
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4 to 5.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-03 13:25:06 -07:00
dependabot[bot]
fc593dcffa ci: Bump github/codeql-action from 2 to 3
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2 to 3.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-03 13:24:24 -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
e213dc9af9 docs(changelog): version 1.14.2 [citest skip]
Update changelog and .README.html for version 1.14.2

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-12-12 09:07:26 -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
dependabot[bot]
d21b60f30d ci: bump actions/github-script from 6 to 7
Bumps [actions/github-script](https://github.com/actions/github-script) from 6 to 7.
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](https://github.com/actions/github-script/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/github-script
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-01 14:56:36 -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
Rich Megginson
11fa80a74b docs(changelog): version 1.14.1 [citest skip]
Update changelog and .README.html for version 1.14.1

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-11-30 08:49:58 -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
815b5b0cc5 docs(changelog): version 1.14.0 [citest skip]
Update changelog and .README.html for version 1.14.0

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-11-09 14:26: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
712f1dfcf4 docs(changelog): Fix wrong format in version 1.13.2
The changelog update for version 1.13.2 contains wrongly formatted
content which makes the changelog file update inconsistent from
previous release.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-10-26 08:12:48 -06:00
Rich Megginson
b940af74a6 docs(changelog): version 1.13.3 [citest skip]
Update changelog and .README.html for version 1.13.3

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-10-24 07:51:38 -06:00