Commit graph

8 commits

Author SHA1 Message Date
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
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
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
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
Rich Megginson
58a8e258ef change include to include_tasks
The keyword `include:` is deprecated in favor of
`include_tasks:`.
See https://docs.ansible.com/ansible/latest/collections/ansible/builtin/include_module.html

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2022-07-05 12:52:29 -06:00
Noriko Hosoi
79b39792e4 System Roles should consistently use ansible_managed in configuration files it manages
bz#2044640

The network role create an ifcfg file for initscripts. The file
used to append a comment "# this file was created by ansible".
This patch replaces the proprietary string with the ansible
standard {{ ansible_managed }} to adjust to the other system
roles.

For the implementation, it borrowed the method from kernel_settings,
getting the ansible managed comment using the get_ansible_managed.j2
template and pass the comment to network_connections which is added
to the ifcfg file.

In case network_provider is nm, the comment is not added to the
ifcfg file as the file is not managed by Ansible.

Note: the required parameter name to pass the ansible managed comment
to the network_connection module is "__header".

Do not use get_ansible_managed.j2 in the test scripts, but use a
hardcoded ansible managed comment to simplify the tests.

tests/tasks/get_profile_stat.yml: replace the '=' style with the YAML
notation in set_fact.

Signed-off-by: Noriko Hosoi <nhosoi@redhat.com>
2022-02-25 06:10:42 +08:00
Gris Ge
637e1e6bbe test: Fix profile assertion on Fedora 33
The NetworkManager in Fedora 33 does not use ifcfg-rh plugin by default,
the CI will fail on Fedora 33 with:

```
TASK [assert that profile 'bond0' is present] **********************************
task path: /tmp/tmpaz9m374e/tests/playbooks/tasks/assert_profile_present.yml:4
fatal: [/cache/fedora-33.qcow2]: FAILED! => {
    "assertion": "profile_stat.stat.exists",
    "changed": false,
    "evaluated_to": false,
    "msg": "profile /etc/sysconfig/network-scripts/ifcfg-bond0 does not exist"
}
```

Previously, we are checking the existence of
`/etc/sysconfig/network-scripts/` to determine whether ifcfg-rh plugin
is enabled. This is incorrect on Fedora 33.

The fix is checking the FILENAME[1] used for storing the NetworkManager
connection, the profile is considered as exists when it exists and does
not contains `/run`.

Since we cannot tell which provider we are using, we just check both
initscripts files and NetworkManager connections.

[1]: nmcli -f NAME,FILENAME connection show

Signed-off-by: Gris Ge <fge@redhat.com>
2020-12-16 10:39:13 +08:00
Jack Adolph
97129717a5 Rename files to be valid python identifiers 2020-04-22 17:40:03 +02:00
Renamed from tests/tasks/assert-profile_present.yml (Browse further)