Thursday, April 1, 2021

Add Yum Repository using Ansible

Description:  Here I have explained, How to add Yum repository using Ansible

Procedure:

  • Create YAML file and paste below content for EPEL repository

--- - hosts: all tasks: - name: Add repository yum_repository: name: epel description: EPEL YUM repo metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch&infra=$infra&content=$contentdir gpgcheck: yes gpgkey: file:///etc/pki/gpg-key
  • In the above example, I have used the EPEL repository 
  • Run YAML file using the ansible-playbook command

    # ansible-playbook repo.yaml










  • Verify  repository on the client machine 

No comments:

Post a Comment