From 78b5e66da46d21ee1c0c7689e5e2ebd8ad48cbf6 Mon Sep 17 00:00:00 2001
From: Denis Karpelevich <dkarpele@redhat.com>
Date: Mon, 20 Feb 2023 21:30:32 +0100
Subject: [PATCH] Update `EXAMPLE` sections for multiuser and multihost
 handling.

Signed-off-by: Denis Karpelevich <dkarpele@redhat.com>
---
 plugins/modules/ipahost.py | 21 +++++++++++++++++++++
 plugins/modules/ipauser.py | 19 +++++++++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/plugins/modules/ipahost.py b/plugins/modules/ipahost.py
index ea388e80..94ef2eea 100644
--- a/plugins/modules/ipahost.py
+++ b/plugins/modules/ipahost.py
@@ -441,6 +441,15 @@ EXAMPLES = """
     description: Example host
     force: yes
 
+# Ensure multiple hosts are present with random passwords
+- ipahost:
+    ipaadmin_password: SomeADMINpassword
+    hosts:
+    - name: host01.example.com
+      random: yes
+    - name: host02.example.com
+      random: yes
+
 # Initiate generation of a random password for the host
 - ipahost:
     ipaadmin_password: SomeADMINpassword
@@ -449,6 +458,18 @@ EXAMPLES = """
     ip_address: 192.168.0.123
     random: yes
 
+# Ensure multiple hosts are present with principals
+- ipahost:
+    ipaadmin_password: SomeADMINpassword
+    hosts:
+    - name: host01.example.com
+      principal:
+      - host/testhost01.example.com
+    - name: host02.example.com
+      principal:
+      - host/myhost01.example.com
+    action: member
+
 # Ensure host is disabled
 - ipahost:
     ipaadmin_password: SomeADMINpassword
diff --git a/plugins/modules/ipauser.py b/plugins/modules/ipauser.py
index 2d928f8e..c61b9682 100644
--- a/plugins/modules/ipauser.py
+++ b/plugins/modules/ipauser.py
@@ -548,6 +548,17 @@ EXAMPLES = """
     first: brain
     last: Acme
 
+# Create multiple users pinky and brain
+- ipauser:
+    ipaadmin_password: SomeADMINpassword
+    users:
+    - name: pinky
+      first: pinky
+      last: Acme
+    - name: brain
+      first: brain
+      last: Acme
+
 # Delete user pinky, but preserved
 - ipauser:
     ipaadmin_password: SomeADMINpassword
@@ -573,6 +584,14 @@ EXAMPLES = """
     name: pinky,brain
     state: enabled
 
+# Remove but preserve user pinky
+- ipauser:
+    ipaadmin_password: SomeADMINpassword
+    users:
+    - name: pinky
+    preserve: yes
+    state: absent
+
 # Remove user pinky and brain
 - ipauser:
     ipaadmin_password: SomeADMINpassword
-- 
GitLab