From 03497abcb6a6a1e1e06c1e06525c4bb20cfcb76a Mon Sep 17 00:00:00 2001
From: Andreas Hamacher <andreas.hamacher@monash.edu>
Date: Mon, 2 Mar 2020 12:14:09 +1100
Subject: [PATCH] Revert "testing upcoming vars change"

This reverts commit b4f5d9f7fa6fd96e6d90c5c338af18f43a6618ae.
---
 CICD/heat/gc_HOT.yaml                               | 12 ++++++------
 CICD/heat/mgmtnode_HOT.yaml                         |  2 +-
 CICD/vars/vars.yml                                  | 11 +++++++++++
 roles/calculateEtcHosts/tasks/main.yml              |  2 +-
 roles/calculateEtcHosts/templates/etcHosts.j2       |  2 --
 roles/config_repos/defaults/main.yml                |  5 +++++
 roles/config_repos/tasks/main.yml                   | 13 +++++++------
 .../{files/epel.repo => templates/epel.repo.j2}     |  2 +-
 .../glusterfs-epel.repo.j2}                         |  0
 .../monashhpc_base.repo.j2}                         |  8 ++++----
 .../monashhpc_others.repo.j2}                       |  2 +-
 11 files changed, 37 insertions(+), 22 deletions(-)
 create mode 100644 roles/config_repos/defaults/main.yml
 rename roles/config_repos/{files/epel.repo => templates/epel.repo.j2} (70%)
 rename roles/config_repos/{files/glusterfs-epel.repo => templates/glusterfs-epel.repo.j2} (100%)
 rename roles/config_repos/{files/monashhpc_base.repo => templates/monashhpc_base.repo.j2} (64%)
 rename roles/config_repos/{files/monashhpc_others.repo => templates/monashhpc_others.repo.j2} (70%)

diff --git a/CICD/heat/gc_HOT.yaml b/CICD/heat/gc_HOT.yaml
index 5d2935ae..da11e6a1 100644
--- a/CICD/heat/gc_HOT.yaml
+++ b/CICD/heat/gc_HOT.yaml
@@ -13,7 +13,7 @@ parameters:
     type: string
     label: Image ID
     description: Centos Image
-    default: 12da1997-5122-4be3-a2a9-2f44961c1b16
+    default: c47c3acb-9657-4243-9e14-e6c676157e3b #with NetworkManager
   ssh_key:
     type: string
     default: gc_key
@@ -104,7 +104,7 @@ resources:
     name:
      list_join: [ '-', [ { get_param: "OS::stack_name" }, 'sql0' ]]
     availability_zone: { get_param: avz }
-    flavor: t3.small
+    flavor: m3.small
     image: { get_param: centos_7_image_id }
     key_name: { get_param: ssh_key }
     security_groups: [ { get_resource: SSHMonashSecGroup }, { get_resource: SlurmSecGroup }, { get_resource: MySQLSecGroup }, { get_resource: NFSSecGroup } ]
@@ -175,7 +175,7 @@ resources:
      type: "OS::Nova::Server"
      properties:
       #availability_zone: { get_param: avz }
-      flavor: t3.small
+      flavor: m3.xsmall
       image: { get_param: centos_7_image_id }
       key_name: { get_param: ssh_key }
       name:
@@ -196,7 +196,7 @@ resources:
      type: "OS::Nova::Server"
      properties:
       #availability_zone: { get_param: avz }
-      flavor: t3.small
+      flavor: m3.xsmall
       image: { get_param: centos_7_image_id }
       key_name: { get_param: ssh_key }
       name:
@@ -217,7 +217,7 @@ resources:
      type: "OS::Nova::Server"
      properties:
       #availability_zone: { get_param: avz }
-      flavor: t3.small
+      flavor: m3.xsmall
       image: { get_param: centos_7_image_id }
       key_name: { get_param: ssh_key }
       name:
@@ -238,7 +238,7 @@ resources:
      type: "OS::Nova::Server"
      properties:
       #availability_zone: { get_param: avz }
-      flavor: t3.small
+      flavor: m3.xsmall
       image: { get_param: ubuntu_1804_image_id }
       key_name: { get_param: ssh_key }
       name:
diff --git a/CICD/heat/mgmtnode_HOT.yaml b/CICD/heat/mgmtnode_HOT.yaml
index d4f9858a..d44cf911 100644
--- a/CICD/heat/mgmtnode_HOT.yaml
+++ b/CICD/heat/mgmtnode_HOT.yaml
@@ -25,7 +25,7 @@ resources:
     type: OS::Nova::Server
     properties:
       #availability_zone: { get_param: avz }
-      flavor: t3.xsmall
+      flavor: m3.xsmall
       image: { get_param: image }
       key_name: { get_param: ssh_key }
       security_groups: { get_param: security_groups }
diff --git a/CICD/vars/vars.yml b/CICD/vars/vars.yml
index d1dc95cf..83485426 100644
--- a/CICD/vars/vars.yml
+++ b/CICD/vars/vars.yml
@@ -3,6 +3,17 @@ sudo_group: systems
 nagios_home: "/var/lib/nagios"
 nvidia_version: "390.46"
 
+yumdisablerepo: 
+ - 'base'
+ - 'extras'
+ - 'updates'
+yumenablerepo: 
+ - 'monashhpc_base'
+ - 'monashhpc_updates'
+ - 'monashhpc_extras'
+ - 'monashhpc_centosplus'
+ - 'monashhpc_otherstuff'
+
 gpumap:
  'K1': 'K1'
  'K80': 'K80'
diff --git a/roles/calculateEtcHosts/tasks/main.yml b/roles/calculateEtcHosts/tasks/main.yml
index ff71a956..1d1c6170 100644
--- a/roles/calculateEtcHosts/tasks/main.yml
+++ b/roles/calculateEtcHosts/tasks/main.yml
@@ -8,7 +8,7 @@
 - name: make hosts data
   command: /tmp/makehosts.py /tmp/groups {{ domain }}
   register: hosts_data
-               
+
 - name: write hosts file
   template: dest=/tmp/etcHosts src=etcHosts.j2
 
diff --git a/roles/calculateEtcHosts/templates/etcHosts.j2 b/roles/calculateEtcHosts/templates/etcHosts.j2
index 590826fe..88e5044c 100644
--- a/roles/calculateEtcHosts/templates/etcHosts.j2
+++ b/roles/calculateEtcHosts/templates/etcHosts.j2
@@ -4,8 +4,6 @@ fe00::0 ip6-localnet
 ff00::0 ip6-mcastprefix
 ff02::1 ip6-allnodes
 ff02::2 ip6-allrouters
-118.138.241.196 hpcldap0.erc.monash.edu.au
-118.138.244.7 consistency0
 
 {% for item in hosts_data.stdout_lines %}
 {{ item }}
diff --git a/roles/config_repos/defaults/main.yml b/roles/config_repos/defaults/main.yml
new file mode 100644
index 00000000..a5ac4ab9
--- /dev/null
+++ b/roles/config_repos/defaults/main.yml
@@ -0,0 +1,5 @@
+---
+# default variables for  config_repos
+
+reposervername: consistency0
+reposerverip: 118.138.244.7
diff --git a/roles/config_repos/tasks/main.yml b/roles/config_repos/tasks/main.yml
index 02bc8977..684c327a 100644
--- a/roles/config_repos/tasks/main.yml
+++ b/roles/config_repos/tasks/main.yml
@@ -1,11 +1,12 @@
 ---
 
 - name: make sure out repo server is resolvable
-  lineinfile: 
-    dest: /etc/hosts 
-    line: "118.138.244.7 consistency0"
+  lineinfile:
+    dest: /etc/hosts
+    line: "{{ reposerverip }} {{ reposervername }}"  #this is duplicated in the role calculateEtcHosts
     owner: root
     group: root
+  become: true
 
 
 #- name: remove default repos
@@ -32,7 +33,7 @@
 #  when: ansible_os_family == 'RedHat' and ansible_distribution_major_version == "7"
 
 - name: add our repos
-  copy: src={{ item }} dest=/etc/yum.repos.d/{{ item }}
+  template: src={{ item }}.j2 dest=/etc/yum.repos.d/{{ item }}
   become: true
   when: ansible_os_family == 'RedHat' and ansible_distribution_major_version == "7"
   with_items:
@@ -51,10 +52,10 @@
 
 - name: disable unwanted repos
   shell: yum-config-manager --disable "{{ item }}"
-  with_items: "{{repolist.stdout_lines|difference(yumenablerepo)}}"
+  with_items: "{{ repolist.stdout_lines|difference(yumenablerepo) }}"
   become: true
   become_user: root
-  ignore_errors: true
+  ignore_errors: false
 
 
 #- name: Enable epel
diff --git a/roles/config_repos/files/epel.repo b/roles/config_repos/templates/epel.repo.j2
similarity index 70%
rename from roles/config_repos/files/epel.repo
rename to roles/config_repos/templates/epel.repo.j2
index 053ed43c..4b1017bf 100644
--- a/roles/config_repos/files/epel.repo
+++ b/roles/config_repos/templates/epel.repo.j2
@@ -2,7 +2,7 @@
 
 [epel]
 name=Extra Packages for Enterprise Linux 7 - $basearch
-baseurl=https://consistency0/epel/$releasever/$basearch/
+baseurl=https://{{ reposervername }}/epel/$releasever/$basearch/
 enabled=0
 gpgcheck=0
 sslverify=false
diff --git a/roles/config_repos/files/glusterfs-epel.repo b/roles/config_repos/templates/glusterfs-epel.repo.j2
similarity index 100%
rename from roles/config_repos/files/glusterfs-epel.repo
rename to roles/config_repos/templates/glusterfs-epel.repo.j2
diff --git a/roles/config_repos/files/monashhpc_base.repo b/roles/config_repos/templates/monashhpc_base.repo.j2
similarity index 64%
rename from roles/config_repos/files/monashhpc_base.repo
rename to roles/config_repos/templates/monashhpc_base.repo.j2
index dfbb0a77..0f0cd119 100644
--- a/roles/config_repos/files/monashhpc_base.repo
+++ b/roles/config_repos/templates/monashhpc_base.repo.j2
@@ -2,24 +2,24 @@
 
 [monashhpc_base]
 name=MonashHPC base repository mirrored to control the update process
-baseurl=https://consistency0/centos/$releasever/os/$basearch/
+baseurl=https://{{ reposervername }}/centos/$releasever/os/$basearch/
 enabled=1
 sslverify=false
 
 [monashhpc_updates]
 name=MonashHPC base repository mirrored to control the update process
-baseurl=https://consistency0/centos/$releasever/updates/$basearch/
+baseurl=https://{{ reposervername }}/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/
+baseurl=https://{{ reposervername }}/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/
+baseurl=https://{{ reposervername }}/centos/$releasever/centosplus/$basearch/
 enabled=1
 sslverify=false
diff --git a/roles/config_repos/files/monashhpc_others.repo b/roles/config_repos/templates/monashhpc_others.repo.j2
similarity index 70%
rename from roles/config_repos/files/monashhpc_others.repo
rename to roles/config_repos/templates/monashhpc_others.repo.j2
index e78702bf..bd0b0627 100644
--- a/roles/config_repos/files/monashhpc_others.repo
+++ b/roles/config_repos/templates/monashhpc_others.repo.j2
@@ -2,7 +2,7 @@
 
 [monashhpc_otherstuff]
 name=MonashHPC base repository mirrored to control the update process
-baseurl=https://consistency0/centos/hpcsystems/$releasever/$basearch/
+baseurl=https://{{ reposervername }}/centos/hpcsystems/$releasever/$basearch/
 enabled=1
 sslverify=false
 gpgcheck=0
-- 
GitLab