40 lines
1 KiB
Bash
40 lines
1 KiB
Bash
|
#/bin/sh
|
||
|
|
||
|
if [ $# -lt 2 ]; then
|
||
|
echo "Insufficient Args"
|
||
|
echo "Please pass IPv6 address like [2a0a:e5c0:0:2:0:b3ff:fe39:7994] and password of root"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
# Enable Alpine (3.10 + Edge) Repos
|
||
|
cat > /etc/apk/repositories << EOF
|
||
|
http://dl-cdn.alpinelinux.org/alpine/v3.10/main
|
||
|
http://dl-cdn.alpinelinux.org/alpine/v3.10/community
|
||
|
http://dl-cdn.alpinelinux.org/alpine/edge/main
|
||
|
http://dl-cdn.alpinelinux.org/alpine/edge/community
|
||
|
http://dl-cdn.alpinelinux.org/alpine/edge/testing
|
||
|
EOF
|
||
|
|
||
|
|
||
|
# Update Package List and Upgrade System
|
||
|
apk update
|
||
|
apk upgrade
|
||
|
|
||
|
apk add etcd etcd-ctl
|
||
|
|
||
|
sed -i -e "s/localhost/$1/g" /etc/etcd/conf.yml
|
||
|
|
||
|
# Should be made better
|
||
|
sed -i -e "s/initial-cluster:/initial-cluster: http:\/\/$1:2380/g" /etc/etcd/conf.yml
|
||
|
|
||
|
echo 'alias etcdctl="ETCDCTL_API=3 etcdctl"' >> ~/.bashrc
|
||
|
source ~/.bashrc
|
||
|
|
||
|
service etcd start
|
||
|
rc-update add etcd
|
||
|
|
||
|
|
||
|
etcdctl --endpoints http://$1:2379 user add root:$2
|
||
|
etcdctl --endpoints http://$1:2379 user grant root --roles root
|
||
|
etcdctl --endpoints http://$1:2379 auth enable
|