From 1fa1468b852f629104c6149a060a103bc89028b1 Mon Sep 17 00:00:00 2001
From: Thomas Woerner <twoerner@redhat.com>
Date: Thu, 11 Jul 2019 18:36:47 +0200
Subject: [PATCH] library/ipaclient_get_otp: Enable force mode for host_add
 call

When OTP is used for installation of a client or the client part of
a replica and also there is no DNS record for the client, then
ipaclient_get_otp fails in the host_add call.

With the force mode the host_add call will ignore the missing DNS
record and will properly add the host. The host information and also
the DNS record will be updated while deploying the client according
to the given settings.

Fixes: #74 (ipaclient fails when ipaclient_use_otp is true and client ..)
---
 roles/ipaclient/library/ipaclient_get_otp.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/roles/ipaclient/library/ipaclient_get_otp.py b/roles/ipaclient/library/ipaclient_get_otp.py
index 49fe40a0..3ec7541a 100644
--- a/roles/ipaclient/library/ipaclient_get_otp.py
+++ b/roles/ipaclient/library/ipaclient_get_otp.py
@@ -265,6 +265,8 @@ def ensure_host_present(module, api, ipahost):
 
         # Must add the user
         module_host = get_module_host(module)
+        # force creation of host even if there is no DNS record
+        module_host["force"] = True
         result = api.Command.host_add(fqdn, **module_host)
         # Save random password as it is not displayed by host-show
         if module.params.get('random'):
-- 
GitLab