forked from nuvolaris/nuvolaris
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcloud-init.yaml
179 lines (178 loc) · 6.94 KB
/
cloud-init.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
#cloud-config
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
package_update: true
package_upgrade: true
package_reboot_if_required: false
write_files:
- path: "/etc/environment"
content: |-
TZ=Europe/London
runcmd:
- |
PATH=/usr/bin:$PATH
cd /home/ubuntu
git clone https://github.com/nuvolaris/nuvolaris --recurse-submodules
cp nuvolaris/gitconfig .gitconfig
cp nuvolaris/init.sh /usr/sbin/init.sh
chmod +x /usr/sbin/init.sh
echo '/usr/sbin/init.sh' >>.bashrc
echo 'source ~/nuvolaris/setup.source' >>.bashrc
echo 'source ~/nuvolaris/aliases' >>.bashrc
chown -Rvf ubuntu:ubuntu /home/ubuntu
##BEGIN##
- |
# configure dpkg && timezone
echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
- |
export TZ=Europe/London ; ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
- |
# add docker and java (amazon corretto) repos
apt-get update && apt-get -y upgrade &&\
apt-get -y install curl wget gpg zip unzip software-properties-common apt-utils unzip vim silversearcher-ag
- |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor > /usr/share/keyrings/docker-archive-keyring.gpg &&\
wget -O- https://apt.corretto.aws/corretto.key | apt-key add -
- |
ARCH=$(dpkg --print-architecture) ;\
echo "deb [arch=$ARCH signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu bionic stable" > /etc/apt/sources.list.d/docker.list &&\
add-apt-repository 'deb https://apt.corretto.aws stable main'
- |
# install software
apt-get update &&\
apt-get -y install \
sudo socat telnet \
inetutils-ping \
lsb-release \
ca-certificates \
apt-transport-https \
build-essential gettext-base \
git gnupg curl wget jq kafkacat \
zlib1g-dev libbz2-dev libncurses5-dev \
libgdbm-dev libnss3-dev libssl-dev \
libreadline-dev libffi-dev libsqlite3-dev liblzma-dev \
java-11-amazon-corretto-jdk \
docker-ce-cli
- |
# add delta to show diffs
FILE="git-delta_0.11.2_$(dpkg --print-architecture).deb" ;\
wget "https://github.com/dandavison/delta/releases/download/0.11.2/$FILE" -O "/tmp/$FILE" ;\
dpkg -i "/tmp/$FILE" ; rm "/tmp/$FILE"
- |
# Download nuv deb installer (which includes kind)
BUILD="0.3.0-dev.2308261806" ;\
ARCH="$(dpkg --print-architecture)" ;\
FILE="nuv_$(echo $BUILD)_$ARCH.deb" ;\
URL="https://github.com/nuvolaris/nuv/releases/download/$BUILD/$FILE" ;\
rm -Rvf /tmp/nuv-installer ;\
mkdir /tmp/nuv-installer ;\
wget $URL -O "/tmp/nuv-installer/$FILE" ;\
dpkg -i "/tmp/nuv-installer/$FILE"
- |
# Download Kubeadm
VER="v1.26.1" ;\
ARCH="$(dpkg --print-architecture)" ;\
URL="https://dl.k8s.io/release/$VER/bin/linux/$ARCH/kubeadm" ;\
wget $URL -O /usr/bin/kubeadm && chmod +x /usr/bin/kubeadm
- |
# Download Kustomize
VER="v4.5.4" ;\
ARCH="$(dpkg --print-architecture)" ;\
URL="https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2F$VER/kustomize_${VER}_linux_${ARCH}.tar.gz" ;\
curl -sL "$URL" | tar xzvf - -C /usr/bin
- |
# Download terraform
ARCH="$(dpkg --print-architecture)" ;\
VER=1.1.0 ;\
URL="https://releases.hashicorp.com/terraform/$VER/terraform_${VER}_linux_${ARCH}.zip" ;\
curl -sL $URL -o /tmp/terraform.zip ;\
unzip /tmp/terraform.zip -d /usr/bin ;\
rm /tmp/terraform.zip
- |
# Add the aws cli
mkdir /tmp/awscli ;\
curl -sL "https://awscli.amazonaws.com/awscli-exe-linux-$(arch).zip" -o "/tmp/awscli/awscliv2.zip" ;\
cd /tmp/awscli ; unzip awscliv2.zip ;\
./aws/install --update -b /usr/bin ;\
rm -Rvf /tmp/awscli
- |
# download the azure cli
curl -sL https://aka.ms/InstallAzureCLIDeb | bash
- |
- |
# Install eksctl
VER=v0.138.0 ;\
ARCH="$(dpkg --print-architecture)" ;\
curl -sL "https://github.com/weaveworks/eksctl/releases/download/${VER}/eksctl_Linux_${ARCH}.tar.gz" |\
tar xzvf - -C /usr/bin
- |
# Install helm
VER=v3.11.0-rc.2 ;\
ARCH="$(dpkg --print-architecture)" ;\
mkdir /tmp/helm ;\
curl -sL "https://get.helm.sh/helm-${VER}-linux-${ARCH}.tar.gz" -o "/tmp/helm/helm-${VER}-linux-${ARCH}.tar.gz"; \
cd /tmp/helm ;\
tar -zxvf "helm-${VER}-linux-${ARCH}.tar.gz" ;\
mv "./linux-${ARCH}/helm" /usr/bin/helm ;\
rm -Rvf /tmp/helm
- |
# Download openshift okd installer
VER=4.13.0-0.okd-2023-05-22-052007 ;\
BASE=https://github.com/okd-project/okd/releases/download ;\
if dpkg --print-architecture | grep arm64 ;\
then VER1="arm64-$VER" ; else VER1=$VER ; fi ;\
URL1="$BASE/$VER/openshift-install-linux-$VER1.tar.gz" ;\
URL2="$BASE/$VER/openshift-client-linux-$VER1.tar.gz" ;\
curl -sL "$URL1" | tar xzvf - -C /usr/bin/ ;\
curl -sL "$URL2" | tar xzvf - -C /usr/bin/
- |
# install ubuntu juju
mkdir /tmp/juju ; cd /tmp/juju ;\
curl -sL https://launchpad.net/juju/2.9/2.9.0/+download/juju-2.9.0-linux-$(dpkg --print-architecture).tar.xz | tar xJvf - ;\
install -o root -g root -m 0755 juju /usr/bin/juju ;\
rm -Rvf /tmp/juju
- |
# Install doctl
DO_VERSION=1.71.0 ;\
DO_BASE=https://github.com/digitalocean/doctl/releases/download ;\
ARCH=$(dpkg --print-architecture) ;\
DO_URL="$DO_BASE/v$DO_VERSION/doctl-$DO_VERSION-linux-$ARCH.tar.gz" ;\
curl -sL "$DO_URL" | tar xzvf - -C /usr/bin/
- |
# ytt
ARCH=$(dpkg --print-architecture) ;\
URL="https://github.com/carvel-dev/ytt/releases/download/v0.40.4/ytt-linux-$ARCH" ;\
curl -sL "$URL" >/usr/bin/ytt ;\
chmod +x /usr/bin/ytt
- |
# install kn
VER="v1.4.1" ;\
ARCH="$(dpkg --print-architecture)" ;\
URL="https://github.com/knative/client/releases/download/knative-$VER/kn-linux-$ARCH" ;\
curl -sL "$URL" | sudo tee /usr/bin/kn >/dev/null && sudo chmod +x /usr/bin/kn
- |
# Download WSK
VER=1.2.0 ;\
BASE=https://github.com/apache/openwhisk-cli/releases/download ;\
ARCH=$(dpkg --print-architecture) ;\
URL="$BASE/$VER/OpenWhisk_CLI-$VER-linux-$ARCH.tgz" ;\
curl -sL "$URL" | tar xzvf - -C /usr/bin/
##END##
- |
su -l ubuntu /usr/sbin/init.sh &
su -l ubuntu bash -c 'source /home/ubuntu/nuvolaris/setup.source'