From 44ab2312fb06633a118057727c9eb0bd6c58ba71 Mon Sep 17 00:00:00 2001
From: Chris Croome <chris@webarchitects.co.uk>
Date: Sun, 26 Mar 2023 10:00:33 +0100
Subject: [PATCH] Ansible lint fixes

---
 tasks/apt.yml                 | 4 ++--
 tasks/check_init.yml          | 2 +-
 tasks/file_edited.yml         | 1 +
 tasks/file_section_edited.yml | 2 +-
 tasks/file_templated.yml      | 3 ++-
 5 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/tasks/apt.yml b/tasks/apt.yml
index 2b00ede..b197ffe 100644
--- a/tasks/apt.yml
+++ b/tasks/apt.yml
@@ -73,7 +73,7 @@
         group: root
       register: php_preferences
 
-    - name: Update apt cache
+    - name: Update apt cache  # noqa: no-handler
       ansible.builtin.apt:
         update_cache: true
         cache_valid_time: 60
@@ -102,7 +102,7 @@
         label: "{{ path | basename }}"
       register: php_repo_absent
 
-    - name: Update apt cache
+    - name: Update apt cache  # noqa: no-handler
       ansible.builtin.apt:
         update_cache: true
         cache_valid_time: 60
diff --git a/tasks/check_init.yml b/tasks/check_init.yml
index 200ffe8..5d67b97 100644
--- a/tasks/check_init.yml
+++ b/tasks/check_init.yml
@@ -32,7 +32,7 @@
     - name: Debug the ini system
       ansible.builtin.debug:
         var: php_init
-      verbosity: "{% if ansible_check_mode | bool %}0{% else %}1{% endif %}"
+        verbosity: "{% if ansible_check_mode | bool %}0{% else %}1{% endif %}"
 
   tags:
     - php
diff --git a/tasks/file_edited.yml b/tasks/file_edited.yml
index 264bf96..71be639 100644
--- a/tasks/file_edited.yml
+++ b/tasks/file_edited.yml
@@ -159,6 +159,7 @@
             state: reloaded
 
       when:
+        - php_init is defined
         - php_init == "systemd"
         - php_conf_file_version in php_ver_installed
         - php_conf_file_changed | bool
diff --git a/tasks/file_section_edited.yml b/tasks/file_section_edited.yml
index 85ecd71..5db5fcd 100644
--- a/tasks/file_section_edited.yml
+++ b/tasks/file_section_edited.yml
@@ -64,7 +64,7 @@
         loop_var: php_conf_variable_pair
       register: php_conf_file_edited
 
-    - name: Set a fact to indicate that the file has changed
+    - name: Set a fact to indicate that the file has changed  # noqa: no-handler
       ansible.builtin.set_fact:
         php_conf_file_changed: true
       when: (php_conf_file_comments_edited.changed ) or ( php_conf_file_edited.changed | bool )
diff --git a/tasks/file_templated.yml b/tasks/file_templated.yml
index 96f2677..d094573 100644
--- a/tasks/file_templated.yml
+++ b/tasks/file_templated.yml
@@ -113,6 +113,7 @@
             state: reloaded
 
       when:
+        - php_init is defined
         - php_init == "systemd"
         - php_conf_file_version is defined
         - php_conf_file_version in php_ver_installed
@@ -121,7 +122,7 @@
         - php_conf_file_sapi is defined
         - php_conf_file_sapi == "fpm"
 
-    - name: File backup absent when the PHP configuration file is unchanged
+    - name: File backup absent when the PHP configuration file is unchanged  # noqa: no-handler
       ansible.builtin.file:
         path: "{{ php_conf_file_backup }}"
         state: absent
-- 
GitLab