From a1dd0ed0731d993d408661d5e364e4b4fa4093d9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20Sachse?= <Joerg.Sachse@slub-dresden.de>
Date: Wed, 20 Jul 2022 10:19:09 +0200
Subject: [PATCH] style: more linting

---
 handlers/main.yml                         | 6 ++++--
 molecule/virtualbox_debian11/molecule.yml | 2 +-
 tasks/configure_vim.yml                   | 2 +-
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/handlers/main.yml b/handlers/main.yml
index 4636c19..7265ba6 100644
--- a/handlers/main.yml
+++ b/handlers/main.yml
@@ -14,8 +14,9 @@
         name: netfilter-persistent
         state: present
       listen: "save iptables rules"
+    # we exclude this task from being linted for "no-changed-when", because handlers only ever run if there's a change triggered by a task
     - name: save iptables rules
-      ansible.builtin.command: 'netfilter-persistent save'
+      ansible.builtin.command: 'netfilter-persistent save'      # noqa no-changed-when
       listen: "save iptables rules"
   when: ansible_os_family == "Debian"
 
@@ -29,8 +30,9 @@
         group: "root"
         mode: "0600"
       listen: "save iptables rules"
+    # we exclude this task from being linted for "no-changed-when", because handlers only ever run if there's a change triggered by a task
     - name: save rules
-      ansible.builtin.command: /usr/sbin/iptables-save        # noqa 303
+      ansible.builtin.command: /usr/sbin/iptables-save        # noqa no-changed-when
       listen: "save iptables rules"
   when: ansible_os_family == "RedHat"
 
diff --git a/molecule/virtualbox_debian11/molecule.yml b/molecule/virtualbox_debian11/molecule.yml
index e050662..280948c 100644
--- a/molecule/virtualbox_debian11/molecule.yml
+++ b/molecule/virtualbox_debian11/molecule.yml
@@ -7,7 +7,7 @@ driver:
 lint: |
   set -e
   yamllint .
-  ansible-lint -x no-loop-var-prefix,command-instead-of-module
+  ansible-lint -x no-loop-var-prefix,command-instead-of-module,package-latest
 platforms:
   # Check out the documentation at
   # https://github.com/ansible-community/molecule-vagrant#documentation
diff --git a/tasks/configure_vim.yml b/tasks/configure_vim.yml
index f3e867f..d7ebf5b 100644
--- a/tasks/configure_vim.yml
+++ b/tasks/configure_vim.yml
@@ -1,7 +1,7 @@
 ---
 # see http://vimdoc.sourceforge.net/htmldoc/starting.html#system-vimrc
 - name: install systemwide vimrc config
-  template:
+  ansible.builtin.template:
     src: "etc/vim/vimrc.local.j2"
     dest: "/etc/vimrc.local"
     owner: "root"
-- 
GitLab