blob: 1561d1aa1ce01d1c81b92a411765f8c1ddb2cde3 [file] [log] [blame]
Hyunsun Moone4848342020-02-16 04:28:55 -08001# Copyright 2020-present Open Networking Foundation
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15---
16- name: Initialize k8s role
17 set_fact:
18 k8s_roles: ""
19 tags: k8s
20
21- name: Add k8s master role
22 set_fact:
23 k8s_roles: "{{ k8s_roles }} --etcd --controlplane"
24 when: "'kube-master' in group_names"
25 tags: k8s
26
27- name: Add k8s worker role
28 set_fact:
29 k8s_roles: "{{ k8s_roles }} --worker"
30 when: "'kube-worker' in group_names"
31 tags: k8s
32
33- name: Print k8s roles
34 debug:
35 msg: k8s_roles {{ k8s_roles }}
36 tags: k8s
37
38- name: Install k8s
39 command: >-
40 docker run -d --privileged --restart=unless-stopped --net=host
41 --volume /etc/kubernetes:/etc/kubernetes
42 --volume /var/run:/var/run
43 rancher/rancher-agent:v2.3.3
44 --server https://rancher.central.aetherproject.net
45 --token {{ rancher_cluster_token }}
46 --ca-checksum {{ rancher_ca_checksum }}
47 {{ k8s_roles }}
48 tags: k8s