From 47d5211185691af7d423381d365b2dfa1cba2e75 Mon Sep 17 00:00:00 2001
From: Thomas Woerner <twoerner@redhat.com>
Date: Wed, 12 Apr 2023 13:08:12 +0200
Subject: [PATCH] utils/templates/test_module*.yml.in: Better docs for become
 and gather_facts

The documentation for "become" and "gather_facts" has been updated to
make sure that these parameters are enabled only in new tests if it is
really needed.
---
 utils/templates/test_module+member.yml.in         | 5 +++--
 utils/templates/test_module.yml.in                | 5 +++--
 utils/templates/test_module_client_context.yml.in | 5 +++--
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/utils/templates/test_module+member.yml.in b/utils/templates/test_module+member.yml.in
index cafbbf64..e92ac9f4 100644
--- a/utils/templates/test_module+member.yml.in
+++ b/utils/templates/test_module+member.yml.in
@@ -1,9 +1,10 @@
 ---
 - name: Test $name
   hosts: "{{ ipa_test_host | default('ipaserver') }}"
-  # Change "become" or "gather_facts" to "yes",
-  # if you test playbook requires any.
+  # It is normally not needed to set "become" to "true" for a module test.
+  # Only set it to true if it is needed to execute commands as root.
   become: false
+  # Enable "gather_facts" only if "ansible_facts" variable needs to be used.
   gather_facts: false
 
   tasks:
diff --git a/utils/templates/test_module.yml.in b/utils/templates/test_module.yml.in
index b7e82fbe..62e0a79b 100644
--- a/utils/templates/test_module.yml.in
+++ b/utils/templates/test_module.yml.in
@@ -1,9 +1,10 @@
 ---
 - name: Test $name
   hosts: "{{ ipa_test_host | default('ipaserver') }}"
-  # Change "become" or "gather_facts" to "yes",
-  # if you test playbook requires any.
+  # It is normally not needed to set "become" to "true" for a module test.
+  # Only set it to true if it is needed to execute commands as root.
   become: false
+  # Enable "gather_facts" only if "ansible_facts" variable needs to be used.
   gather_facts: false
 
   tasks:
diff --git a/utils/templates/test_module_client_context.yml.in b/utils/templates/test_module_client_context.yml.in
index 38ac7ffb..193cd6f3 100644
--- a/utils/templates/test_module_client_context.yml.in
+++ b/utils/templates/test_module_client_context.yml.in
@@ -1,9 +1,10 @@
 ---
 - name: Test ${name}
   hosts: ipaclients, ipaserver
-  # Change "become" or "gather_facts" to "yes",
-  # if you test playbook requires any.
+  # It is normally not needed to set "become" to "true" for a module test.
+  # Only set it to true if it is needed to execute commands as root.
   become: false
+  # Enable "gather_facts" only if "ansible_facts" variable needs to be used.
   gather_facts: false
 
   tasks:
-- 
GitLab