CORD-2954 Playbook automating documented openstack-helm installation instructions
Change-Id: Ibf2072c01925c82302a91ea13c8ebaf4e21db80c
diff --git a/openstack-helm/install-on-preppedkube.yml b/openstack-helm/install-on-preppedkube.yml
new file mode 100644
index 0000000..042b0e0
--- /dev/null
+++ b/openstack-helm/install-on-preppedkube.yml
@@ -0,0 +1,123 @@
+---
+
+# Copyright 2017-present Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# This playbook can be used to install openstack-helm and XOS on the
+# "preppedkube" scenario (three VMs running K8S on a single server).
+# The intent is to duplicate the installation instructions in this doc:
+# https://docs.google.com/document/d/1_8owQLD2OtWfKMrPmqo015daeHCGlXPw4mSyLiSKHhg/edit#
+
+- name: Prep the head node
+ vars:
+ HELM_VERSION: 2.8.1
+ hosts: head
+ become: yes
+ tasks:
+ - name: Download helm binary
+ unarchive:
+ src: https://storage.googleapis.com/kubernetes-helm/helm-v{{ HELM_VERSION }}-linux-amd64.tar.gz
+ dest: /tmp
+ remote_src: yes
+
+ - name: Install helm binary
+ copy:
+ src: /tmp/linux-amd64/helm
+ dest: /usr/local/bin/helm
+ remote_src: yes
+ mode: 0755
+
+ - name: Disable apt cache
+ file:
+ path: /etc/apt/apt.conf.d/03apt-cacher-ng
+ state: absent
+
+ - name: Install apt packages
+ apt:
+ name: "{{ item }}"
+ with_items:
+ - nmap
+ - jq
+ - python-pip
+
+ - name: Stop Apache
+ service:
+ name: apache2
+ state: stopped
+ ignore_errors: yes
+
+ - name: Add node labels
+ command: kubectl label nodes --all --overwrite ceph-mds=enabled ceph-mgr=enabled ceph-mon=enabled ceph-osd=enabled ceph-rgw=enabled linuxbridge=enabled openstack-compute-node=enabled openstack-control-plane=enabled openvswitch=enabled openstack-helm-node-class=general
+ tags:
+ - skip_ansible_lint
+
+ - name: Add head node labels
+ command: kubectl label nodes {{ ansible_hostname }} --overwrite openstack-helm-node-class=primary
+ tags:
+ - skip_ansible_lint
+
+- name: Prep all nodes
+ hosts: head compute
+ become: yes
+ tasks:
+ - name: Point node DNS resolver to kube-dns
+ copy:
+ src: files/resolv.conf.preppedkube
+ dest: /etc/resolv.conf
+
+ - name: Install ceph-common
+ apt:
+ name: ceph-common
+
+- name: Install openstack-helm
+ hosts: head
+ roles:
+ - install-openstack-helm
+
+- name: Get public key used on head node (VTN)
+ hosts: head
+ tasks:
+ - name: Read public key
+ slurp:
+ src: "{{ ansible_env.HOME }}/.ssh/authorized_keys"
+ register: public_key
+
+- name: Add public key to compute nodes (VTN)
+ hosts: compute
+ tasks:
+ - name: Add public key to compute nodes
+ authorized_key:
+ user: "{{ ansible_env.USER }}"
+ state: present
+ key: "{{ hostvars[groups['head'][0]].public_key['content'] | b64decode }}"
+
+- name: Run kubectl commands (FIX ME!!!)
+ hosts: localhost
+ connection: local
+ tasks:
+ - name: Prep openvswitch on the nodes for VTN
+ shell: |
+ OVSDB_PODS=$( kubectl get pod --namespace openstack|grep openvswitch-db|awk '{print $1}' )
+ for pod in $OVSDB_PODS
+ do
+ kubectl --namespace openstack exec $pod -- ovs-appctl -t ovsdb-server ovsdb-server/add-remote ptcp:6641
+ done
+ tags:
+ - skip_ansible_lint
+
+- name: Deploy XOS
+ hosts: localhost
+ connection: local
+ roles:
+ - deploy-xos