blob: e0aba3d961b113835ddbedcc459f2d3efa9c37ec [file] [log] [blame]
Jun Hu9e45abc2018-01-17 17:07:36 -05001# ============LICENSE_START==========================================
2# ===================================================================
Jun (Nicolas) Hu8cbcb302018-02-21 14:18:44 -05003# Copyright (c) 2017 AT&T
Jun Hu9e45abc2018-01-17 17:07:36 -05004#
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
20node_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 Hu6648f722018-05-14 14:07:37 -040037 - 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 Hu9e45abc2018-01-17 17:07:36 -050048 - 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 Hu6648f722018-05-14 14:07:37 -040071 - [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 Hu9e45abc2018-01-17 17:07:36 -050075 - [kubernetes-cni, 0.5.1-1]
76 - [nfs-utils]
Hong Guan8ba58622018-02-22 10:54:22 -050077 - git
78 - wget
Jun Hu9e45abc2018-01-17 17:07:36 -050079 runcmd:
80 - [ setenforce, 0 ]
81 - [ sysctl , '--system' ]
Jun Hu6648f722018-05-14 14:07:37 -040082 - [ 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 Hu9e45abc2018-01-17 17:07:36 -050084 - [ systemctl, enable, docker ]
85 - [ systemctl, start, docker ]
Jun Hu6648f722018-05-14 14:07:37 -040086 - [ chmod, 655, /etc/systemd/system/kubelet.service ]
87 - [ chmod, 655, /etc/systemd/system/kubelet.service.d/10-kubeadm.conf ]
Jun Hu9e45abc2018-01-17 17:07:36 -050088 - [ systemctl, enable, kubelet ]
89 - [ systemctl, start, kubelet ]
Jun Hu6648f722018-05-14 14:07:37 -040090 - [ iptables, --flush ]
91 - [ iptables, -tnat, --flush ]
Jun Hu9e45abc2018-01-17 17:07:36 -050092 - [ mkdir, '-p', /tmp/data ]
93 - [ chcon, '-Rt', svirt_sandbox_file_t, /tmp/data ]
94 - [ mkdir, '-p', /dockerdata-nfs ]
95 - [ chmod, 777, /dockerdata-nfs ]