Enable the EPEL Repository with Oracle Linux Automation Engine

Note: The EPEL repository is not officially supported and is not part of the Product Documentation for any Oracle product or service.


This tutorial provides a playbook for automating the addition of a software repository to an Oracle Linux instance using the configuration management tool Oracle Linux Automation Engine.


In this lab, you’ll learn about writing and running a playbook that:

What Do You Need?

Additional Information

Note: When using the free lab environment, see Oracle Linux Lab Basics for connection and other usage instructions.

Information: The free lab environment deploys an Oracle Linux on the provided nodes. This deployment takes approximately 5 minutes to finish after launch. Therefore, you might want to step away while this runs and then return to complete the lab.

Before proceeding: If you are unfamiliar with running playbooks, check out our introduction tutorial, Write a Playbook with Oracle Linux Automation Engine. This tutorial follows on from this tutorial, Automate Setup of Oracle Linux.

This tutorial’s project uses a variable file containing key-value pairs and the actual playbook. The playbook includes the variable file, where its values become part of the plays when running tasks.

Oracle Linux Automation Engine allows defining variables in several locations, each having an order of precedence. For this tutorial, we’ll use a playbook vars_file directive.

Why Add a Repository?

Oracle Linux provides a secure, scalable, and reliable platform where you can deploy your mission-critical applications. Adding an extra repository is used to install a new Oracle product or a third-party application. Oracle Linux provides supplemental packages that handle the provisioning of these additional repositories.

The Oracle Linux YUM server provides details of the many different repositories Oracle provides. However, covering each of these is beyond the scope of this tutorial.

This tutorial will show how to enable the EPEL repository, then download htop to monitor your system. (Note: The htop tool is not available in the default repositories that ship with Oracle Linux.)

Update the Playbook

From a terminal on the Oracle Linux Automation Engine Control Node:

  1. Open a terminal and connect via SSH to the ol-control-node.

    ssh oracle@<ip_address_of_ol-control-node>
  2. Change to the working directory.

    cd ~/ol-setup-playbook

    This directory stores the playbook and other files associated with this project.

    Note: This directory already exists when using the free lab environment or if continuing from the steps provided in the base tutorial. If the directory does not exist, complete the base tutorial steps before proceeding.

  3. Add the following to the playbook file.

    cat << EOF | tee -a setup-playbook.yml > /dev/null
      - name: Add the EPEL repository
          name: oracle-epel-release-el8
          state: present
          - ansible_distribution == 'OracleLinux'
          - ansible_facts['distribution_major_version'] == '8'
      - name: Install the htop utility package
          name: htop
          enablerepo: ol8_developer_EPEL
          state: present
          - ansible_distribution == 'OracleLinux'
          - ansible_facts['distribution_major_version'] == '8'

    This playbook adds two tasks within the defined play. The first adds the EPEL repository to the existing software repositories on the Oracle Linux instance. Meanwhile, the second play installs the htop package onto the same target host instance.

    As mentioned in an earlier tutorial, a playbook and the names of the modules aim to make the playbook self-documenting. The information below will explain a few items further.

    • hosts: all: This line specifies which hosts or groups from the inventory that a play runs the set of tasks. The all establishes that the tasks within the play will run against all hosts and groups within the designated inventory.
    • become: yes: Instructs the tasks within this playbook to run with the sudo privilege by default.
    • state: present: Ensures the referenced package is already on the system or gets installed using dnf.
    • enablerepo: Enables the specific repository (if disabled) only for the duration of the current task.

Verify the Inventory

  1. Test the connection with the ad-hoc ping command.

    ansible ol-node01 -i inventory -m ping -u opc
    • -u: Passes the username for the ssh connection. In the free lab environment, we use the opc user, the default user provided on Oracle Linux instances in Oracle Cloud Infrastructure (OCI).

    The command connects successfully, reporting back SUCCESS with the ping key having a value of pong.

    NOTE: Invoking a playbook against a remote host is run over an SSH connection. The output displays the challenge response for the remote host’s SSH public key that occurs the first time making a connection. This message does not appear on subsequent connections as the remote host gets added to the local users known_hosts file and stored on a hostname or IP address basis.

Run the Playbook

  1. Run the playbook to perform the additional tasks.

    ansible-playbook -i inventory setup-playbook.yml -u opc

    The playbook finishes successfully, showing a few WARNINGS that we can ignore. The playbook reports properly completed tasks with an ok or changed status. The changed status indicates that the playbook modified the host by adding the htop package; or updated the dnf cache when requesting the latest version of a package rather than just checking if it is present. An ok indicates the completion of the task and requires no action.

    Example Output:

    [oracle@ol-control-node ol-setup-playbook]$ ansible-playbook -i inventory setup-playbook.yml -u opc
    PLAY [Playbook to setup Oracle Linux] ******************************************
    TASK [Gathering Facts] *********************************************************
    [WARNING]: Platform linux on host ol-node01 is using the discovered Python
    interpreter at /usr/bin/python3.6, but future installation of another Python
    interpreter could change the meaning of that path. See
    core/2.15/reference_appendices/interpreter_discovery.html for more information.
    ok: [ol-node01]
    TASK [Add user account with access to sudo] ************************************
    [DEPRECATION WARNING]: Encryption using the Python crypt module is deprecated. 
    The Python crypt module is deprecated and will be removed from Python 3.13. 
    Install the passlib library for continued encryption functionality. This 
    feature will be removed in version 2.17. Deprecation warnings can be disabled 
    by setting deprecation_warnings=False in ansible.cfg.
    ok: [ol-node01]
    TASK [Set authorized key for user using local public key file] *****************
    changed: [ol-node01]
    TASK [Install additional packages] *********************************************
    ok: [ol-node01]
    TASK [Add the EPEL repository] *************************************************
    ok: [ol-node01]
    TASK [Install the htop utility package] ****************************************
    changed: [ol-node01]
    PLAY RECAP *********************************************************************
    ol-node01                  : ok=6    changed=2    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   

Verify Package Installation

If the playbook runs successfully, we can connect using SSH to the ol-node01 system with the oracle user as defined in the playbook’s username variable.

  1. Open a new terminal and connect via SSH to ol-node01.

    ssh oracle@<ip_address_of_ol-node01>
  2. Confirm that htop is installed on the instance.

    which htop

    Example Output:

  3. Verify that htop runs.

  4. Exit htop by typing q.


Making this connection and running the htop command confirms you have successfully used a playbook to install the EPEL repository and then install a package from that repository (htop) using Oracle Linux Automation Engine.

For More Information

Oracle Linux Automation Manager Documentation
Oracle Linux Automation Manager Training
Oracle Linux Training Station

More Learning Resources

Explore other labs on or access more free learning content on the Oracle Learning YouTube channel. Additionally, visit to become an Oracle Learning Explorer.

For product documentation, visit Oracle Help Center.