-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrancheros-init.sh
70 lines (61 loc) · 1.28 KB
/
rancheros-init.sh
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
#!/bin/bash
clear
if blkid | grep RANCHER_STATE; then
# don't re-format
echo "DONE"
exit
else
echo "[ RancherOS ] Install Proceeding"
fi
INSTALL_DISK="/dev/vda"
if ! fdisk -l $INSTALL_DISK > /dev/null 2>&1; then
INSTALL_DISK="/dev/sda"
echo "[ RancherOS ] Installdisk - /dev/sda"
else
echo "[ RancherOS ] Installdisk - /dev/vda"
fi
# V4_PRIVATE_IP='wget -q -O - http://169.254.169.254/current/meta-data/local-ipv4'
# HOSTNAME='wget -q -O - http://169.254.169.254/current/meta-data/hostname'
#if ! $V4_PRIVATE; then
V4_PRIVATE='10.49.0.21'
#fi
#if ! $HOSTNAME; then
HOSTNAME='ipxe-ros-r1'
#fi
(
cat <<EOF
#cloud-init
hostname: $HOSTNAME
ssh_authorized_keys:
- ssh-rsa ...
write_files:
- path: /etc/ssh/sshd_config
permissions: "0600"
owner: root:root
content: |
AuthorizedKeysFile .ssh/authorized_keys
ClientAliveInterval 180
Subsystem sftp /usr/libexec/sftp-server
UseDNS no
PermitRootLogin no
ServerKeyBits 2048
AllowGroups docker
rancher:
network:
dns:
nameserver:
- 8.8.8.8
- 8.8.4.4
interfaces:
eth0:
dhcp: true
eth1:
address: $V4_PRIVATE_IP/16
mtu: 1450
state:
fstype: auto
dev: LABEL=RANCHER_STATE
autoformat:
- /dev/vda
EOF
) > cloud-init.yml