Jun Hu | 9e45abc | 2018-01-17 17:07:36 -0500 | [diff] [blame] | 1 | # ============LICENSE_START========================================== |
| 2 | # =================================================================== |
Jun (Nicolas) Hu | 8cbcb30 | 2018-02-21 14:18:44 -0500 | [diff] [blame] | 3 | # Copyright (c) 2017 AT&T |
Jun Hu | 9e45abc | 2018-01-17 17:07:36 -0500 | [diff] [blame] | 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 | #============LICENSE_END============================================ |
| 17 | |
| 18 | # this is the cloud init. It will install the reqiured packages and do some basic config on every VM. |
| 19 | |
| 20 | node_templates: |
| 21 | |
| 22 | cloudify_host_cloud_config: |
| 23 | type: cloudify.nodes.CloudInit.CloudConfig |
| 24 | properties: |
| 25 | resource_config: |
| 26 | groups: |
| 27 | - docker |
| 28 | users: |
| 29 | - name: { get_input: agent_user } |
| 30 | primary-group: wheel |
| 31 | groups: docker |
| 32 | shell: /bin/bash |
| 33 | sudo: ['ALL=(ALL) NOPASSWD:ALL'] |
| 34 | ssh-authorized-keys: |
| 35 | - { get_secret: agent_key_public } |
| 36 | write_files: |
Jun Hu | 6648f72 | 2018-05-14 14:07:37 -0400 | [diff] [blame^] | 37 | - path: /etc/yum.repos.d/docker.repo |
| 38 | owner: root:root |
| 39 | permissions: '0444' |
| 40 | content: | |
| 41 | # installed by cloud-init |
| 42 | [dockerrepo] |
| 43 | name=Docker Repository |
| 44 | baseurl=https://yum.dockerproject.org/repo/main/centos/7 |
| 45 | enabled=1 |
| 46 | gpgcheck=1 |
| 47 | gpgkey=https://yum.dockerproject.org/gpg |
Jun Hu | 9e45abc | 2018-01-17 17:07:36 -0500 | [diff] [blame] | 48 | - path: /etc/yum.repos.d/kubernetes.repo |
| 49 | owner: root:root |
| 50 | permissions: '0444' |
| 51 | content: | |
| 52 | # installed by cloud-init |
| 53 | [kubernetes] |
| 54 | name=Kubernetes |
| 55 | baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64 |
| 56 | enabled=1 |
| 57 | gpgcheck=1 |
| 58 | repo_gpgcheck=1 |
| 59 | gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg |
| 60 | https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg |
| 61 | |
| 62 | - path: /etc/sysctl.d/k8s.conf |
| 63 | owner: root:root |
| 64 | permissions: '0444' |
| 65 | content: | |
| 66 | # installed by cloud-init |
| 67 | net.bridge.bridge-nf-call-ip6tables = 1 |
| 68 | net.bridge.bridge-nf-call-iptables = 1 |
| 69 | |
| 70 | packages: |
Jun Hu | 6648f72 | 2018-05-14 14:07:37 -0400 | [diff] [blame^] | 71 | - [docker-engine, 17.03.0.ce-1.el7.centos] |
| 72 | - [kubelet, 1.8.10-0] |
| 73 | - [kubeadm, 1.8.10-0] |
| 74 | - [kubectl, 1.8.10-0] |
Jun Hu | 9e45abc | 2018-01-17 17:07:36 -0500 | [diff] [blame] | 75 | - [kubernetes-cni, 0.5.1-1] |
| 76 | - [nfs-utils] |
Hong Guan | 8ba5862 | 2018-02-22 10:54:22 -0500 | [diff] [blame] | 77 | - git |
| 78 | - wget |
Jun Hu | 9e45abc | 2018-01-17 17:07:36 -0500 | [diff] [blame] | 79 | runcmd: |
| 80 | - [ setenforce, 0 ] |
| 81 | - [ sysctl , '--system' ] |
Jun Hu | 6648f72 | 2018-05-14 14:07:37 -0400 | [diff] [blame^] | 82 | - [ update-ca-trust, force-enable ] |
| 83 | - "sed -i 's|/usr/bin/dockerd|/usr/bin/dockerd --exec-opt native.cgroupdriver=systemd|g' /usr/lib/systemd/system/docker.service" |
Jun Hu | 9e45abc | 2018-01-17 17:07:36 -0500 | [diff] [blame] | 84 | - [ systemctl, enable, docker ] |
| 85 | - [ systemctl, start, docker ] |
Jun Hu | 6648f72 | 2018-05-14 14:07:37 -0400 | [diff] [blame^] | 86 | - [ chmod, 655, /etc/systemd/system/kubelet.service ] |
| 87 | - [ chmod, 655, /etc/systemd/system/kubelet.service.d/10-kubeadm.conf ] |
Jun Hu | 9e45abc | 2018-01-17 17:07:36 -0500 | [diff] [blame] | 88 | - [ systemctl, enable, kubelet ] |
| 89 | - [ systemctl, start, kubelet ] |
Jun Hu | 6648f72 | 2018-05-14 14:07:37 -0400 | [diff] [blame^] | 90 | - [ iptables, --flush ] |
| 91 | - [ iptables, -tnat, --flush ] |
Jun Hu | 9e45abc | 2018-01-17 17:07:36 -0500 | [diff] [blame] | 92 | - [ mkdir, '-p', /tmp/data ] |
| 93 | - [ chcon, '-Rt', svirt_sandbox_file_t, /tmp/data ] |
| 94 | - [ mkdir, '-p', /dockerdata-nfs ] |
| 95 | - [ chmod, 777, /dockerdata-nfs ] |