Skip to content

christiangda/ansible-role-epel-repo

Repository files navigation

Ansible Role: christiangda.epel_repo

Master branch workflow Develop branch workflow Ansible Role

This role install EPEL Repository

The best way to install this role is using the command ansible-galaxy install christiangda.epel_repo, the Ansible Galaxy repository is christiangda.epel_repo

The repository code is https://github.com/christiangda/ansible-role-epel-repo

Requirements

This role work on RedHat, CentOS and Amazon Linux distributions

  • RedHat
    • 6
    • 7
    • 8
    • 9
  • CentOS
    • 6
    • 7
    • 8
  • CentOS Stream
    • 8
    • 9
  • Rocky Linux
    • 8
    • 9
  • Oracle Linux
    • 8
    • 9
  • Amazon Linux
    • 1
    • 2

To see the compatibility matrix of Python vs. Ansible see the project Travis-CI build matrix

Role Variables

Variable Default Value
epel_enable_extras_repos false
epel_debug false

More Details: See the file defaults/main.yaml

Dependencies

None.

Example Playbook

RedHat

- hosts: servers
  gather_facts: True
  roles:
    - role: christiangda.epel_repo
      vars:
        epel_enable_redhat_extras_repos: true

Redhat/CentOS 6/7/8

- hosts: servers
  gather_facts: True
  roles:
    - role: christiangda.epel_repo

Amazon Linux 1/2 (my-playbook.yml)

- hosts: all
    gather_facts: True
    become: true
    become_user: root
    become_method: sudo
    remote_user: ec2-user
    roles:
      - christiangda.epel_repo

Inventory file sample

[all]
10.14.x.y
10.14.v.z

[amazon-1]
10.14.x.y

[amazon-2]
10.14.v.z
ansible-playbook my-playbook.yml \
    --inventory inventory \
    --private-key [~/location of my key.pem] \
    --become \
    --become-user=ec2-user \
    --user ec2-user

Development / Contributing

This role is tested using Molecule and was developed using Python Virtual Environments

Also, we used to main git branch

  • master
  • develop

If you want to contribute to this project what you want to do is

References

Prepare your environment

  • Python 3
mkdir ansible-roles
cd ansible-roles/

python3 -m venv venv
source venv/bin/activate
pip install pip --upgrade
pip install ansible
pip install molecule
pip install 'molecule[docker]'
pip install 'molecule[podman]'
pip install 'molecule[lint]'
pip install molecule-vagrant
pip install python-vagrant
pip install selinux
pip install docker
pip install pytest
pip install pytest-mock
pip install pylint
pip install rope
pip install autopep8
pip install yamllint
pip install flake8
pip install ansible-lint

Clone the role repository (From your fork) and create symbolic link

git clone https://github.com/<your github user>/ansible-role-epel-repo.git
ln -s ansible-role-epel-repo christiangda.epel_repo
cd christiangda.epel_repo

Execute the molecule test

Scenarios available:

molecule list

scenario default

Step by step

molecule create [--scenario-name default]
molecule converge [--scenario-name default]
molecule verify [--scenario-name default]
molecule destroy [--scenario-name default]

or

All in one

molecule test [--scenario-name default]

Additionally if you want to test it using VMs, I have a very nice ansible-playground project that use Vagrant and VirtualBox, try it!.

License

This module is released under the GNU General Public License Version 3:

Author Information