roles/yum: Added base YUM repo configuration for local mirror.

This commit is contained in:
Jonathan Davies 2017-11-01 10:42:00 +00:00
parent a868ba1c42
commit 0b8bd70a5b
4 changed files with 116 additions and 0 deletions

View File

@ -0,0 +1,5 @@
---
centos_mirror_host: 'mirror.centos.org'
epel_mirror_host: 'download.fedoraproject.org'
epel_mirror_directory: 'pub/epel'

View File

@ -0,0 +1,42 @@
---
- name: Replace | Disable YUM fastestmirror plugin (CentOS)
replace:
dest: /etc/yum/pluginconf.d/fastestmirror.conf
regexp: "enabled=1"
replace: "enabled=0"
when: ansible_os_family == 'RedHat'
- name: Template | Copy CentOS repo templates (CentOS)
template:
src: CentOS-Base.repo.j2
dest: /etc/yum.repos.d/CentOS-Base.repo
owner: root
group: root
mode: 0664
when: ansible_os_family == 'RedHat'
- name: Yum | Update cache (CentOS)
yum:
update_cache=yes
when: ansible_os_family == 'RedHat'
- name: Yum | Install epel-release (CentOS)
yum:
name: epel-release
state: installed
when: ansible_os_family == 'RedHat'
- name: Template | Copy EPEL repo templates (CentOS)
template:
src: epel.repo.j2
dest: /etc/yum.repos.d/epel.repo
owner: root
group: root
mode: 0664
when: ansible_os_family == 'RedHat'
- name: Yum | Update cache (CentOS)
update_cache=yes
when: ansible_os_family == 'RedHat'

View File

@ -0,0 +1,43 @@
# 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&infra=$infra
baseurl=http://{{ centos_mirror_host }}/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
baseurl=http://{{ centos_mirror_host }}/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
baseurl=http://{{ centos_mirror_host }}/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
baseurl=http://{{ centos_mirror_host }}/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

View File

@ -0,0 +1,26 @@
[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
baseurl=http://{{ epel_mirror_host }}/{{ epel_mirror_directory }}/7/$basearch
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
[epel-debuginfo]
name=Extra Packages for Enterprise Linux 7 - $basearch - Debug
baseurl=http://{{ epel_mirror_host }}/{{ epel_mirror_directory }}/7/$basearch/debug
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1
[epel-source]
name=Extra Packages for Enterprise Linux 7 - $basearch - Source
baseurl=http://{{ epel_mirror_host }}/{{ epel_mirror_directory }}/7/SRPMS
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-source-7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1