dependenciescentos6yumcentos6.5libselinux

CentOS - yum install - Fails: Protected Multilib versions: problems found libselinux


I have CentOS 6.5

I'm trying to intsall git via yum but getting an error while installing the pre-requisite packages. I don't need to but it doesn't hurt running sudo with root.

Error message:

--> Finished Dependency Resolution
Error:  Multilib version problems found. This often means that the root
       cause is something else and multilib version checking is just
       pointing out that there is a problem. Eg.:

         1. You have an upgrade for libselinux which is missing some
            dependency that another package requires. Yum is trying to
            solve this by installing an older version of libselinux of the
            different architecture. If you exclude the bad architecture
            yum will tell you what the root cause is (which package
            requires what). You can try redoing the upgrade with
            --exclude libselinux.otherarch ... this should give you an error
            message showing the root cause of the problem.

         2. You have multiple architectures of libselinux installed, but
            yum can only see an upgrade for one of those arcitectures.
            If you don't want/need both architectures anymore then you
            can remove the one with the missing update and everything
            will work.

         3. You have duplicate versions of libselinux installed already.
            You can use "yum check" to get yum show these errors.

       ...you can also use --setopt=protected_multilib=false to remove
       this checking, however this is almost never the correct thing to
       do as something else is very likely to go wrong (often causing
       much more problems).

       Protected multilib versions: libselinux-2.0.94-5.3.el6_4.1.i686 != libselinux-2.0.94-5.8.el6.x86_64
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

Full log:

[root@server01 ~]# sudo yum -y install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Setting up Install Process
Package gcc-4.4.7-4.el6.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package expat-devel.x86_64 0:2.0.1-11.el6_2 will be installed
---> Package gettext-devel.x86_64 0:0.17-16.el6 will be installed
--> Processing Dependency: gettext-libs = 0.17-16.el6 for package: gettext-devel-0.17-16.el6.x86_64
--> Processing Dependency: gettext = 0.17-16.el6 for package: gettext-devel-0.17-16.el6.x86_64
--> Processing Dependency: libgettextsrc-0.17.so()(64bit) for package: gettext-devel-0.17-16.el6.x86_64
--> Processing Dependency: libgettextpo.so.0()(64bit) for package: gettext-devel-0.17-16.el6.x86_64
--> Processing Dependency: libgettextlib-0.17.so()(64bit) for package: gettext-devel-0.17-16.el6.x86_64
--> Processing Dependency: libgcj_bc.so.1()(64bit) for package: gettext-devel-0.17-16.el6.x86_64
--> Processing Dependency: libasprintf.so.0()(64bit) for package: gettext-devel-0.17-16.el6.x86_64
---> Package libcurl-devel.x86_64 0:7.19.7-37.el6_4 will be installed
--> Processing Dependency: libidn-devel for package: libcurl-devel-7.19.7-37.el6_4.x86_64
--> Processing Dependency: automake for package: libcurl-devel-7.19.7-37.el6_4.x86_64
---> Package openssl-devel.x86_64 0:1.0.1e-30.el6 will be installed
--> Processing Dependency: openssl = 1.0.1e-30.el6 for package: openssl-devel-1.0.1e-30.el6.x86_64
--> Processing Dependency: krb5-devel for package: openssl-devel-1.0.1e-30.el6.x86_64
---> Package perl-ExtUtils-MakeMaker.x86_64 0:6.55-136.el6 will be installed
--> Processing Dependency: perl-devel for package: perl-ExtUtils-MakeMaker-6.55-136.el6.x86_64
--> Processing Dependency: perl(Test::Harness) for package: perl-ExtUtils-MakeMaker-6.55-136.el6.x86_64
---> Package zlib-devel.x86_64 0:1.2.3-29.el6 will be installed
--> Running transaction check
---> Package automake.noarch 0:1.11.1-4.el6 will be installed
--> Processing Dependency: autoconf >= 2.62 for package: automake-1.11.1-4.el6.noarch
---> Package gettext.x86_64 0:0.17-16.el6 will be installed
--> Processing Dependency: cvs for package: gettext-0.17-16.el6.x86_64
---> Package gettext-libs.x86_64 0:0.17-16.el6 will be installed
---> Package krb5-devel.x86_64 0:1.10.3-37.el6_6 will be installed
--> Processing Dependency: krb5-libs = 1.10.3-37.el6_6 for package: krb5-devel-1.10.3-37.el6_6.x86_64
--> Processing Dependency: libselinux-devel for package: krb5-devel-1.10.3-37.el6_6.x86_64
--> Processing Dependency: libcom_err-devel for package: krb5-devel-1.10.3-37.el6_6.x86_64
--> Processing Dependency: keyutils-libs-devel for package: krb5-devel-1.10.3-37.el6_6.x86_64
---> Package libgcj.x86_64 0:4.4.7-4.el6 will be installed
--> Processing Dependency: zip >= 2.1 for package: libgcj-4.4.7-4.el6.x86_64
--> Processing Dependency: libart_lgpl >= 2.1.0 for package: libgcj-4.4.7-4.el6.x86_64
--> Processing Dependency: gtk2 >= 2.4.0 for package: libgcj-4.4.7-4.el6.x86_64
--> Processing Dependency: libasound.so.2(ALSA_0.9)(64bit) for package: libgcj-4.4.7-4.el6.x86_64
--> Processing Dependency: libpangoft2-1.0.so.0()(64bit) for package: libgcj-4.4.7-4.el6.x86_64
--> Processing Dependency: libpangocairo-1.0.so.0()(64bit) for package: libgcj-4.4.7-4.el6.x86_64
--> Processing Dependency: libpango-1.0.so.0()(64bit) for package: libgcj-4.4.7-4.el6.x86_64
--> Processing Dependency: libgtk-x11-2.0.so.0()(64bit) for package: libgcj-4.4.7-4.el6.x86_64
--> Processing Dependency: libgdk_pixbuf-2.0.so.0()(64bit) for package: libgcj-4.4.7-4.el6.x86_64
--> Processing Dependency: libgdk-x11-2.0.so.0()(64bit) for package: libgcj-4.4.7-4.el6.x86_64
--> Processing Dependency: libfreetype.so.6()(64bit) for package: libgcj-4.4.7-4.el6.x86_64
--> Processing Dependency: libfontconfig.so.1()(64bit) for package: libgcj-4.4.7-4.el6.x86_64
--> Processing Dependency: libcairo.so.2()(64bit) for package: libgcj-4.4.7-4.el6.x86_64
--> Processing Dependency: libatk-1.0.so.0()(64bit) for package: libgcj-4.4.7-4.el6.x86_64
--> Processing Dependency: libasound.so.2()(64bit) for package: libgcj-4.4.7-4.el6.x86_64
--> Processing Dependency: libXtst.so.6()(64bit) for package: libgcj-4.4.7-4.el6.x86_64
--> Processing Dependency: libXrender.so.1()(64bit) for package: libgcj-4.4.7-4.el6.x86_64
--> Processing Dependency: libXrandr.so.2()(64bit) for package: libgcj-4.4.7-4.el6.x86_64
--> Processing Dependency: libSM.so.6()(64bit) for package: libgcj-4.4.7-4.el6.x86_64
--> Processing Dependency: libICE.so.6()(64bit) for package: libgcj-4.4.7-4.el6.x86_64
---> Package libidn-devel.x86_64 0:1.18-2.el6 will be installed
---> Package openssl.x86_64 0:1.0.1e-15.el6 will be updated
---> Package openssl.x86_64 0:1.0.1e-30.el6 will be an update
---> Package perl-Test-Harness.x86_64 0:3.17-136.el6 will be installed
---> Package perl-devel.x86_64 4:5.10.1-136.el6 will be installed
--> Processing Dependency: perl(ExtUtils::ParseXS) for package: 4:perl-devel-5.10.1-136.el6.x86_64
--> Processing Dependency: gdbm-devel for package: 4:perl-devel-5.10.1-136.el6.x86_64
--> Processing Dependency: db4-devel for package: 4:perl-devel-5.10.1-136.el6.x86_64
--> Running transaction check
---> Package alsa-lib.x86_64 0:1.0.22-3.el6 will be installed
---> Package atk.x86_64 0:1.30.0-1.el6 will be installed
---> Package autoconf.noarch 0:2.63-5.1.el6 will be installed
---> Package cairo.x86_64 0:1.8.8-3.1.el6 will be installed
--> Processing Dependency: libpng12.so.0(PNG12_0)(64bit) for package: cairo-1.8.8-3.1.el6.x86_64
--> Processing Dependency: libpng12.so.0()(64bit) for package: cairo-1.8.8-3.1.el6.x86_64
--> Processing Dependency: libpixman-1.so.0()(64bit) for package: cairo-1.8.8-3.1.el6.x86_64
--> Processing Dependency: libX11.so.6()(64bit) for package: cairo-1.8.8-3.1.el6.x86_64
---> Package cvs.x86_64 0:1.11.23-16.el6 will be installed
---> Package db4-devel.x86_64 0:4.7.25-18.el6_4 will be installed
--> Processing Dependency: db4-cxx = 4.7.25-18.el6_4 for package: db4-devel-4.7.25-18.el6_4.x86_64
--> Processing Dependency: libdb_cxx-4.7.so()(64bit) for package: db4-devel-4.7.25-18.el6_4.x86_64
---> Package fontconfig.x86_64 0:2.8.0-3.el6 will be installed
---> Package freetype.x86_64 0:2.3.11-14.el6_3.1 will be installed
---> Package gdbm-devel.x86_64 0:1.8.0-36.el6 will be installed
---> Package gtk2.x86_64 0:2.20.1-4.el6 will be installed
--> Processing Dependency: libtiff >= 3.6.1 for package: gtk2-2.20.1-4.el6.x86_64
--> Processing Dependency: libjpeg.so.62(LIBJPEG_6.2)(64bit) for package: gtk2-2.20.1-4.el6.x86_64
--> Processing Dependency: hicolor-icon-theme for package: gtk2-2.20.1-4.el6.x86_64
--> Processing Dependency: libtiff.so.3()(64bit) for package: gtk2-2.20.1-4.el6.x86_64
--> Processing Dependency: libjpeg.so.62()(64bit) for package: gtk2-2.20.1-4.el6.x86_64
--> Processing Dependency: libjasper.so.1()(64bit) for package: gtk2-2.20.1-4.el6.x86_64
--> Processing Dependency: libcups.so.2()(64bit) for package: gtk2-2.20.1-4.el6.x86_64
--> Processing Dependency: libXinerama.so.1()(64bit) for package: gtk2-2.20.1-4.el6.x86_64
--> Processing Dependency: libXi.so.6()(64bit) for package: gtk2-2.20.1-4.el6.x86_64
--> Processing Dependency: libXfixes.so.3()(64bit) for package: gtk2-2.20.1-4.el6.x86_64
--> Processing Dependency: libXext.so.6()(64bit) for package: gtk2-2.20.1-4.el6.x86_64
--> Processing Dependency: libXdamage.so.1()(64bit) for package: gtk2-2.20.1-4.el6.x86_64
--> Processing Dependency: libXcursor.so.1()(64bit) for package: gtk2-2.20.1-4.el6.x86_64
--> Processing Dependency: libXcomposite.so.1()(64bit) for package: gtk2-2.20.1-4.el6.x86_64
---> Package keyutils-libs-devel.x86_64 0:1.4-4.el6 will be installed
---> Package krb5-libs.x86_64 0:1.10.3-10.el6_4.6 will be updated
---> Package krb5-libs.x86_64 0:1.10.3-37.el6_6 will be an update
---> Package libICE.x86_64 0:1.0.6-1.el6 will be installed
---> Package libSM.x86_64 0:1.2.1-2.el6 will be installed
---> Package libXrandr.x86_64 0:1.4.0-1.el6 will be installed
---> Package libXrender.x86_64 0:0.9.7-2.el6 will be installed
---> Package libXtst.x86_64 0:1.2.1-2.el6 will be installed
---> Package libart_lgpl.x86_64 0:2.3.20-5.1.el6 will be installed
---> Package libcom_err-devel.x86_64 0:1.41.12-18.el6 will be installed
---> Package libselinux-devel.x86_64 0:2.0.94-5.3.el6_4.1 will be installed
--> Processing Dependency: libselinux = 2.0.94-5.3.el6_4.1 for package: libselinux-devel-2.0.94-5.3.el6_4.1.x86_64
--> Processing Dependency: libsepol-devel >= 2.0.32-1 for package: libselinux-devel-2.0.94-5.3.el6_4.1.x86_64
--> Processing Dependency: pkgconfig(libsepol) for package: libselinux-devel-2.0.94-5.3.el6_4.1.x86_64
---> Package pango.x86_64 0:1.28.1-7.el6_3 will be installed
--> Processing Dependency: libthai >= 0.1.9 for package: pango-1.28.1-7.el6_3.x86_64
--> Processing Dependency: libthai.so.0(LIBTHAI_0.1)(64bit) for package: pango-1.28.1-7.el6_3.x86_64
--> Processing Dependency: libthai.so.0()(64bit) for package: pango-1.28.1-7.el6_3.x86_64
--> Processing Dependency: libXft.so.2()(64bit) for package: pango-1.28.1-7.el6_3.x86_64
---> Package perl-ExtUtils-ParseXS.x86_64 1:2.2003.0-136.el6 will be installed
---> Package zip.x86_64 0:3.0-1.el6 will be installed
--> Running transaction check
---> Package cups-libs.x86_64 1:1.4.2-50.el6_4.5 will be installed
--> Processing Dependency: libgnutls.so.26(GNUTLS_1_4)(64bit) for package: 1:cups-libs-1.4.2-50.el6_4.5.x86_64
--> Processing Dependency: libgnutls.so.26()(64bit) for package: 1:cups-libs-1.4.2-50.el6_4.5.x86_64
--> Processing Dependency: libavahi-common.so.3()(64bit) for package: 1:cups-libs-1.4.2-50.el6_4.5.x86_64
--> Processing Dependency: libavahi-client.so.3()(64bit) for package: 1:cups-libs-1.4.2-50.el6_4.5.x86_64
---> Package db4-cxx.x86_64 0:4.7.25-18.el6_4 will be installed
---> Package hicolor-icon-theme.noarch 0:0.11-1.1.el6 will be installed
---> Package jasper-libs.x86_64 0:1.900.1-15.el6_1.1 will be installed
---> Package libX11.x86_64 0:1.5.0-4.el6 will be installed
--> Processing Dependency: libX11-common = 1.5.0-4.el6 for package: libX11-1.5.0-4.el6.x86_64
--> Processing Dependency: libxcb.so.1()(64bit) for package: libX11-1.5.0-4.el6.x86_64
---> Package libXcomposite.x86_64 0:0.4.3-4.el6 will be installed
---> Package libXcursor.x86_64 0:1.1.13-6.20130524git8f677eaea.el6 will be installed
---> Package libXdamage.x86_64 0:1.1.3-4.el6 will be installed
---> Package libXext.x86_64 0:1.3.1-2.el6 will be installed
---> Package libXfixes.x86_64 0:5.0-3.el6 will be installed
---> Package libXft.x86_64 0:2.3.1-2.el6 will be installed
---> Package libXi.x86_64 0:1.6.1-3.el6 will be installed
---> Package libXinerama.x86_64 0:1.1.2-2.el6 will be installed
---> Package libjpeg-turbo.x86_64 0:1.2.1-1.el6 will be installed
---> Package libpng.x86_64 2:1.2.49-1.el6_2 will be installed
---> Package libselinux.i686 0:2.0.94-5.3.el6_4.1 will be installed
--> Processing Dependency: libdl.so.2(GLIBC_2.1) for package: libselinux-2.0.94-5.3.el6_4.1.i686
--> Processing Dependency: libdl.so.2(GLIBC_2.0) for package: libselinux-2.0.94-5.3.el6_4.1.i686
--> Processing Dependency: libdl.so.2 for package: libselinux-2.0.94-5.3.el6_4.1.i686
--> Processing Dependency: libc.so.6(GLIBC_2.8) for package: libselinux-2.0.94-5.3.el6_4.1.i686
--> Processing Dependency: ld-linux.so.2(GLIBC_2.3) for package: libselinux-2.0.94-5.3.el6_4.1.i686
--> Processing Dependency: ld-linux.so.2 for package: libselinux-2.0.94-5.3.el6_4.1.i686
---> Package libsepol-devel.x86_64 0:2.0.41-4.el6 will be installed
---> Package libthai.x86_64 0:0.1.12-3.el6 will be installed
---> Package libtiff.x86_64 0:3.9.4-9.el6_3 will be installed
---> Package pixman.x86_64 0:0.26.2-5.el6_4 will be installed
--> Running transaction check
---> Package avahi-libs.x86_64 0:0.6.25-12.el6 will be installed
---> Package glibc.x86_64 0:2.12-1.132.el6 will be updated
--> Processing Dependency: glibc = 2.12-1.132.el6 for package: glibc-devel-2.12-1.132.el6.x86_64
--> Processing Dependency: glibc = 2.12-1.132.el6 for package: glibc-headers-2.12-1.132.el6.x86_64
--> Processing Dependency: glibc = 2.12-1.132.el6 for package: glibc-common-2.12-1.132.el6.x86_64
---> Package glibc.i686 0:2.12-1.149.el6_6.5 will be installed
--> Processing Dependency: libfreebl3.so(NSSRAWHASH_3.12.3) for package: glibc-2.12-1.149.el6_6.5.i686
--> Processing Dependency: libfreebl3.so for package: glibc-2.12-1.149.el6_6.5.i686
---> Package glibc.x86_64 0:2.12-1.149.el6_6.5 will be an update
---> Package gnutls.x86_64 0:2.8.5-10.el6_4.2 will be installed
---> Package libX11-common.noarch 0:1.5.0-4.el6 will be installed
---> Package libxcb.x86_64 0:1.8.1-1.el6 will be installed
--> Processing Dependency: libXau.so.6()(64bit) for package: libxcb-1.8.1-1.el6.x86_64
--> Running transaction check
---> Package glibc-common.x86_64 0:2.12-1.132.el6 will be updated
---> Package glibc-common.x86_64 0:2.12-1.149.el6_6.5 will be an update
---> Package glibc-devel.x86_64 0:2.12-1.132.el6 will be updated
---> Package glibc-devel.x86_64 0:2.12-1.149.el6_6.5 will be an update
---> Package glibc-headers.x86_64 0:2.12-1.132.el6 will be updated
---> Package glibc-headers.x86_64 0:2.12-1.149.el6_6.5 will be an update
---> Package libXau.x86_64 0:1.0.6-4.el6 will be installed
---> Package nss-softokn-freebl.i686 0:3.14.3-9.el6 will be installed
--> Finished Dependency Resolution
Error:  Multilib version problems found. This often means that the root
       cause is something else and multilib version checking is just
       pointing out that there is a problem. Eg.:

         1. You have an upgrade for libselinux which is missing some
            dependency that another package requires. Yum is trying to
            solve this by installing an older version of libselinux of the
            different architecture. If you exclude the bad architecture
            yum will tell you what the root cause is (which package
            requires what). You can try redoing the upgrade with
            --exclude libselinux.otherarch ... this should give you an error
            message showing the root cause of the problem.

         2. You have multiple architectures of libselinux installed, but
            yum can only see an upgrade for one of those arcitectures.
            If you don't want/need both architectures anymore then you
            can remove the one with the missing update and everything
            will work.

         3. You have duplicate versions of libselinux installed already.
            You can use "yum check" to get yum show these errors.

       ...you can also use --setopt=protected_multilib=false to remove
       this checking, however this is almost never the correct thing to
       do as something else is very likely to go wrong (often causing
       much more problems).

       Protected multilib versions: libselinux-2.0.94-5.3.el6_4.1.i686 != libselinux-2.0.94-5.8.el6.x86_64
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest
[root@server01 ~]#

yum repolist shows me:

[root@server01 ~]# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
repo id                                                                          repo name                                                                                    status
puppetlabs-deps                                                                  Puppet Labs Dependencies El 6 - x86_64                                                          77
puppetlabs-products                                                              Puppet Labs Products El 6 - x86_64                                                             538
release.update                                                                   6.6.5                                                                                        6,367
supplemental.release                                                             supplemental.6                                                                                  84
supplemental.release.update                                                      supplemental.6.6.5                                                                               1
repolist: 7,067
[root@server01 ~]#

Tried running the following commands but it's still errors out (it does some downloading/resolving dependencies but then finally fails with the following new error). yum-complete-transaction; yum-distro-sync; yum clean all; yum update

Transaction Check Error:
  file /usr/bin/extlookup2hiera from install of puppet-3.8.4-1.el6.noarch conflicts with file from package hiera-puppet-1.0.0-1.el6.noarch
  file /usr/lib/ruby/site_ruby/1.8/hiera/backend/puppet_backend.rb from install of puppet-3.8.4-1.el6.noarch conflicts with file from package hiera-puppet-1.0.0-1.el6.noarch
  file /usr/lib/ruby/site_ruby/1.8/hiera/scope.rb from install of puppet-3.8.4-1.el6.noarch conflicts with file from package hiera-puppet-1.0.0-1.el6.noarch
  file /usr/lib/ruby/site_ruby/1.8/hiera_puppet.rb from install of puppet-3.8.4-1.el6.noarch conflicts with file from package hiera-puppet-1.0.0-1.el6.noarch
  file /usr/lib/ruby/site_ruby/1.8/puppet/parser/functions/hiera.rb from install of puppet-3.8.4-1.el6.noarch conflicts with file from package hiera-puppet-1.0.0-1.el6.noarch
  file /usr/lib/ruby/site_ruby/1.8/puppet/parser/functions/hiera_array.rb from install of puppet-3.8.4-1.el6.noarch conflicts with file from package hiera-puppet-1.0.0-1.el6.noarch
  file /usr/lib/ruby/site_ruby/1.8/puppet/parser/functions/hiera_hash.rb from install of puppet-3.8.4-1.el6.noarch conflicts with file from package hiera-puppet-1.0.0-1.el6.noarch
  file /usr/lib/ruby/site_ruby/1.8/puppet/parser/functions/hiera_include.rb from install of puppet-3.8.4-1.el6.noarch conflicts with file from package hiera-puppet-1.0.0-1.el6.noarch

Error Summary
-------------

I saw this post to install extra package repo for CentOS 6 (x86_64) but that didn't help. With using this, now I'm getting a 3rd error.

# wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# rpm -ivh epel-release-6-8.noarch.rpm
warning: epel-release-6-8.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing...                ########################################### [100%]
   1:epel-release           ########################################### [100%]
[root@server01 yum.repos.d]#

Now yum repolist shows an extra line (for extra packages - CentOS):

epel                                                                         Extra Packages for Enterprise Linux 6 - x86_64                                                   11,838

Still, running: sudo yum -y install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker is still giving me the same error (that I got first as mentioned at top).

/etc/yum.repos.d contains -- # pwd; ls -l

/etc/yum.repos.d
total 32
-rw-r--r--  1 root root 14540 Nov  5  2012 epel-release-6-8.noarch.rpm
-rw-r--r--  1 root root   957 Nov  4  2012 epel.repo
-rw-r--r--  1 root root  1056 Nov  4  2012 epel-testing.repo
-rw-r--r--. 1 root root  1250 Jan 22  2014 puppetlabs.repo
-rw-r--r--. 1 root root   406 Dec  8 10:48 mycompany.redhat.repo

Puppetlabs.repo seems redundant for this post, the first 2 .repo files got installed here after I downloaded + installed the extra package repo rpm (as listed in the post/link above) and contents in mycompany.redhat.repo are:

[release.update]
name=$releasever.$YUM0
baseurl=http://manager/yum/$basearch/$releasever/$YUM0/Server
enabled=1
gpgcheck=0

[supplemental.release]
name=supplemental.$releasever
baseurl=http://manager/yum/$basearch/supplemental/$releasever
enabled=1
gpgcheck=0

[supplemental.release.update]
name=supplemental.$releasever.$YUM0
baseurl=http://manager/yum/$basearch/supplemental/$YUM0
enabled=1
gpgcheck=0

Solution

  • I created a file at /etc/yum.repos.d/CentOS-Base.repo or some name (I made it a little generic so that it can work for any 6.x or 7 version). It worked on 6.5. If you find any issue using this file with CentOS 7.x, then all you need is the correct CentOS-Base.repo (official .repo file for CentOS 7.x or any X.Y version) and the issue coming in the post will be resolved.

    For ex: Contents of /etc/yum.repos.d/CentOS-Base-Custom.repo (PS: I named it custom as instead of using hardcoded version 6, I used $releasever variable in name, mirrorlist, baseurl, gpgkey fields inside the .repo file.

    # CentOS-Base.repo
    #
    # The mirror system uses the connecting IP address of the client and the
    # update status of each mirror to pick mirrors that are updated to and
    # geographically close to the client.  You should use this for CentOS updates
    # unless you are manually picking other mirrors.
    #
    # If the mirrorlist= does not work for you, as a fall back you can try the
    # remarked out baseurl= line instead.
    #
    #
    
    [base]
    name=CentOS-$releasever - Base
    mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
    #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-$releasever
    
    #released updates
    [updates]
    name=CentOS-$releasever - Updates
    mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
    #baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-$releasever
    
    #additional packages that may be useful
    [extras]
    name=CentOS-$releasever - Extras
    mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
    #baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-$releasever
    
    #additional packages that extend functionality of existing packages
    [centosplus]
    name=CentOS-$releasever - Plus
    mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
    #baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
    gpgcheck=1
    enabled=0
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-$releasever
    
    #contrib - packages by Centos Users
    [contrib]
    name=CentOS-$releasever - Contrib
    mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
    #baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
    gpgcheck=1
    enabled=0
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-$releasever
    

    Ran: sudo yum -y install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker and it worked without any errors.

    Re-ran the same and the output came as expected.

    [root@server01 yum.repos.d]# sudo yum -y install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: mirror.symnds.com
     * epel: mirror.cogentco.com
     * extras: centos.mirror.nac.net
     * updates: mirror.ash.fastserv.com
    Setting up Install Process
    Package libcurl-devel-7.19.7-46.el6.x86_64 already installed and latest version
    Package expat-devel-2.0.1-11.el6_2.x86_64 already installed and latest version
    Package gettext-devel-0.17-18.el6.x86_64 already installed and latest version
    Package openssl-devel-1.0.1e-42.el6_7.1.x86_64 already installed and latest version
    Package zlib-devel-1.2.3-29.el6.x86_64 already installed and latest version
    Package gcc-4.4.7-16.el6.x86_64 already installed and latest version
    Package perl-ExtUtils-MakeMaker-6.55-141.el6_7.1.x86_64 already installed and latest version
    Nothing to do
    [root@server01 yum.repos.d]#
    

    All I need now is to use template module in Ansible (and set this file in /etc/yum.repos.d folder on the target machine) and once done, the above pre-requisites will be installed without any errors and ansible will install the desired (user defined GIT version) that I need.