From fa02c71d8071ec383f80f773fe8b2f6cc332bcbd Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Sat, 2 May 2026 20:29:04 +0200 Subject: [PATCH 1/3] Try to add ansible-lint to CI. --- .ansible-lint | 36 ++++++++++++++++++++++++++++++++++++ antsibull-nox.toml | 2 ++ 2 files changed, 38 insertions(+) create mode 100644 .ansible-lint diff --git a/.ansible-lint b/.ansible-lint new file mode 100644 index 0000000000..fdd9100a2c --- /dev/null +++ b/.ansible-lint @@ -0,0 +1,36 @@ +--- +# Copyright (c) Ansible Project +# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) +# SPDX-License-Identifier: GPL-3.0-or-later + +skip_list: + # Ignore rules that make no sense: + - galaxy[tags] + - galaxy[version-incorrect] + - meta-runtime[unsupported-version] + - no-changed-when + - sanity[cannot-ignore] # some of the rules you cannot ignore actually MUST be ignored, like yamllint:unparsable-with-libyaml + - yaml # we're using yamllint ourselves + - var-naming[no-role-prefix] + + # To be checked and maybe fixed: + - args + - avoid-implicit + - command-instead-of-module + - command-instead-of-shell + - complexity + - fqcn + - galaxy + - ignore-errors + - jinja + - key-order + - latest + - literal-compare + - name + - no-free-form + - no-handler + - package-latest + - risky-file-permissions + - risky-shell-pipe + - schema + - var-naming diff --git a/antsibull-nox.toml b/antsibull-nox.toml index 04355c5be5..05b21bb81b 100644 --- a/antsibull-nox.toml +++ b/antsibull-nox.toml @@ -112,6 +112,8 @@ doc_fragment = "community.general._scaleway.actiongroup_scaleway" [sessions.build_import_check] run_galaxy_importer = true +[sessions.ansible_lint] + [sessions.ansible_test_sanity] include_devel = true From 0d81a5f4e203ad81ca37c9a53a5f3ea1d023a56e Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Sat, 16 May 2026 10:14:35 +0200 Subject: [PATCH 2/3] Work around syntax-check deficiencies and fix some issues found afterwards. --- .../targets/connection/test_connection.yml | 11 +++++++---- .../targets/connection_wsl/plugin-specific-tests.yml | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/integration/targets/connection/test_connection.yml b/tests/integration/targets/connection/test_connection.yml index 7f8b5697ce..a95ae53842 100644 --- a/tests/integration/targets/connection/test_connection.yml +++ b/tests/integration/targets/connection/test_connection.yml @@ -3,7 +3,7 @@ # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) # SPDX-License-Identifier: GPL-3.0-or-later -- hosts: "{{ target_hosts }}" +- hosts: "{{ target_hosts | default('you need to specify target_hosts!') }}" gather_facts: false serial: 1 tasks: @@ -22,7 +22,8 @@ ### copy local file with unicode filename and content - name: create local file with unicode filename and content - local_action: lineinfile dest={{ local_tmp }}-汉语/汉语.txt create=true line=汉语 + lineinfile: dest={{ local_tmp }}-汉语/汉语.txt create=true line=汉语 + delegate_to: localhost - name: remove remote file with unicode filename and content action: "{{ action_prefix }}file path={{ remote_tmp }}-汉语/汉语.txt state=absent" - name: create remote directory with unicode name @@ -33,14 +34,16 @@ ### fetch remote file with unicode filename and content - name: remove local file with unicode filename and content - local_action: file path={{ local_tmp }}-汉语/汉语.txt state=absent + file: path={{ local_tmp }}-汉语/汉语.txt state=absent + delegate_to: localhost - name: fetch remote file with unicode filename and content fetch: src={{ remote_tmp }}-汉语/汉语.txt dest={{ local_tmp }}-汉语/汉语.txt fail_on_missing=true validate_checksum=true flat=true ### remove local and remote temp files - name: remove local temp file - local_action: file path={{ local_tmp }}-汉语 state=absent + file: path={{ local_tmp }}-汉语 state=absent + delegate_to: localhost - name: remove remote temp file action: "{{ action_prefix }}file path={{ remote_tmp }}-汉语 state=absent" diff --git a/tests/integration/targets/connection_wsl/plugin-specific-tests.yml b/tests/integration/targets/connection_wsl/plugin-specific-tests.yml index e7d7434b81..c5473db81c 100644 --- a/tests/integration/targets/connection_wsl/plugin-specific-tests.yml +++ b/tests/integration/targets/connection_wsl/plugin-specific-tests.yml @@ -3,7 +3,7 @@ # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) # SPDX-License-Identifier: GPL-3.0-or-later -- hosts: "{{ target_hosts }}" +- hosts: "{{ target_hosts | default('you need to specify target_hosts!') }}" gather_facts: false tasks: - name: create file without content From 56dd027086dd9cca2ab64d90b8940b0f62f8f09c Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Sat, 16 May 2026 10:19:30 +0200 Subject: [PATCH 3/3] Work around more 'syntax check' deficiencies. --- .ansible-lint | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.ansible-lint b/.ansible-lint index fdd9100a2c..449295e7b6 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -34,3 +34,15 @@ skip_list: - risky-shell-pipe - schema - var-naming + +exclude_paths: + # Ansible-lint uses "ansible-playbook --syntax-check" as its "syntax check", + # which bails out on roles it cannot find. The following playbooks are 100% valid, + # but we need to skip them due to ansible-lint's syntax check's deficiencies... + - tests/integration/targets/filter_hashids/runme.yml + - tests/integration/targets/filter_jc/runme.yml + - tests/integration/targets/filter_json_patch/runme.yml + - tests/integration/targets/filter_json_query/runme.yml + - tests/integration/targets/lookup_etcd3/dependencies.yml + - tests/integration/targets/lookup_etcd3/test_lookup_etcd3.yml + - tests/integration/targets/test_fqdn_valid/runme.yml