Chapter 14. Removing the trust using Ansible
You can remove the Identity Management (IdM)/Active Directory (AD) trust on the IdM side by using an Ansible playbook.
Prerequisites
- You have obtained a Kerberos ticket as an IdM administrator. For details, see Logging in to IdM in the Web UI: Using a Kerberos ticket.
You have configured your Ansible control node to meet the following requirements:
- You are using Ansible version 2.15 or later.
-
You have installed the
freeipa.ansible_freeipa
collection. - The example assumes that in the ~/MyPlaybooks/ directory, you have created an Ansible inventory file with the fully-qualified domain name (FQDN) of the IdM server.
-
The example assumes that the secret.yml Ansible vault stores your
ipaadmin_password
and that you have access to a file that stores the password protecting the secret.yml file.
-
The target node, that is the node on which the
freeipa.ansible_freeipa
module is executed, is part of the IdM domain as an IdM client, server or replica.
Procedure
Navigate to your ~/MyPlaybooks/ directory:
cd ~/MyPlaybooks/
$ cd ~/MyPlaybooks/
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create an
del-trust.yml
playbook with the following content:Copy to Clipboard Copied! Toggle word wrap Toggle overflow In the example,
realm
defines the AD realm name string.- Save the file.
Run the Ansible playbook. Specify the playbook file, the file storing the password protecting the secret.yml file, and the inventory file:
ansible-playbook --vault-password-file=password_file -v -i inventory del-trust.yml
$ ansible-playbook --vault-password-file=password_file -v -i inventory del-trust.yml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteRemoving the trust configuration does not automatically remove the ID range IdM has created for AD users. This way, if you add the trust again, the existing ID range is re-used. Also, if AD users have created files on an IdM client, their POSIX IDs are preserved in the file metadata.
To remove all information related to an AD trust, remove the AD user ID range after removing the trust configuration and trust object:
ipa idrange-del AD.EXAMPLE.COM_id_range systemctl restart sssd
# ipa idrange-del AD.EXAMPLE.COM_id_range # systemctl restart sssd
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Use the
ipa trust-show
command to confirm that the trust has been removed.ipa trust-show ad.example.com
[root@server ~]# ipa trust-show ad.example.com ipa: ERROR: ad.example.com: trust not found
Copy to Clipboard Copied! Toggle word wrap Toggle overflow