blob: 042b0e0b02ee2758c47a5ce5321d95822a995a63 [file] [log] [blame]
Andy Bavierc9ffc2a2018-05-04 12:27:09 -07001---
2
3# Copyright 2017-present Open Networking Foundation
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17# This playbook can be used to install openstack-helm and XOS on the
18# "preppedkube" scenario (three VMs running K8S on a single server).
19# The intent is to duplicate the installation instructions in this doc:
20# https://docs.google.com/document/d/1_8owQLD2OtWfKMrPmqo015daeHCGlXPw4mSyLiSKHhg/edit#
21
22- name: Prep the head node
23 vars:
24 HELM_VERSION: 2.8.1
25 hosts: head
26 become: yes
27 tasks:
28 - name: Download helm binary
29 unarchive:
30 src: https://storage.googleapis.com/kubernetes-helm/helm-v{{ HELM_VERSION }}-linux-amd64.tar.gz
31 dest: /tmp
32 remote_src: yes
33
34 - name: Install helm binary
35 copy:
36 src: /tmp/linux-amd64/helm
37 dest: /usr/local/bin/helm
38 remote_src: yes
39 mode: 0755
40
41 - name: Disable apt cache
42 file:
43 path: /etc/apt/apt.conf.d/03apt-cacher-ng
44 state: absent
45
46 - name: Install apt packages
47 apt:
48 name: "{{ item }}"
49 with_items:
50 - nmap
51 - jq
52 - python-pip
53
54 - name: Stop Apache
55 service:
56 name: apache2
57 state: stopped
58 ignore_errors: yes
59
60 - name: Add node labels
61 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
62 tags:
63 - skip_ansible_lint
64
65 - name: Add head node labels
66 command: kubectl label nodes {{ ansible_hostname }} --overwrite openstack-helm-node-class=primary
67 tags:
68 - skip_ansible_lint
69
70- name: Prep all nodes
71 hosts: head compute
72 become: yes
73 tasks:
74 - name: Point node DNS resolver to kube-dns
75 copy:
76 src: files/resolv.conf.preppedkube
77 dest: /etc/resolv.conf
78
79 - name: Install ceph-common
80 apt:
81 name: ceph-common
82
83- name: Install openstack-helm
84 hosts: head
85 roles:
86 - install-openstack-helm
87
88- name: Get public key used on head node (VTN)
89 hosts: head
90 tasks:
91 - name: Read public key
92 slurp:
93 src: "{{ ansible_env.HOME }}/.ssh/authorized_keys"
94 register: public_key
95
96- name: Add public key to compute nodes (VTN)
97 hosts: compute
98 tasks:
99 - name: Add public key to compute nodes
100 authorized_key:
101 user: "{{ ansible_env.USER }}"
102 state: present
103 key: "{{ hostvars[groups['head'][0]].public_key['content'] | b64decode }}"
104
105- name: Run kubectl commands (FIX ME!!!)
106 hosts: localhost
107 connection: local
108 tasks:
109 - name: Prep openvswitch on the nodes for VTN
110 shell: |
111 OVSDB_PODS=$( kubectl get pod --namespace openstack|grep openvswitch-db|awk '{print $1}' )
112 for pod in $OVSDB_PODS
113 do
114 kubectl --namespace openstack exec $pod -- ovs-appctl -t ovsdb-server ovsdb-server/add-remote ptcp:6641
115 done
116 tags:
117 - skip_ansible_lint
118
119- name: Deploy XOS
120 hosts: localhost
121 connection: local
122 roles:
123 - deploy-xos