[CORD-2795]
Fix kubespray inventory to use new location

[CORD-2797]
Pin kubespray release version

Change-Id: Ib80a842ab52669743ab6bb887932580d7d3dd5db
diff --git a/Makefile b/Makefile
index ac4e8c7..d2b84af 100644
--- a/Makefile
+++ b/Makefile
@@ -79,7 +79,7 @@
 VAGRANT          ?= VAGRANT_CWD=$(VAGRANT_CWD) vagrant
 ANSIBLE          ?= ansible -i $(INVENTORY)
 ANSIBLE_PB       ?= ansible-playbook $(ANSIBLE_ARGS) -i $(INVENTORY) --extra-vars @$(MASTER_CONFIG)
-ANSIBLE_PB_KS    ?= ANSIBLE_CONFIG=../ansible.cfg ansible-playbook $(ANSIBLE_ARGS) -b -i inventory/inventory.cord --extra-vars @../$(MASTER_CONFIG)
+ANSIBLE_PB_KS    ?= ANSIBLE_CONFIG=../ansible.cfg ansible-playbook $(ANSIBLE_ARGS) -b -i inventory/cord/hosts.ini --extra-vars @../$(MASTER_CONFIG)
 ANSIBLE_PB_LOCAL ?= ansible-playbook $(ANSIBLE_ARGS) -i $(PI)/inventory/head-localhost $(EXTRA_VARS)
 ANSIBLE_PB_MAAS  ?= ansible-playbook $(ANSIBLE_ARGS) -i /etc/maas/ansible/pod-inventory $(EXTRA_VARS)
 IMAGEBUILDER     ?= python $(BUILD)/scripts/imagebuilder.py
diff --git a/ansible/roles/finish-kubespray/defaults/main.yml b/ansible/roles/finish-kubespray/defaults/main.yml
index 437d960..9750267 100644
--- a/ansible/roles/finish-kubespray/defaults/main.yml
+++ b/ansible/roles/finish-kubespray/defaults/main.yml
@@ -15,7 +15,7 @@
 
 # finish-kubespray/defaults/main.yml
 
-kubespray_dir: "../kubespray"
+kubespray_dir: "{{ 'kubespray' | realpath }}"
 
 management_net_cidr: "10.1.0.0/24"
 
diff --git a/ansible/roles/prep-kubespray/defaults/main.yml b/ansible/roles/prep-kubespray/defaults/main.yml
index 7e3df07..ba1c7a9 100644
--- a/ansible/roles/prep-kubespray/defaults/main.yml
+++ b/ansible/roles/prep-kubespray/defaults/main.yml
@@ -16,7 +16,6 @@
 # prep-kubespray/defaults/main.yml
 
 kubespray_version: "master"
-kubespray_dir: "../kubespray"
+kubespray_dir: "{{ 'kubespray' | realpath }}"
 
 management_net_cidr: "10.1.0.0/24"
-
diff --git a/ansible/roles/prep-kubespray/tasks/main.yml b/ansible/roles/prep-kubespray/tasks/main.yml
index 6616ac4..da81e88 100644
--- a/ansible/roles/prep-kubespray/tasks/main.yml
+++ b/ansible/roles/prep-kubespray/tasks/main.yml
@@ -21,8 +21,24 @@
     dest: "{{ kubespray_dir }}"
     version: "{{ kubespray_version }}"
 
-- name: Create kubespray inventory
+- name: Create kubespray inventory directory
+  file:
+    state: directory
+    dest: "{{ kubespray_dir }}/inventory/cord"
+    mode: 0755
+  with_items:
+    - "{{ kubespray_dir }}/inventory/cord/group_vars"
+
+# NOTE: override vars set in kubespray group_vars files using the scenario
+# config.yml file
+- name: Link group_vars directory from sample to cord directory
+  file:
+    state: link
+    src: "{{ kubespray_dir }}/inventory/sample/group_vars"
+    dest: "{{ kubespray_dir }}/inventory/cord/group_vars"
+
+- name: Create kubespray inventory file
   template:
     src: kubespray_inventory.j2
-    dest: "{{ kubespray_dir }}/inventory/inventory.cord"
+    dest: "{{ kubespray_dir }}/inventory/cord/hosts.ini"
     mode: 0644
diff --git a/ansible/roles/prep-kubespray/templates/kubespray_inventory.j2 b/ansible/roles/prep-kubespray/templates/kubespray_inventory.j2
index 6782bf2..e803340 100644
--- a/ansible/roles/prep-kubespray/templates/kubespray_inventory.j2
+++ b/ansible/roles/prep-kubespray/templates/kubespray_inventory.j2
@@ -28,3 +28,4 @@
 kube-node
 kube-master
 
+[calico-rr]
diff --git a/scenarios/controlkube/config.yml b/scenarios/controlkube/config.yml
index f38d12c..7b4fea8 100644
--- a/scenarios/controlkube/config.yml
+++ b/scenarios/controlkube/config.yml
@@ -71,6 +71,10 @@
 docker_images_prereqs:
   - prep-headnode
 
+# FIXME: check out and use this kubespray commit (set on 2018-03-02 by zdw):
+# https://github.com/kubernetes-incubator/kubespray/commit/b75b6b513b7d26a0fce3dd55a77ef538d18433a5
+kubespray_version: b75b6b513b7d26a0fce3dd55a77ef538d18433a5
+
 # have kubespray skip docker installation
 skipTags:
   - docker
diff --git a/scenarios/preppedkube/config.yml b/scenarios/preppedkube/config.yml
index 833ef99..b0aa9c1 100644
--- a/scenarios/preppedkube/config.yml
+++ b/scenarios/preppedkube/config.yml
@@ -74,6 +74,10 @@
 docker_images_prereqs:
   - prep-headnode
 
+# FIXME: check out and use this kubespray commit (set on 2018-03-02 by zdw):
+# https://github.com/kubernetes-incubator/kubespray/commit/b75b6b513b7d26a0fce3dd55a77ef538d18433a5
+kubespray_version: b75b6b513b7d26a0fce3dd55a77ef538d18433a5
+
 # have kubespray skip docker installation
 skipTags:
   - docker