Saturday, 29 November 2025

Ansible - 1. installation , ansible collection , ansible config

Installing Ansible on Oracle Linux 7

Step 1: Enable the Oracle EPEL Repository

yum install -y oracle-epel-release-el7

What does this command do?

The command installs the EPEL (Extra Packages for Enterprise Linux) repository configuration for Oracle Linux 7.

Oracle Linux and Red Hat Enterprise Linux do not include Ansible in their standard repositories. Ansible packages are typically distributed through the EPEL repository.

By enabling EPEL, you gain access to additional packages, including Ansible.


Step 2: Install Ansible

yum install -y ansible

This command installs Ansible and its required dependencies from the enabled repositories.


Step 3: Verify the Installation

ansible --version

Example output:

ansible 2.9.27
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules',
                                   '/usr/share/ansible/plugins/modules']
  ansible python module location =
      /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5

In this example:

  • Ansible version: 2.9.27
  • Python version: 2.7.5
  • Configuration file: /etc/ansible/ansible.cfg

Important Note About Ansible 2.9

The example above installs Ansible 2.9.27, which is typically the latest version available on Oracle Linux 7.

Ansible 2.9 is considered an older release and is based on Python 2.7, which has reached End of Life (EOL).

If you are deploying new automation environments, consider using:

  • Oracle Linux 8
  • Oracle Linux 9
  • Ansible Core 2.15+
  • Python 3.x

These versions provide better security, support, and access to modern collections.


What Are Ansible Collections?

Ansible Collections are a packaging format introduced to organize and distribute Ansible content.

A collection can contain:

  • Modules
  • Roles
  • Playbooks
  • Plugins
  • Documentation

Think of a collection as a software package that groups related automation content together.


Why Were Collections Introduced?

Before Ansible 2.9, most modules were distributed in a single large package.

As the Ansible ecosystem grew, maintaining one giant repository became difficult.

Collections were introduced to:

  • Allow independent release cycles
  • Simplify maintenance
  • Reduce package size
  • Enable vendors to distribute their own content

Example: Oracle OCI Collection

Oracle provides the following collection for Oracle Cloud Infrastructure:

oracle.oci

This collection contains modules for managing OCI resources such as:

  • Compute instances
  • Networks
  • Load balancers
  • Block volumes
  • Databases

To install the collection:

ansible-galaxy collection install oracle.oci

Commonly Used Collections

CollectionPurpose
ansible.builtinCore Ansible modules
community.generalLarge community-maintained module set
ansible.posixLinux and UNIX administration
community.cryptoCertificates, SSL/TLS, SSH keys
ansible.windowsWindows administration
oracle.ociOracle Cloud Infrastructure
kubernetes.coreKubernetes management
amazon.awsAWS automation

Are Collections Automatically Installed?

The answer depends on the Ansible version.

Scenario 1: Ansible 2.9 (Oracle Linux 7)

When installing Ansible 2.9 using:

yum install -y ansible

most functionality is bundled within the Ansible package itself.

Collections were just being introduced during the 2.9 timeframe.

Therefore, many commonly used modules are already available without installing separate collections.


Scenario 2: Modern Ansible Versions

In newer releases (Ansible Core 2.10+), the architecture changed significantly.

The core engine and collections are separated.

Installing Ansible typically provides:

  • ansible-core
  • Several common collections

Additional vendor-specific collections must be installed separately.

Examples:

ansible-galaxy collection install oracle.oci
ansible-galaxy collection install amazon.aws
ansible-galaxy collection install kubernetes.core

How to Check Installed Collections

To view installed collections:

ansible-galaxy collection list

Example output:

Collection              Version
----------------------  -------
community.general       9.5.0
ansible.posix           1.6.0
community.crypto        2.22.0

This command helps verify exactly which collections are available in your environment.

No comments:

Post a Comment

Building a Safer PostgreSQL CI/CD Pipeline with GitHub Actions: Dev → PR Review → Test Promotion

In my previous post, we explored a simple push-to-main deployment strategy . While functional, that model is not considered an industry best...