From aa6c5c610bc0310960c12a7b05722e5ded078960 Mon Sep 17 00:00:00 2001 From: Rafael Guterres Jeffman <rjeffman@redhat.com> Date: Wed, 8 Sep 2021 17:16:48 -0300 Subject: [PATCH] tests: Create IPA fact ipa_host_is_client. This patch adds a new fact `ipa_host_is_client`, available in the include task file `env_freeipa_facts.yml`. The variable `ipa_host_is_client` is set to TRUE if the client host is not an IPA server (primary or replica). It can be used if a test cannot be executed in a server, independent of the value set to `ipaapi_context`. --- tests/env_freeipa_facts.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/env_freeipa_facts.yml b/tests/env_freeipa_facts.yml index 6622634d..a150ecd6 100644 --- a/tests/env_freeipa_facts.yml +++ b/tests/env_freeipa_facts.yml @@ -12,8 +12,20 @@ cmd: 'ipa --version | sed -n "s/VERSION: \([^,]*\).*API_VERSION: \([^,]*\).*/\1\\n\2/p"' register: ipa_cmd_version +- name: Verify if host is an IPA server or client. + shell: + cmd: | + echo SomeADMINpassword | kinit -c {{ KRB5CCNAME }} admin + RESULT=$(KRB5CCNAME={{ KRB5CCNAME }} ipa server-show `hostname` && echo SERVER || echo CLIENT) + kdestroy -A -c {{ KRB5CCNAME }} + echo $RESULT + vars: + KRB5CCNAME: "__check_ipa_host_is_client_or_server__" + register: output + - name: Set FreeIPA facts. set_fact: ipa_version: "{{ ipa_cmd_version.stdout_lines[0] }}" ipa_api_version: "{{ ipa_cmd_version.stdout_lines[1] }}" + ipa_host_is_client: "{{ (output.stdout_lines[-1] == 'CLIENT') | bool }}" trust_test_is_supported: no -- GitLab