From e38c34974dd40fb4b13c6eb2deb5338b0d8efea3 Mon Sep 17 00:00:00 2001
From: Rafael Guterres Jeffman <rjeffman@redhat.com>
Date: Fri, 23 Jul 2021 15:44:08 -0300
Subject: [PATCH] templates: Use `become: no` in playbooks by default.

ansible-freeipa modules should work without superuser privileges in
most cases, and to reflect this, the module tests should avoid using
`become: yes`.

This PR change the test playbook templates to use `become: no` by
default, so only modules that require superuser privileges will need
to change this variable.
---
 utils/templates/README-module+member.md.in   | 8 ++++----
 utils/templates/README-module.md.in          | 4 ++--
 utils/templates/module-absent.yml.in         | 2 +-
 utils/templates/module-member-absent.yml.in  | 2 +-
 utils/templates/module-member-present.yml.in | 2 +-
 utils/templates/module-present.yml.in        | 2 +-
 utils/templates/test_module+member.yml.in    | 2 +-
 utils/templates/test_module.yml.in           | 2 +-
 8 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/utils/templates/README-module+member.md.in b/utils/templates/README-module+member.md.in
index ff362be6..026496b3 100644
--- a/utils/templates/README-module+member.md.in
+++ b/utils/templates/README-module+member.md.in
@@ -45,7 +45,7 @@ Example playbook to make sure $name "NAME" is present:
 ---
 - name: Playbook to manage IPA $name.
   hosts: ipaserver
-  become: yes
+  become: no
 
   tasks:
   - ipa$name:
@@ -60,7 +60,7 @@ Example playbook to make sure $name "NAME" member PARAMETER2 VALUE is present:
 ---
 - name: Playbook to manage IPA $name PARAMETER2 member.
   hosts: ipaserver
-  become: yes
+  become: no
 
   tasks:
   - ipa$name:
@@ -78,7 +78,7 @@ Example playbook to make sure $name "NAME" member PARAMETER2 VALUE is absent:
 ---
 - name: Playbook to manage IPA $name PARAMETER2 member.
   hosts: ipaserver
-  become: yes
+  become: no
 
   tasks:
   - ipa$name:
@@ -96,7 +96,7 @@ Example playbook to make sure $name "NAME" is absent:
 ---
 - name: Playbook to manage IPA $name.
   hosts: ipaserver
-  become: yes
+  become: no
 
   tasks:
   - ipa$name:
diff --git a/utils/templates/README-module.md.in b/utils/templates/README-module.md.in
index b57b0c7f..e5054fb2 100644
--- a/utils/templates/README-module.md.in
+++ b/utils/templates/README-module.md.in
@@ -45,7 +45,7 @@ Example playbook to make sure $name "NAME" is present:
 ---
 - name: Playbook to manage IPA $name.
   hosts: ipaserver
-  become: yes
+  become: no
 
   tasks:
   - ipa$name:
@@ -61,7 +61,7 @@ Example playbook to make sure $name "NAME" is absent:
 ---
 - name: Playbook to manage IPA $name.
   hosts: ipaserver
-  become: yes
+  become: no
 
   tasks:
   - ipa$name:
diff --git a/utils/templates/module-absent.yml.in b/utils/templates/module-absent.yml.in
index b18a8d01..756b0b4f 100644
--- a/utils/templates/module-absent.yml.in
+++ b/utils/templates/module-absent.yml.in
@@ -1,7 +1,7 @@
 ---
 - name: ${name^} absent example
   hosts: ipaserver
-  become: true
+  become: no
 
   tasks:
   - name: Ensure $name NAME is absent
diff --git a/utils/templates/module-member-absent.yml.in b/utils/templates/module-member-absent.yml.in
index 9ed0ad5d..5383ac06 100644
--- a/utils/templates/module-member-absent.yml.in
+++ b/utils/templates/module-member-absent.yml.in
@@ -1,7 +1,7 @@
 ---
 - name: ${name^} absent example
   hosts: ipaserver
-  become: true
+  become: no
 
   tasks:
   - name: Ensure $name NAME is absent
diff --git a/utils/templates/module-member-present.yml.in b/utils/templates/module-member-present.yml.in
index 3ca5d763..ccb31264 100644
--- a/utils/templates/module-member-present.yml.in
+++ b/utils/templates/module-member-present.yml.in
@@ -1,7 +1,7 @@
 ---
 - name: ${name^} member present example
   hosts: ipaserver
-  become: true
+  become: no
 
   tasks:
   - name: Ensure $name NAME is present
diff --git a/utils/templates/module-present.yml.in b/utils/templates/module-present.yml.in
index 97654933..f8a5c2d4 100644
--- a/utils/templates/module-present.yml.in
+++ b/utils/templates/module-present.yml.in
@@ -1,7 +1,7 @@
 ---
 - name: ${name^} present example
   hosts: ipaserver
-  become: true
+  become: no
 
   tasks:
   - name: Ensure $name NAME is present
diff --git a/utils/templates/test_module+member.yml.in b/utils/templates/test_module+member.yml.in
index 3191a568..f7c5b3d5 100644
--- a/utils/templates/test_module+member.yml.in
+++ b/utils/templates/test_module+member.yml.in
@@ -1,7 +1,7 @@
 ---
 - name: Test $name
   hosts: ipaserver
-  become: true
+  become: no
 
   tasks:
 
diff --git a/utils/templates/test_module.yml.in b/utils/templates/test_module.yml.in
index a565aa72..0286813b 100644
--- a/utils/templates/test_module.yml.in
+++ b/utils/templates/test_module.yml.in
@@ -1,7 +1,7 @@
 ---
 - name: Test $name
   hosts: ipaserver
-  become: true
+  become: no
 
   tasks:
 
-- 
GitLab