Hyunsun Moon | e484834 | 2020-02-16 04:28:55 -0800 | [diff] [blame] | 1 | # 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 | |
Hyunsun Moon | 6c6db95 | 2020-03-04 20:50:51 -0800 | [diff] [blame] | 38 | # TODO: Wait until K8S cluster is ready |
Hyunsun Moon | e484834 | 2020-02-16 04:28:55 -0800 | [diff] [blame] | 39 | - name: Install k8s |
| 40 | command: >- |
| 41 | docker run -d --privileged --restart=unless-stopped --net=host |
| 42 | --volume /etc/kubernetes:/etc/kubernetes |
| 43 | --volume /var/run:/var/run |
| 44 | rancher/rancher-agent:v2.3.3 |
| 45 | --server https://rancher.central.aetherproject.net |
| 46 | --token {{ rancher_cluster_token }} |
| 47 | --ca-checksum {{ rancher_ca_checksum }} |
| 48 | {{ k8s_roles }} |
Hyunsun Moon | 6c6db95 | 2020-03-04 20:50:51 -0800 | [diff] [blame] | 49 | changed_when: False |
Hyunsun Moon | e484834 | 2020-02-16 04:28:55 -0800 | [diff] [blame] | 50 | tags: k8s |