From 2e8ac7aa663cf934a1dcc6b0d08cc6c8df0cfa90 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Wed, 4 Jan 2023 09:55:08 -0700 Subject: [PATCH] ansible-lint 6.x updates The only thing we need to skip currently is using FQCN for ansible builtin modules, plugins Add `kinds` - otherwise, Ansible thinks anything not in a traditional role path is a plain YAML file, and we don't get the additional checking. Ensure all plays are named. Fix some other minor problems. Signed-off-by: Rich Megginson --- .ansible-lint | 21 +++++++++++++++------ .yamllint.yml | 3 +-- examples/bond_options.yml | 3 ++- examples/bond_simple.yml | 3 ++- examples/bond_with_vlan.yml | 3 ++- examples/bridge_with_vlan.yml | 3 ++- examples/cloned_mac.yml | 3 ++- examples/dummy_simple.yml | 3 ++- examples/eth_dns_support.yml | 3 ++- examples/eth_simple_auto.yml | 3 ++- examples/eth_with_802_1x.yml | 4 +++- examples/eth_with_vlan.yml | 3 ++- examples/ethtool_coalesce.yml | 3 ++- examples/ethtool_features.yml | 5 +++-- examples/ethtool_features_default.yml | 3 ++- examples/ethtool_ring.yml | 3 ++- examples/infiniband.yml | 3 ++- examples/ipv6_disabled.yml | 3 ++- examples/macvlan.yml | 3 ++- examples/match_path_support.yml | 3 ++- examples/network_state.yml | 3 ++- examples/remove+down_profile.yml | 2 +- examples/route_table_support.yml | 3 ++- examples/team_simple.yml | 3 ++- examples/wireless_wpa3_owe.yml | 3 ++- examples/wireless_wpa3_sae.yml | 3 ++- examples/wireless_wpa_psk.yml | 3 ++- tasks/main.yml | 2 +- 28 files changed, 68 insertions(+), 35 deletions(-) diff --git a/.ansible-lint b/.ansible-lint index 73a71f4..68b3b11 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -1,10 +1,19 @@ --- -exclude_paths: - - tests/ - - .github/ - - .ansible-lint skip_list: - - role-name - - fqcn + - fqcn-builtins warn_list: - load-failure # allow include_tasks with tasks/ directory +exclude_paths: + - tests/ + - tests/roles/ + - .github/ + - examples/roles/ +kinds: + - playbook: "**/tests/tests_*.yml" + - playbook: "**/tests/setup-snapshot.yml" + - tasks: "**/tests/*.yml" + - playbook: "**/tests/playbooks/*.yml" + - tasks: "**/tests/tasks/*.yml" + - tasks: "**/tests/tasks/*/*.yml" + - vars: "**/tests/vars/*.yml" + - playbook: "**/examples/*.yml" diff --git a/.yamllint.yml b/.yamllint.yml index c7b4845..bb939a2 100644 --- a/.yamllint.yml +++ b/.yamllint.yml @@ -1,6 +1,6 @@ # SPDX-License-Identifier: MIT --- -extends: yamllint_defaults.yml +extends: default # possible customizations over the base yamllint config # skip the yaml files in the /tests/ directory # NOTE: If you want to customize `ignore` you'll have to @@ -19,7 +19,6 @@ ignore: | tests/roles/ .tox/ rules: - truthy: disable line-length: ignore: | /tests/tasks/setup_mock_wifi_wpa3_owe.yml diff --git a/examples/bond_options.yml b/examples/bond_options.yml index bb7a48a..e86f130 100644 --- a/examples/bond_options.yml +++ b/examples/bond_options.yml @@ -1,6 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause --- -- hosts: network-test +- name: Manage bond options + hosts: network-test vars: network_connections: # Specify the bond profile diff --git a/examples/bond_simple.yml b/examples/bond_simple.yml index c01c5e2..e94034f 100644 --- a/examples/bond_simple.yml +++ b/examples/bond_simple.yml @@ -1,6 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause --- -- hosts: network-test +- name: Manage bond connection + hosts: network-test vars: network_connections: # Specify the bond profile diff --git a/examples/bond_with_vlan.yml b/examples/bond_with_vlan.yml index b367f7d..1b8a231 100644 --- a/examples/bond_with_vlan.yml +++ b/examples/bond_with_vlan.yml @@ -1,6 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause --- -- hosts: network-test +- name: Manage bond with VLAN + hosts: network-test vars: network_connections: # Create a bond profile, which is the parent of VLAN. diff --git a/examples/bridge_with_vlan.yml b/examples/bridge_with_vlan.yml index 6710e8b..1fa58bc 100644 --- a/examples/bridge_with_vlan.yml +++ b/examples/bridge_with_vlan.yml @@ -1,6 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause --- -- hosts: network-test +- name: Manage bridge with VLAN + hosts: network-test vars: network_connections: # Create a bridge profile, which is the parent of VLAN. diff --git a/examples/cloned_mac.yml b/examples/cloned_mac.yml index 11bce64..9a09943 100644 --- a/examples/cloned_mac.yml +++ b/examples/cloned_mac.yml @@ -1,6 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause --- -- hosts: network-test +- name: Manage cloned MAC + hosts: network-test vars: network_connections: # specify the bond profile diff --git a/examples/dummy_simple.yml b/examples/dummy_simple.yml index 7ffea89..b7566a7 100644 --- a/examples/dummy_simple.yml +++ b/examples/dummy_simple.yml @@ -1,6 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause --- -- hosts: all +- name: Example of profile management + hosts: all vars: network_connections: # Specify the dummy profile diff --git a/examples/eth_dns_support.yml b/examples/eth_dns_support.yml index c2037eb..299dd54 100644 --- a/examples/eth_dns_support.yml +++ b/examples/eth_dns_support.yml @@ -1,6 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause --- -- hosts: all +- name: Manage DNS settings + hosts: all vars: network_connections: - name: eth0 diff --git a/examples/eth_simple_auto.yml b/examples/eth_simple_auto.yml index 8385c4a..5c7e9ea 100644 --- a/examples/eth_simple_auto.yml +++ b/examples/eth_simple_auto.yml @@ -1,6 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause --- -- hosts: network-test +- name: Manage autoconnect + hosts: network-test vars: network_connections: # Create one ethernet profile and activate it. diff --git a/examples/eth_with_802_1x.yml b/examples/eth_with_802_1x.yml index 2ae34f2..655f457 100644 --- a/examples/eth_with_802_1x.yml +++ b/examples/eth_with_802_1x.yml @@ -1,6 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause --- -- hosts: network-test +- name: Manage 802.1x with certs + hosts: network-test vars: network_connections: - name: eth0 @@ -22,6 +23,7 @@ copy: src: "{{ item }}" dest: /etc/pki/tls/{{ item }} + mode: 0600 with_items: - client.key - client.pem diff --git a/examples/eth_with_vlan.yml b/examples/eth_with_vlan.yml index 244bcd6..04cbeb8 100644 --- a/examples/eth_with_vlan.yml +++ b/examples/eth_with_vlan.yml @@ -1,6 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause --- -- hosts: network-test +- name: Manage ethernet with VLAN + hosts: network-test vars: network_connections: # Create a profile for the underlying device of the VLAN. diff --git a/examples/ethtool_coalesce.yml b/examples/ethtool_coalesce.yml index 8c55ba4..e3b36cd 100644 --- a/examples/ethtool_coalesce.yml +++ b/examples/ethtool_coalesce.yml @@ -1,6 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause --- -- hosts: all +- name: Manage ethernet coalesce + hosts: all tasks: - name: Configure ethernet coalesce include_role: diff --git a/examples/ethtool_features.yml b/examples/ethtool_features.yml index 5f2e19d..6d9a249 100644 --- a/examples/ethtool_features.yml +++ b/examples/ethtool_features.yml @@ -1,8 +1,9 @@ # SPDX-License-Identifier: BSD-3-Clause --- -- hosts: all +- name: Manage ethernet parameters + hosts: all tasks: - - name: Configure ethernet paramters + - name: Configure ethernet parameters include_role: name: linux-system-roles.network vars: diff --git a/examples/ethtool_features_default.yml b/examples/ethtool_features_default.yml index 62f172d..7925264 100644 --- a/examples/ethtool_features_default.yml +++ b/examples/ethtool_features_default.yml @@ -1,6 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause --- -- hosts: all +- name: Manage ethernet features + hosts: all tasks: - name: Configure ethernet features include_role: diff --git a/examples/ethtool_ring.yml b/examples/ethtool_ring.yml index 9fb2f50..cb89362 100644 --- a/examples/ethtool_ring.yml +++ b/examples/ethtool_ring.yml @@ -1,6 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause --- -- hosts: all +- name: Manage ethtool ring + hosts: all tasks: - name: Configure ring parameters include_role: diff --git a/examples/infiniband.yml b/examples/infiniband.yml index 9747793..43a8dce 100644 --- a/examples/infiniband.yml +++ b/examples/infiniband.yml @@ -1,6 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause --- -- hosts: network-test +- name: Manage inifiniband example + hosts: network-test vars: network_connections: - name: ib0 diff --git a/examples/ipv6_disabled.yml b/examples/ipv6_disabled.yml index 5c70b79..f9a3f61 100644 --- a/examples/ipv6_disabled.yml +++ b/examples/ipv6_disabled.yml @@ -1,6 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause --- -- hosts: all +- name: Disable ipv6 + hosts: all vars: network_connections: - name: eth0 diff --git a/examples/macvlan.yml b/examples/macvlan.yml index bac474d..f36ab16 100644 --- a/examples/macvlan.yml +++ b/examples/macvlan.yml @@ -1,6 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause --- -- hosts: network-test +- name: Manage network MAC VLAN + hosts: network-test vars: network_connections: - name: eth0 diff --git a/examples/match_path_support.yml b/examples/match_path_support.yml index 4d27d57..37db903 100644 --- a/examples/match_path_support.yml +++ b/examples/match_path_support.yml @@ -1,6 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause --- -- hosts: all +- name: Manage network using match path for interface + hosts: all vars: network_connections: - name: eth0 diff --git a/examples/network_state.yml b/examples/network_state.yml index 0e3d709..0a50305 100644 --- a/examples/network_state.yml +++ b/examples/network_state.yml @@ -1,6 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause --- -- hosts: all +- name: Manage network using network_state + hosts: all vars: network_state: interfaces: diff --git a/examples/remove+down_profile.yml b/examples/remove+down_profile.yml index 5894131..840c732 100644 --- a/examples/remove+down_profile.yml +++ b/examples/remove+down_profile.yml @@ -1,6 +1,6 @@ # SPDX-License-Identifier: BSD-3-Clause --- -- name: Set {{ profile }} down +- name: Set down profile {{ profile }} hosts: all vars: network_connections: diff --git a/examples/route_table_support.yml b/examples/route_table_support.yml index 6aca360..4652166 100644 --- a/examples/route_table_support.yml +++ b/examples/route_table_support.yml @@ -1,6 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause --- -- hosts: all +- name: Manage routing tables + hosts: all tasks: - name: Add a new routing table lineinfile: diff --git a/examples/team_simple.yml b/examples/team_simple.yml index 3700e75..914acb8 100644 --- a/examples/team_simple.yml +++ b/examples/team_simple.yml @@ -1,6 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause --- -- hosts: network-test +- name: Manage teaming + hosts: network-test vars: network_connections: # Specify the team profile diff --git a/examples/wireless_wpa3_owe.yml b/examples/wireless_wpa3_owe.yml index 06fe979..3fd7433 100644 --- a/examples/wireless_wpa3_owe.yml +++ b/examples/wireless_wpa3_owe.yml @@ -1,6 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause --- -- hosts: all +- name: Manage Wireless with OWE + hosts: all vars: network_connections: - name: wlan0 diff --git a/examples/wireless_wpa3_sae.yml b/examples/wireless_wpa3_sae.yml index 5630fca..3d15604 100644 --- a/examples/wireless_wpa3_sae.yml +++ b/examples/wireless_wpa3_sae.yml @@ -1,6 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause --- -- hosts: network-test +- name: Manage WPA3 with SAE + hosts: network-test vars: network_connections: - name: wlan0 diff --git a/examples/wireless_wpa_psk.yml b/examples/wireless_wpa_psk.yml index 03041c2..860cf4f 100644 --- a/examples/wireless_wpa_psk.yml +++ b/examples/wireless_wpa_psk.yml @@ -1,6 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause --- -- hosts: network-test +- name: Manage WPA PSK + hosts: network-test vars: network_connections: - name: wlan0 diff --git a/tasks/main.yml b/tasks/main.yml index 0626be0..82d527d 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -74,7 +74,7 @@ # ansible-lint wants this to be a handler, but this is not appropriate as # NetworkManager must be restarted prior to the connections being created. # see (https://docs.ansible.com/ansible-lint/rules/default_rules.html) - - __network_package_install.changed # noqa 503 + - __network_package_install.changed # noqa no-handler - name: Enable and start NetworkManager service: