Commit graph

854 commits

Author SHA1 Message Date
dependabot[bot]
7ba409fcce ci: bump codecov/codecov-action from 4 to 5
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4 to 5.
- [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/v4...v5)

---
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-12-02 14:40:14 +01:00
Rich Megginson
70b7791f33 docs(changelog): version 1.17.0 [citest skip]
Update changelog and .README.html for version 1.17.0

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2024-10-30 18:50:26 -06: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
46964caee5 docs: Add example for configuring a Linux Bridge using network_state variable
Signed-off-by: Wen Liang <wenliang@redhat.com>
2024-10-18 08:28:38 -04:00
Wen Liang
1630646a55 docs: Promote network_state variable as the future for network management
Signed-off-by: Wen Liang <wenliang@redhat.com>
2024-10-18 08:28:38 -04:00
Rich Megginson
f3f5aa6c83 ci: add YAML header to github action workflow files
Some github action workflow files were missing the YAML --- header.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2024-10-16 11:33:39 -06:00
Rich Megginson
a43638333b ci: ansible-test action now requires ansible-core version
The ansible-test github action does not use a supported version
of ansible-core by default.
https://github.com/ansible-community/ansible-test-gh-action?tab=readme-ov-file#ansible-core-version

We have to set it in our action.  Using `stable-2.17` as that is the latest stable version.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2024-10-15 14:33:13 -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
Sergei Petrosian
b08aad243b ci: Add tags to TF workflow, allow more [citest bad] formats
* Add "BusinessUnit": "system_roles" environment setting to tag our jobs in Testing farm
* Add tmt_plan_filter to run additional workflows besides general
* Allow more [citest bad] comment formats
* Get memory and supported platforms info from the PR ref
* Move LINUXSYSTEMROLES_USER to vars and use it everywhere in tft.yml
* Remove extra GITHUB_ORG definition

Signed-off-by: Sergei Petrosian <spetrosi@redhat.com>
2024-10-07 11:57:52 +02:00
Wen Liang
d6203012e5 docs: Explain where network state examples originate
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2024-09-06 10:21:44 -04:00
Rich Megginson
587a62e903 docs(changelog): version 1.16.5 [citest skip]
Update changelog and .README.html for version 1.16.5

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2024-08-29 19:14:32 -04:00
Wen Liang
7a476a71a4 docs: Remove invalid network state example
For an ethernet device which contains the kernel link, we should not
and cannot delete such a device using `network_state` variable.

We can only use `network_state` variable to delete the virtual NIC that
is created by NM/Nmstate.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2024-08-28 08:23:40 -04:00
Rich Megginson
9f2a64776d docs(changelog): version 1.16.4 [citest skip]
Update changelog and .README.html for version 1.16.4

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2024-08-22 10:02:39 -06:00
Wen Liang
7dca20df3c docs: Add examples using network_state variable
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2024-08-22 11:44:01 -04:00
Rich Megginson
e13482e650 docs(changelog): version 1.16.3 [citest skip]
Update changelog and .README.html for version 1.16.3

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2024-08-20 16:36:34 -06: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
1cba1dbc61 docs(changelog): version 1.16.2 [citest skip]
Update changelog and .README.html for version 1.16.2

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2024-08-19 16:45:26 -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
Rich Megginson
757081e06a docs(changelog): version 1.16.1 [citest skip]
Update changelog and .README.html for version 1.16.1

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2024-08-16 08:08:44 -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
89d7148e81 ci: fix and improve integration container testing
Use the vault for centos 7 and centos stream 8

Exclude tests/tests_team_plugin_installation_nm.yml since
tests/tests_team_nm.yml is excluded.

Use grouping to group log lines for better readability.
https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#grouping-log-lines

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2024-08-15 16:48:40 -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
Rich Megginson
5082921cf9 docs(changelog): version 1.16.0 [citest skip]
Update changelog and .README.html for version 1.16.0

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2024-08-09 11:57:14 -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
Sergei Petrosian
098e5e1efb ci: Fix missing slash in ARTIFACTS_URL
Signed-off-by: Sergei Petrosian <spetrosi@redhat.com>
2024-08-05 08:19:33 +02:00
Sergei Petrosian
f38d43628b
ci: Add workflow for ci_test bad, use remote fmf plan (#712)
* Remove plan from role dir, it's too complicated and long to run tests from tmt
* Use plan from linux-system-roles/tft-tests
* Move getting datetime to testing-farm job where it's used
* Add a workflow for running [citest_bad]
* Bump sclorg/testing-farm-as-github-action to v3
* Move concurrency group to first job
* Dump GitHub context

Signed-off-by: Sergei Petrosian <spetrosi@redhat.com>
2024-08-02 15:41:17 +02:00
Rich Megginson
9bbbca5d95 docs(changelog): version 1.15.6 [citest skip]
Update changelog and .README.html for version 1.15.6

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2024-08-01 17:07:08 -06:00
dependabot[bot]
d9381bc24e ci: bump sclorg/testing-farm-as-github-action from 2 to 3
Bumps [sclorg/testing-farm-as-github-action](https://github.com/sclorg/testing-farm-as-github-action) from 2 to 3.
- [Release notes](https://github.com/sclorg/testing-farm-as-github-action/releases)
- [Commits](https://github.com/sclorg/testing-farm-as-github-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: sclorg/testing-farm-as-github-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-01 16:32:44 -06:00
Sergei Petrosian
773d1c17a2
ci: Update fmf plan to add a separate job to prepare managed nodes (#708)
* Add a preparation job to run on managed nodes
* Update instructions to run tests locally
* From tft workflow, remove condition for commenter author_association.
  This would require us to add all trusted users, running workflow is not dangerous.
* Keep the plan minimal, only run prep steps required to install beakerlib

Signed-off-by: Sergei Petrosian <spetrosi@redhat.com>
2024-07-30 17:03:57 +02: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
Sergei Petrosian
f45b70a8f5 ci: Add tft plan and workflow
This change is for running tests in Testing Farm CI. This is a replacement for
BaseOS CI that we are currently using. Running it Testing Farm gives us more
control.

It adds a workflow for running tests, and a plans directory containing a test
plan and a README-plans.md with some info.

Note that this workflow runs from the main branch. This means that changes to
the workflow must be merged to main, then pull requests will be able to run it.
This is because the workflow uses on: issue_comment context, this is a security
measure recommended by GitHub. It saves us from leaking organization secrets.

The functionality is WIP, so await future fixes and updates.

Signed-off-by: Sergei Petrosian <spetrosi@redhat.com>
2024-07-25 10:48:44 +00: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
50df8b1963 docs(changelog): version 1.15.5 [citest skip]
Update changelog and .README.html for version 1.15.5

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2024-07-16 15:14:26 -06:00
Rich Megginson
80fb52b09b fix: network_state must be defined in defaults/main.yml
As part of the public API, `network_state` must be defined in
defaults/main.yml, and it must be defined with the correct
type `dict`, so the correct default value must be `{}` the
empty dict.

All checking for `network_state` must check for a value of
`{}` to mean "network_state not set or empty".

Fix the test which looks for teaming configuration in EL10
to correctly look for the value in `network_state`.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2024-07-08 09:24:18 -06:00
Rich Megginson
f1ba7dc3d0 docs(changelog): version 1.15.4 [citest skip]
Update changelog and .README.html for version 1.15.4

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2024-07-02 12:18:16 -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
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