Bookmark this page

Guided Exercise: Automating an Identity Management Installation

Install an IdM server, a client, and a replica by using Ansible Playbooks.

Outcomes

  • Install an IdM server, client, and replica by using Ansible Playbooks.

Important

Ensure that you recreate your classroom environment before starting the IdM installation with the Ansible method. The IdM installation process requires clean systems to work properly.

As the student user on the workstation machine, use the lab command to prepare your environment for this exercise, and to ensure that all required resources are available.

[student@workstation ~]$ lab start install-ansible

Instructions

  1. Install the ansible-freeipa package. Review the roles and playbooks to install IdM.

    1. Review the available repositories in your subscription.

      [student@workstation ~]$ sudo dnf repolist
      ...output omitted...
      repo id                               repo name
      rhel-9.1-for-x86_64-appstream-rpms    Red Hat Enterprise Linux 9.1 AppStream (dvd)
      rhel-9.1-for-x86_64-baseos-rpms       Red Hat Enterprise Linux 9.1 BaseOS (dvd)
    2. Install the ansible-freeipa package.

      [student@workstation ~]$ sudo dnf install ansible-freeipa
      ...output omitted...
    3. Review the installed roles in the /usr/share/ansible/roles/ directory.

      [student@workstation ~]$ ls -ld /usr/share/ansible/roles/ipa*
      drwxr-xr-x. 7 root root  91 Apr  5 15:26 /usr/share/ansible/roles/ipabackup
      drwxr-xr-x. 9 root root 133 Apr  5 15:26 /usr/share/ansible/roles/ipaclient
      drwxr-xr-x. 8 root root 111 Apr  5 15:26 /usr/share/ansible/roles/ipareplica
      drwxr-xr-x. 8 root root 111 Apr  5 15:26 /usr/share/ansible/roles/ipaserver
      ...output omitted...
  2. Create the hosts inventory file in the student home directory and add the idm machine as a member of the ipaserver host group. Add the variables to install IdM according to the following parameters:

    ParameterValue
    Domain lab.example.com
    Realm LAB.EXAMPLE.COM
    DNS forwarder 172.25.250.254
    CA serviceIntegrated
    Admin password RedHat123^

    Note

    If your classroom environment does not have Internet connectivity, then do not configure DNS forwarders during IdM server or replica installation. You can use the ipaserver_no_forwarders=true parameter to avoid the configuration of DNS forwarders. The following example tests if your classroom has Internet connectivity by querying a public DNS server:

    [student@workstation ~]$ dig @8.8.8.8 A www.google.com
    1. Create the hosts inventory file and add the idm machine to the ipaserver host group. Add the ansible_become_password variable to the idm machine to set the student user password.

      [ipaserver]
      idm.lab.example.com ansible_become_password=student
    2. Add the variables to the ipaserver host group in the hosts inventory file to customize the IdM installation.

      ...output omitted...
      
      [ipaserver:vars]
      ipaserver_domain=lab.example.com
      ipaserver_realm=LAB.EXAMPLE.COM
      ipaserver_setup_dns=yes
      ipaserver_forwarders=172.25.250.254
      ipaadmin_password=RedHat123^
      ipadm_password=RedHat123^

      Note

      The integrated CA is installed by default. You do not need to explicitly specify it.

  3. Install the IdM server by using Ansible Playbooks.

    1. Copy the /usr/share/doc/ansible-freeipa/playbooks/install-server.yml playbook template to the student home directory.

      [student@workstation ~]$ cp \
        /usr/share/doc/ansible-freeipa/playbooks/install-server.yml ~/
    2. Run the install-server.yml Ansible Playbook. Use the hosts file as the inventory.

      This playbook might take several minutes to complete.

      Note

      If the installation fails, update the hosts file and ensure it has the correct values. Uninstall the failed server by using the uninstall-server.yml playbook and reboot the target machine before attempting to reinstall.

      [student@workstation ~]$ ansible-playbook install-server.yml -i hosts
      ...output omitted...
      TASK [ipaserver : Cleanup temporary files] ***********************************
      ok: [idm.lab.example.com] => (item=/etc/ipa/.tmp_pkcs12_dirsrv)
      ok: [idm.lab.example.com] => (item=/etc/ipa/.tmp_pkcs12_http)
      ok: [idm.lab.example.com] => (item=/etc/ipa/.tmp_pkcs12_pkinit)
      
      TASK [ipaserver : Uninstall IPA server] **************************************
      skipping: [idm.lab.example.com]
      
      PLAY RECAP *******************************************************************
      idm.lab.example.com    : ok=41  changed=21  unreachable=0  failed=0  skipped=32
      rescued=0  ignored=0
    3. Verify that you can authenticate to IdM as the admin user.

      [student@workstation ~]$ ssh idm
      [student@idm ~]$ kinit admin
      Password for admin@LAB.EXAMPLE.COM: RedHat123^
    4. Verify the characteristics of the IdM installation.

      Review the domain name, the IdM server roles, and the installed services.

      [student@idm ~]$ ipa realmdomains-show
        Domain: lab.example.com
      [student@idm ~]$ ipa server-show idm.lab.example.com
        Server name: idm.lab.example.com
      ...output omitted...
        Enabled server roles: CA server, DNS server, IPA master
      [student@idm ~]$ sudo ipactl status
      [sudo] password for student: student
      Directory Service: RUNNING
      krb5kdc Service: RUNNING
      kadmin Service: RUNNING
      named Service: RUNNING
      httpd Service: RUNNING
      ipa-custodia Service: RUNNING
      pki-tomcatd Service: RUNNING
      ...output omitted...
    5. Log out of the idm machine.

      [student@idm ~]$ logout
      Connection to idm closed.
      [student@workstation ~]$
  4. Install an IdM client by using Ansible Playbooks.

    1. Update the hosts inventory file to add the client machine. Provide the admin principal password to install the client.

      ...output omitted...
      
      [ipaclients]
      client.lab.example.com ansible_become_password=student
      
      [ipaclients:vars]
      ipaadmin_principal=admin
      ipaadmin_password=RedHat123^
      ipaclient_domain=lab.example.com
    2. Copy the /usr/share/doc/ansible-freeipa/playbooks/install-client.yml playbook template to the student home directory.

      [student@workstation ~]$ cp \
        /usr/share/doc/ansible-freeipa/playbooks/install-client.yml ~/
    3. Run the install-client.yml Ansible Playbook. Use the hosts file as the inventory.

      Wait for the playbook to complete.

      [student@workstation ~]$ ansible-playbook install-client.yml -i hosts
      ...output omitted...
      TASK [ipaclient : Uninstall IPA client] **************************************
      skipping: [client.lab.example.com]
      
      PLAY RECAP *******************************************************************
      client.lab.example.com  : ok=19  changed=12  unreachable=0  failed=0  skipped=22
      rescued=0  ignored=0
    4. Verify that you can see the new client from the IdM server.

      [student@workstation ~]$ ssh idm
      [student@idm ~]$ kinit admin
      Password for admin@LAB.EXAMPLE.COM: RedHat123^
      [student@idm ~]$ ipa host-find
      ---------------
      2 hosts matched
      ---------------
        Host name: client.lab.example.com
      ...output omitted...
      ----------------------------
      Number of entries returned 2
      ----------------------------
    5. Log out of the idm machine.

      [student@idm ~]$ logout
      Connection to idm closed.
      [student@workstation ~]$
  5. Install an IdM replica by using Ansible Playbooks. Install the DNS service and set 172.25.250.254 as the DNS forwarder.

    1. Update the hosts inventory file to add the replica1 machine entry. Provide the admin principal and password to install the replica.

      ...output omitted...
      
      [ipareplicas]
      replica1.lab.example.com ansible_become_password=student
      
      [ipareplicas:vars]
      ipareplica_setup_dns=yes
      ipareplica_forwarders=172.25.250.254
      ipaadmin_principal=admin
      ipaadmin_password=RedHat123^
    2. Copy the /usr/share/doc/ansible-freeipa/playbooks/install-replica.yml playbook template to the student home directory.

      [student@workstation ~]$ cp \
        /usr/share/doc/ansible-freeipa/playbooks/install-replica.yml ~/
    3. Install the replica1 machine.

      [student@workstation ~]$ ansible-playbook install-replica.yml -i hosts
      
      PLAY [Playbook to configure IPA replicas] ************************************
      ...output omitted...
      
      TASK [ipareplica : Uninstall IPA replica] ************************************
      skipping: [replica1.lab.example.com]
      
      PLAY RECAP *******************************************************************
      replica1.lab.example.com : ok=56  changed=38  unreachable=0  failed=0  skipped=28
      rescued=0  ignored=0
    4. Log in to the idm machine and verify that you can see the new replica and list the services that it provides.

      [student@workstation ~]$ ssh idm
      [student@idm ~]$ kinit admin
      Password for admin@LAB.EXAMPLE.COM: RedHat123^
      [student@idm ~]$ ipa server-find
      ...output omitted...
        Server name: replica1.lab.example.com
        Min domain level: 1
        Max domain level: 1
      ----------------------------
      Number of entries returned 2
      ----------------------------
      [student@idm ~]$ ipa server-show replica1.lab.example.com
        Server name: replica1.lab.example.com
      ...output omitted...
        Enabled server roles: DNS server, IPA master
    5. Log out of the idm machine.

      [student@idm ~]$ logout
      Connection to idm closed.
      [student@workstation ~]$

Finish

On the workstation machine, use the lab command to complete this exercise. This step is important to ensure that resources from previous exercises do not impact upcoming exercises.

[student@workstation ~]$ lab finish install-ansible

Revision: rh362-9.1-4c6fdb8