From c6bb0819cb65239f8c4428adbe9ada9cbc69522a Mon Sep 17 00:00:00 2001
From: Chris Hines <chris.hines@monash.edu>
Date: Wed, 18 May 2016 00:53:51 +0000
Subject: [PATCH] point CentOS 7 at our local mirror

---
 roles/config_repos/files/monashhpc_base.repo  | 25 +++++++++++++
 .../config_repos/files/monashhpc_others.repo  |  8 +++++
 roles/config_repos/tasks/main.yml             | 35 +++++++++++++------
 3 files changed, 58 insertions(+), 10 deletions(-)
 create mode 100644 roles/config_repos/files/monashhpc_base.repo
 create mode 100644 roles/config_repos/files/monashhpc_others.repo

diff --git a/roles/config_repos/files/monashhpc_base.repo b/roles/config_repos/files/monashhpc_base.repo
new file mode 100644
index 00000000..8f0d9aee
--- /dev/null
+++ b/roles/config_repos/files/monashhpc_base.repo
@@ -0,0 +1,25 @@
+# Place this file in your /etc/yum.repos.d/ directory
+
+[monashhpc_base]
+name=MonashHPC base repository mirrored to control the update process
+baseurl=https://consistency0/centos/$releasever/os/$basearch/
+enabled=1
+sslverify=false
+
+[monashhpc_udpates]
+name=MonashHPC base repository mirrored to control the update process
+baseurl=https://consistency0/centos/$releasever/updates/$basearch/
+enabled=1
+sslverify=false
+
+[monashhpc_extras]
+name=MonashHPC base repository mirrored to control the update process
+baseurl=https://consistency0/centos/$releasever/extras/$basearch/
+enabled=1
+sslverify=false
+
+[monashhpc_centosplus]
+name=MonashHPC base repository mirrored to control the update process
+baseurl=https://consistency0/centos/$releasever/centosplus/$basearch/
+enabled=1
+sslverify=false
diff --git a/roles/config_repos/files/monashhpc_others.repo b/roles/config_repos/files/monashhpc_others.repo
new file mode 100644
index 00000000..e78702bf
--- /dev/null
+++ b/roles/config_repos/files/monashhpc_others.repo
@@ -0,0 +1,8 @@
+# Place this file in your /etc/yum.repos.d/ directory
+
+[monashhpc_otherstuff]
+name=MonashHPC base repository mirrored to control the update process
+baseurl=https://consistency0/centos/hpcsystems/$releasever/$basearch/
+enabled=1
+sslverify=false
+gpgcheck=0
diff --git a/roles/config_repos/tasks/main.yml b/roles/config_repos/tasks/main.yml
index 6d2efb6b..7feaa7de 100644
--- a/roles/config_repos/tasks/main.yml
+++ b/roles/config_repos/tasks/main.yml
@@ -1,18 +1,33 @@
 ---
-# this repository was broken on some CentOS images. Remove it.
-- name: Removing the RDO repository
-  file: path=/etc/yum.repos.d/rdo-release.repo state=absent
-  sudo: true
 
-- name: add gluster repo
-  copy: src=glusterfs-epel.repo dest=/etc/yum.repos.d/glusterfs-epel.repo
+- name: make sure out repo server is resolvable
+  lineinfile: dest=/etc/hosts line="118.138.244.7 consistency0"
   sudo: true
-  when: ansible_os_family == 'RedHat'
 
-- name: Install epel-release
-  yum: name=epel-release-7-5.noarch state=present
+- name: remove default repos
+  file:
+    path: /usr/yum.repos.d/{{ item }}
+    state: absent
+  become: true
+  become_user: root
+  with_items:
+  - CentOS-Base.repo
+  - CentOS-Debuginfo.repo
+  - CentOS-fasttrack.repo
+  - CentOS-Sources.repo
+  - CentOS-Vault.repo
+  - foreman.repo
+  - puppetlabs.repo
+  - rdo-release.repo
+  when: ansible_os_family == 'RedHat' and ansible_distribution_major_version == "7"
+
+- name: add our repos
+  copy: src={{ item }} dest=/etc/yum.repos.d/{{ item }}
   sudo: true
-  when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "7"
+  when: ansible_os_family == 'RedHat' and ansible_distribution_major_version == "7"
+  with_items:
+  - monashhpc_base.repo
+  - monashhpc_others.repo
 
 
 #- name: Enable epel
-- 
GitLab