Commit graph

751 commits

Author SHA1 Message Date
Rich Megginson
751c3fffca fix: facts being gathered unnecessarily
Cause: The comparison of the present facts with the required facts is
being done on unsorted lists.

Consequence: The comparison may fail if the only difference is the
order.  Facts are gathered unnecessarily.

Fix: Use `difference` which works no matter what the order is.  Ensure
that the fact gathering subsets used are the absolute minimum required.

Result: The role gathers only the facts it requires, and does
not unnecessarily gather facts.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-07-14 15:23:56 -06:00
Rich Megginson
a83b157591 ci: ansible-test ignores file for ansible-core 2.15
Need a new ignores file for ansible-core 2.15 ansible-test

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-07-13 10:35:55 -06:00
Rich Megginson
e16b0e65ff ci: ansible-lint - ignore var-naming[no-role-prefix]
ansible-lint has recently added a check for this.  It flags a lot of our test
code, and some of our role code that uses nested roles.
There is no easy way to disable it for these cases only.  It would be a
tremendous amount of work to add `# noqa` comments everywhere.
The use of `.ansible-lint-ignore` would be a maintenance burden (cannot use
tests/tests_*.yml or other similar wildcard to match all test files), would
still issue a lot of warning messages, and would not solve all of the problems.
The only way for now is to skip this rule.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-07-13 09:36:55 -06:00
Rich Megginson
104638e765 docs(changelog): version 1.13.0 [citest skip]
Create changelog update and release for version 1.13.0

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-07-10 10:50:23 -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
Rich Megginson
4371036f14 ci: fix python 2.7 CI tests by manually installing python2.7 package
We use the setup-python github action.  This has dropped support for
python 2.7.  Instead, just manually install the python2.7 package.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-06-28 16:04:06 -06:00
Sergei Petrosian
e791fb9440 ci: Rename commitlint to PR title Lint, echo PR titles from env var
Signed-off-by: Sergei Petrosian <spetrosi@redhat.com>
2023-06-22 07:42:01 +02:00
Sergei Petrosian
f07e275282 ci: Add pull request template and run commitlint on PR title only
We now ensure the conventional commits format only on PR titles and not on
commits to let developers keep commit messages targeted for other developers
i.e. describe actual changes to code that users should not care about.
And PR titles, on the contrary, must be aimed at end users.

For more info, see
https://linux-system-roles.github.io/contribute.html#write-a-good-pr-title-and-description

Signed-off-by: Sergei Petrosian <spetrosi@redhat.com>
2023-06-13 11:23:21 -06:00
Rich Megginson
391617cc5c ci: Use tox-lsr 2.13 for py26
tox-lsr 3.x does not support python 2.6, so use tox-lsr 2.13 for
py26 testing.  This should be fine until we can drop support for
python 2.6

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-06-05 12:40:29 -06:00
Ole Pannbacker
c2f89a78b9 feat: add AlmaLinux to RHEL compat distro list
Signed-off-by: Ole Pannbacker <opannbacker@cronon.net>
2023-06-01 16:23:16 -06:00
Rich Megginson
4b7663ce7e docs(changelog): version 1.12.0 [citest skip]
Create changelog update and release for version 1.12.0

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-05-30 13:34:16 -06: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
2ce6f3afa7 ci: update tox-lsr to version 3.0.0
The major version bump is because tox-lsr 3 drops support
for tox version 2.  If you are using tox 2 you will need to
upgrade to tox 3 or 4.

tox-lsr 3.0.0 adds support for tox 4, commitlint, and ansible-lint-collection

See https://github.com/linux-system-roles/tox-lsr/releases/tag/3.0.0
for full release notes

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-05-17 10:17:19 -06:00
Rich Megginson
fd92063502 docs: Consistent contributing.md for all roles - allow role specific contributing.md section
Provide a single, consistent contributing.md for all roles.  This mostly links to
and summarizes https://linux-system-roles.github.io/contribute.html

Allow for a role specific section which typically has information about
role particulars, role debugging tips, etc.

Fix several markdown consistency issues, other issues found by markdownlint
Use https://www.markdownguide.org/basic-syntax#alternate-syntax style for
headings, using `### heading3`, `#### heading4`, etc. for lower level
headings.

See https://github.com/linux-system-roles/.github/pull/19

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-05-10 14:23:20 -06:00
Rich Megginson
abc370a2e0 docs(changelog): version 1.11.4 [citest skip]
Create changelog update and release for version 1.11.4

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-04-28 13:22:37 -06: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
Sergei Petrosian
7884537284 ci: Add commitlint GitHub action to ensure conventional commits with feedback
For more information, see Conventional Commits format in Contribute
https://linux-system-roles.github.io/contribute.html#conventional-commits-format

Signed-off-by: Sergei Petrosian <spetrosi@redhat.com>
2023-04-28 14:36:36 +02: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
Rich Megginson
ee2a8eb177 docs(changelog): version 1.11.3 [citest skip]
Create changelog update and release for version 1.11.3

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-04-14 09:01:34 -06:00
Wen Liang
46f827419e ansible-lint: Remove the rule 'load-failure' from 'warn_list'
The rule 'load-failure' is unskippable, you cannot use it in
'skip_list' or 'warn_list'.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-04-10 17:49:07 +02:00
Wen Liang
af76d08550 ansible-lint: Enable the check on 'tests/' directory
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-04-10 17:49:07 +02: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
Wen Liang
b1d2f305c2 ansible-lint: Fix remaining jinja[spacing] warnings
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-04-05 16:44:41 -06:00
Wen Liang
2de826ee24 ansible-lint: Fix yaml[octal-values] failures
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-04-04 09:52:31 -06:00
Noriko Hosoi
77214cbda4 Fingerprint RHEL System Role managed config files
- Add role name to the generated config files.
  # system_role:network

Signed-off-by: Noriko Hosoi <nhosoi@redhat.com>
2023-03-30 13:38:19 -06:00
Wen Liang
2b693d14c0 ansible-lint: Fix no-changed-when failure
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-03-29 13:10:38 +02:00
Rich Megginson
7f26cdb8ac in lsr_assert_when use condition instead of when
ansible-lint is confused by the use of `when:` with `lsr_assert_when`.
It thinks the `when` string should be evaluated as a Jinja expression
but it is really just a plain string.  To make this more friendly to
ansible-lint, use `condition:` instead of `when:` with
`lsr_assert_when`.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-03-28 18:26:33 -06:00
Wen Liang
8eed9ae4a9 ansible-lint: Fix ignore-errors failures
In some test playbooks, the `ignore_errors: true` can not be replaced
by `changed_when: false`, because `changed_when` is not a valid
attribute for a IncludeRole.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-03-28 18:41:23 +02:00
Wen Liang
8a3dd3c438 ansible-lint: Fix command-instead-of-module failures
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-03-28 18:40:13 +02:00
Noriko Hosoi
b80e178fc5 Add README-ansible.md to refer Ansible intro page on linux-system-roles.github.io
Signed-off-by: Noriko Hosoi <nhosoi@redhat.com>
2023-03-27 11:04:41 -06:00
Wen Liang
8174d5320d ansible-lint: Fix jinja[spacing] warnings
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-03-27 16:25:03 +02:00
Wen Liang
cd72556282 ansible-lint: Fix name[casing] warnings
Start all task names an uppercase letter.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-03-27 16:25:03 +02:00
Wen Liang
a384e5bb00 ansible-lint: Fix key-order[task] failures
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-03-22 10:21:50 +01:00
Wen Liang
4bac670e65 ansible-lint: Fix name[template] warnings
Jinja templates should only be at the end of 'name'. This helps with
the identification of tasks inside the source code when they fail.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-03-21 17:06:29 +01:00
Wen Liang
e8fef16995 ansible-lint: Fix no-jinja-when, yaml[line-legnth] and package-latest failures
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-03-20 14:14:00 +01:00
Wen Liang
3a6f941b2f ansible-lint: Define variable 'network_provider' to fix jinja[invalid] failure
ansible-lint 6.x syntax check raises `jinja[invalid]` error on the
mandatory variable 'network provider' because it is not defined. In
order to fix the problem, define the 'network_provider' variable in
the file .ansible-lint. The value of the variable is less important as
long as it is reasonable which only meets the purpose of passing the
ansible-lint 6.x syntax check.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-03-20 14:14:00 +01:00
Rich Megginson
c8d3f1dc69 update tox-lsr to 2.13.2; update ansible-lint configuration; start of support for merge queues
Update tox-lsr to 2.13.2

Update ansible-lint configuration

Add support for merge queues to github actions
This doesn't mean all system roles support merge queues,
this is just a preliminary step

See https://github.com/linux-system-roles/.github/pull/21

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-03-10 16:58:58 +08:00
Wen Liang
2d0d217070 ansible-lint: Fix schema[playbook] failure
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-03-08 16:55:28 +01:00
Wen Liang
65735a85a6 ansible-lint: Fix parser-error failure
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-03-07 17:17:06 +01:00
Wen Liang
f11e720268 ansible-lint: Fix var-naming warnings
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-03-02 12:08:51 +01:00
dependabot[bot]
47898bab1f Bump actions/checkout from 2 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-01 17:15:42 +01:00
Wen Liang
c030e50853 Add needed status check on the merge_group
When adding an approved PR to the merge queue, the required status
checks of the workflows are missing, which prevents the PR getting
merged. This commit is intended to trigger merge group checks with
Github Actions, so that the workflows will report the needed status
checks.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-02-27 11:03:22 -07:00
Rich Megginson
bdc896bae6 Version 1.11.2 - CHANGELOG.md [citest skip]
[1.11.2] - 2023-02-20
--------------------

- none

- initscripts: Configure output device in routes

- none

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-02-20 16:58:27 +01:00
Till Maas
3dbe94da5b yamllint: Enable truthy check
Signed-off-by: Till Maas <opensource@till.name>
2023-02-20 15:00:28 +01:00
Wen Liang
101920be5c ansible-lint: Fix yaml[truthy] failures
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-02-20 15:00:28 +01:00
Wen Liang
7c0579ddfc initscripts: Configure output device in routes
Without an explicit output device, the kernel might use a different
output device than intended by the user. Therefore, use the interface
name of connections to specify it if it is available. Otherwise,
educate the user about this potential problem with a warning. This
aligns the behavior with NetworkManager which configures the output
device in routes when activating profiles on devices.

Fixes: https://bugzilla.redhat.com/2168735

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-02-20 06:36:00 +01:00
Till Maas
e4cc5c138f Unit tests/initscripts: Support checking warnings
Signed-off-by: Till Maas <opensource@till.name>
2023-02-20 06:36:00 +01:00