Questo contenuto non è disponibile nella lingua selezionata.
Chapter 14. Installing RHEL Identity Management in a controlled environment
Learn how to install a basic Identity Management (IdM) in RHEL environment for testing prior to production deployment. You install the software using an Ansible playbook, which ensures convenience and repeatability.
Prerequisites
- A system running Red Hat Enterprise Linux (RHEL) with 16 GB of RAM or more.
- A RHEL subscription.
Terminology and assumptions
-
rootis the account on the managed nodes that is used to perform the actions defined in the Ansible playbooks. - controller.idm.example.com is the name of the Ansible control node, that is the host on which the Ansible playbooks are stored and run.
- server.idm.example.com, replica.idm.example.com, and client.idm.example.com are the managed nodes on which Identity Management in RHEL is installed and configured.
- The control node and the managed nodes are running on virtual machines. All these virtual machines are installed on one physical system that runs RHEL.
14.1. Installing RHEL on virtual machines for IdM as a proof of concept Copia collegamentoCollegamento copiato negli appunti!
Learn how to install RHEL on your virtual machines so that you can later install an IdM cluster on them using the ansible-freeipa RPM collection.
Prerequisites
- You have downloaded the latest ISO image of RHEL 8, 9 or 10 from the Red Hat Customer Portal.
Procedure
Use the ISO image to install a new VM for the controller system. For details, see Interactively installing RHEL from installation media. During the installation, pay attention to the following:
- If you are using the Virtual Machine Manager (VMM) to install your VMs, name the hosts in the controller, server, replica, and client, so that you can match the names in the VMM UI to the names of the hosts on the CLI.
- Reserve at least 4 GB of RAM on the VMs on which you are installing an IdM server and replica. 1 GB is enough for a client system.
- Reserve 20 GB for the storage on the IdM server and IdM replica.
- Select Install, not Test and Install.
-
Create a local
ansibleuser on the controller during the installation. -
Set an easy-to-remember password for the
ansibleuser, for example 12345. - In the Root password section, enter an easy-to-remember password, for example 1234.
-
Check the
Allow root SSH login with passwordcheck box.
After the installation is complete, configure the host name for the controller VM:
-
On the controller VM CLI, enter
nmtui. - Using the Down Arrow key, select Set system hostname.
In the newly opened window, enter controller.idm.example.com.
The host name must be a fully qualified domain name, such as controller.idm.example.com. For more information, see Meeting DNS host name and DNS requirements for IdM in Installing Identity Management.
-
Using the Down and Right Arrow keys, select
OK. -
Confirm the new host name by clicking
OKagain. -
In the higher-level interface, select
OKandQuitby using the Down and Right Arrow keys. [Optional] To verify the host name, use the
hostnameutility on the system:hostname
# hostnameCopy to Clipboard Copied! Toggle word wrap Toggle overflow controller.idm.example.com
controller.idm.example.comCopy to Clipboard Copied! Toggle word wrap Toggle overflow The output of
hostnamemust not belocalhostorlocalhost6.
-
On the controller VM CLI, enter
- Repeat the previous steps for all the other VMs: server, replica, and client.
Configure reciprocal logins to individual systems using host names instead of IP addresses:
On the controller CLI, enter:
ip a
# ip aCopy to Clipboard Copied! Toggle word wrap Toggle overflow Copy to Clipboard Copied! Toggle word wrap Toggle overflow Note the IP address that starts with 192.168.X.X.
- Do the same on all the other virtual hosts.
On controller, add the host names and IP addresses of all the virtual systems to
/etc/hostsfile. The file can look as follows:Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Update the
/etc/hostsfile on your physical system in the same way.
Ensure that the operating system on controller is up to date:
SSH from your local system to the
rootaccount on controller:your-physical-system]$ ssh root@controller
your-physical-system]$ ssh root@controllerCopy to Clipboard Copied! Toggle word wrap Toggle overflow Register the controller virtual machine with Red Hat’s subscription management service:
subscription-manager register --username <your_user_name> --password <your_password>
# subscription-manager register --username <your_user_name> --password <your_password>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Ensure that you are using the latest packages:
yum update
# yum updateCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Repeat the previous steps for all the other VMs.
Verification
Test connectivity between your physical system and one of the virtual systems by using its fully-qualified domain name (
FQDN) or short name:your-physical-system]$ ping controller
your-physical-system]$ ping controllerCopy to Clipboard Copied! Toggle word wrap Toggle overflow PING controller.idm.example.com (192.168.122.86) 56(84) bytes of data. 64 bytes from controller.idm.example.com (192.168.122.86): icmp_seq=1 ttl=64 time=0.353 ms 64 bytes from controller.idm.example.com (192.168.122.86): icmp_seq=2 ttl=64 time=0.398 ms 64 bytes from controller.idm.example.com (192.168.122.86): icmp_seq=3 ttl=64 time=0.453 ms
PING controller.idm.example.com (192.168.122.86) 56(84) bytes of data. 64 bytes from controller.idm.example.com (192.168.122.86): icmp_seq=1 ttl=64 time=0.353 ms 64 bytes from controller.idm.example.com (192.168.122.86): icmp_seq=2 ttl=64 time=0.398 ms 64 bytes from controller.idm.example.com (192.168.122.86): icmp_seq=3 ttl=64 time=0.453 msCopy to Clipboard Copied! Toggle word wrap Toggle overflow
14.2. Preparing the control node for installing IdM using Ansible playbooks Copia collegamentoCollegamento copiato negli appunti!
Learn how to prepare the Ansible control node for installing and configuring IdM on the managed nodes.
Prerequisites
Procedure
On the controller system, create an
SSHpublic and private key:ssh-keygen
[ansible@controller]$ ssh-keygenCopy to Clipboard Copied! Toggle word wrap Toggle overflow Generating public/private rsa key pair. Enter file in which to save the key (/home/ansible/.ssh/id_rsa): Enter passphrase (empty for no passphrase): [Enter] Enter same passphrase again: [Enter] ...
Generating public/private rsa key pair. Enter file in which to save the key (/home/ansible/.ssh/id_rsa): Enter passphrase (empty for no passphrase): [Enter] Enter same passphrase again: [Enter] ...Copy to Clipboard Copied! Toggle word wrap Toggle overflow Use the suggested default location for the key file. As this is a PoC environment, leave the passphrase empty.
Create the
~/.ansible.cfgfile with the following content:[defaults] inventory = /home/ansible/inventory remote_user = root
[defaults] inventory = /home/ansible/inventory remote_user = rootCopy to Clipboard Copied! Toggle word wrap Toggle overflow NoteSettings in the
~/.ansible.cfgfile have a higher priority and override settings from the global/etc/ansible/ansible.cfgfile.With these settings, Ansible performs the following actions:
- Manages hosts in the specified inventory file.
-
Uses the account set in the
remote_userparameter when it establishesSSHconnections to managed nodes.
Create an
~/inventoryfile in INI or YAML format that lists the host names of managed hosts and the values for the required installation variables:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create an
install-cluster.ymlfile with the following content:Copy to Clipboard Copied! Toggle word wrap Toggle overflow The playbook contains three plays:
- The first one installs the primary IdM server.
- The second one installs an IdM client.
-
The third one installs an IdM replica. The
serial: 1directive instructs Ansible to deploy only one replica at a time against the same IdM server.
Using
rootprivileges, install theansible-freeipacollection:dnf install ansible-freeipa
[root@controller]# dnf install ansible-freeipaCopy to Clipboard Copied! Toggle word wrap Toggle overflow Copy to Clipboard Copied! Toggle word wrap Toggle overflow
14.3. Preparing the managed nodes for installing IdM using Ansible playbooks Copia collegamentoCollegamento copiato negli appunti!
Learn how to prepare your virtual machines as Ansible managed nodes so that they can be used for the installation of an IdM deployment.
Prerequisites
Procedure
Install the
rootuser’sSSHpublic key on to therootaccount on the server managed node:Log in to the control node as
root, and copy theSSHpublic key to therootaccount on server:ssh-copy-id root@server.idm.example.com
[root@controller]$ ssh-copy-id root@server.idm.example.comCopy to Clipboard Copied! Toggle word wrap Toggle overflow /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/ansible/.ssh/id_rsa.pub" The authenticity of host 'server.idm.example.com (192.168.122.42)' can't be established. ECDSA key fingerprint is SHA256:9bZ33GJNODK3zbNhybokN/6Mq7hu3vpBXDrCxe7NAvo.
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/ansible/.ssh/id_rsa.pub" The authenticity of host 'server.idm.example.com (192.168.122.42)' can't be established. ECDSA key fingerprint is SHA256:9bZ33GJNODK3zbNhybokN/6Mq7hu3vpBXDrCxe7NAvo.Copy to Clipboard Copied! Toggle word wrap Toggle overflow When prompted, connect by entering yes:
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Are you sure you want to continue connecting (yes/no/[fingerprint])? yesCopy to Clipboard Copied! Toggle word wrap Toggle overflow /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed /usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed /usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keysCopy to Clipboard Copied! Toggle word wrap Toggle overflow When prompted, enter the password of
rooton server:root@server.idm.example.com's password: 1234
root@server.idm.example.com's password: 1234Copy to Clipboard Copied! Toggle word wrap Toggle overflow Number of key(s) added: 1 Now try logging into the machine, with: "ssh 'root@server.idm.example.com'" and check to make sure that only the key(s) you wanted were added.
Number of key(s) added: 1 Now try logging into the machine, with: "ssh 'root@server.idm.example.com'" and check to make sure that only the key(s) you wanted were added.Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify the
SSHconnection by remotely executing a command on server:ssh root@server.idm.example.com whoami
[root@controller]$ ssh root@server.idm.example.com whoamiCopy to Clipboard Copied! Toggle word wrap Toggle overflow root
rootCopy to Clipboard Copied! Toggle word wrap Toggle overflow
- Repeat on all the other managed nodes, replica and client.
Verification
Verify that you can execute commands from the control node on an all managed nodes:
ansible all -m ping
[root@controller]$ ansible all -m pingCopy to Clipboard Copied! Toggle word wrap Toggle overflow Copy to Clipboard Copied! Toggle word wrap Toggle overflow The hard-coded all group dynamically contains all hosts listed in the inventory file.
Verify that privilege escalation works correctly. Use the Ansible
commandmodule to run thewhoamiutility on all managed nodes:ansible all -m command -a whoami
[root@controller]$ ansible all -m command -a whoamiCopy to Clipboard Copied! Toggle word wrap Toggle overflow Copy to Clipboard Copied! Toggle word wrap Toggle overflow If the command returns
root, you configuredsudoon the managed nodes correctly.
14.4. Installing an IdM cluster in a virtual machine Copia collegamentoCollegamento copiato negli appunti!
Learn how to install the IdM primary server, client and replica on your virtual machines by using a single Ansible command on the control node.
Prerequisites
Procedure
Install the IdM cluster:
ansible-playbook -i inventory -vv install-cluster.yml
[root@controller]$ ansible-playbook -i inventory -vv install-cluster.ymlCopy to Clipboard Copied! Toggle word wrap Toggle overflow
If you encounter recurring errors when installing the server, client, or replica, it’s best to wipe the host and perform a clean reinstallation rather than attempt to troubleshoot a failed setup.