From 3d32a1d6035312f6df9194118b20b37ca81fd0aa Mon Sep 17 00:00:00 2001 From: Antonio Torres Date: Tue, 12 Dec 2023 10:59:38 +0100 Subject: [PATCH] ansible config: set private key explicitly Apart from adding the SSH private key to the SSH arguments, we need to set the `private_key_file` option in ansible.cfg. Signed-off-by: Antonio Torres --- src/ipaperftest/core/constants.py | 1 + src/ipaperftest/core/plugin.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ipaperftest/core/constants.py b/src/ipaperftest/core/constants.py index 7a2f298..ab8887b 100644 --- a/src/ipaperftest/core/constants.py +++ b/src/ipaperftest/core/constants.py @@ -156,6 +156,7 @@ def getLevelName(level): remote_user = root host_key_checking = False deprecation_warnings = False +private_key_file = {private_key_path} roles_path = {cwd}/ansible-freeipa/roles library = {cwd}/ansible-freeipa/plugins/modules module_utils = {cwd}/ansible-freeipa/plugins/module_utils diff --git a/src/ipaperftest/core/plugin.py b/src/ipaperftest/core/plugin.py index f4133f1..09add7b 100644 --- a/src/ipaperftest/core/plugin.py +++ b/src/ipaperftest/core/plugin.py @@ -153,7 +153,7 @@ def clone_ansible_freeipa(self, ctx): with open("runner_metadata/ansible.cfg", "w") as f: f.write(ANSIBLE_CFG_TEMPLATE.format( cwd=os.path.join(os.getcwd(), "runner_metadata"), - private_key_path=ctx.params["private_key"], + private_key_path=ctx.params["private_key"] or self.provider.default_private_key, default_private_key_path=self.provider.default_private_key ) )