openstack cloud init set password
设置代理和password
#!/bin/bash # passwd centos << EOF
passwd ubuntu << EOF EOF
if [ $? -ne ]; then
passwd centos << EOF EOF
fi passwd root << EOF EOF sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
service sshd restart cd /home/ubuntu
if [ $? -ne ]; then
cd /home/centos
fi wget otcloud-gateway.bj.intel.com/script.tar.gz
if [ $? -ne ]; then
curl -O otcloud-gateway.bj.intel.com/script.tar.gz
fi tar xzvf script.tar.gz
cd script
# sed -i '/enable_service n-novnc/a enable_plugin cyborg git://git.openstack.org/openstack/cyborg\nOPAE_INSTALL_ENABLE=false' gen-localconf.sh
./vm-setup.sh
bug fix:
cd ~/script
sed -i -e 's/^\(.*\)CTRL_IP=.*ip route get.*/\1CTRL_IP=$(ip route get 1 | awk \x27{match($0, \/.+src\\s([.0-9]+)\/, a);print a[1];exit}\x27)/' environment.inc
sed -i -e 's/^\(.*\)MY_IP=.*ip route get.*/\MY_IP=$(ip route get 1 | awk \x27{match($0, \/.+src\\s([.0-9]+)\/, a);print a[1];exit}\x27)/' gen-localconf.sh
sed -i -e 's/^\(.*\)MY_IP=.*ip route get.*/\MY_IP=$(ip route get 1 | awk \x27{match($0, \/.+src\\s([.0-9]+)\/, a);print a[1];exit}\x27)/' lm-prep.sh
sed -i -e '/^\(.*\)CTRL_IP=.*ip route get.*/a\date ; read -t 10 -p "Input service IP then hit ENTER or wait ten seconds: " SERVICE_HOST; echo $SERVICE_HOST; date\nCTRL_IP=${SERVICE_HOST:-$CTRL_IP}\n' environment.inc
安装docker
wget -O- https://get.docker.com/ |bash
# sudo usermod -aG docker $USER
sudo usermod -aG docker ubuntu
整个安装k8s脚本和devstack脚本(init_cloud中)
go install https://github.com/udhos/update-golang
#!/bin/bash
cd /home/ubuntu
wget otcloud-gateway.bj.intel.com/script.tar.gz
if [ $? -ne ]; then
curl -O otcloud-gateway.bj.intel.com/script.tar.gz
fi
tar xzvf script.tar.gz
cd script
source environment.inc
sed -i '/enable_service n-novnc/a enable_plugin cyborg git://git.openstack.org/openstack/cyborg\nOPAE_INSTALL_ENABLE=false' gen-localconf.sh
./vm-setup.sh
./prep.sh UNAME=/home/ubuntu
UHOME=/home/ubuntu
USERN=ubuntu
# passwd centos << EOF
passwd ubuntu << EOF EOF
if [ $? -ne ]; then
UHOME=/home/centos
UNAME=/home/centos
USERN=centos
passwd centos << EOF EOF
fi passwd root << EOF EOF # Clone the latest devstack
cd $UNAME
git clone /opt/git/openstack-dev/devstack.git cd $UNAME/devstack
# generate local.conf
$TOPDIR/gen-localconf.sh mkdir files
cp /opt/git/images/get-pip.py files/
# ./stack.sh # please run stack manually sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
service ssh restart # install docker
wget -O- https://get.docker.com/ |bash
sudo usermod -aG docker $USERN # $USER # ~/.profile # install go
GOVER=1.10
GOLATEST=1.10.
sudo add-apt-repository ppa:gophers/archive
sudo apt update
# UHOME=/home/ubuntu # UHOME=~
ENV_SCRIPT=.profile
GO_ROOT=/usr/lib/go-$GOVER/bin
GO_ROOT=/usr/lib/go-latest/bin
GO=go
# echo "PATH=\$PATH:$GO_ROOT:/usr/local/go/bin" >> $UHOME/$ENV_SCRIPT
echo "PATH=\$PATH:$UHOME/go/bin" >> $UHOME/$ENV_SCRIPT
# sudo apt-get -y install golang-$GOVER-go
# sudo ln -s /usr/lib/go-$GOVER /usr/lib/go-latest
# wget https://dl.google.com/go/go$GOLATEST.linux-amd64.tar.gz
OS=linux
ARCH=amd64
# sudo tar -C /usr/local -xzf go$GOLATEST.$OS-$ARCH.tar.gz
echo "PATH=\$PATH:/usr/local/go/bin" >> $UHOME/$ENV_SCRIPT
wget -O- https://raw.githubusercontent.com/udhos/update-golang/master/update-golang.sh | sudo bash
# install cfssl
GOPATH=$UHOME/go $GO_ROOT/go get -u github.com/cloudflare/cfssl/cmd/... # root user # install k8s code
git clone https://github.com/kubernetes/kubernetes.git $UHOME/kubernetes
cd $UHOME/kubernetes # install etcd
hack/install-etcd.sh # Installs in ./third_party/etcd
echo "export PATH=\"\$PATH:$(pwd)/third_party/etcd\"" >> $UHOME/$ENV_SCRIPT # Add to PATH chown -R $USERN:$USERN /home/$USERN cat > /usr/bin/kubectl <<<'#!/bin/bash
/home/$USERN/kubernetes/cluster/kubectl.sh $@' chmod a+x /usr/bin/kubectl
对于K8s登陆机器, 手动执行以下指令,已经放在了cloud init中,可以忽略。
# into VM rum manually
UHOME=/home/ubuntu # UHOME=~
ENV_SCRIPT=.profile
GOLATEST=1.10.2
GOVER=1.10
GO_ROOT=/usr/lib/go-$GOVER/bin
GO_ROOT=/usr/lib/go-latest/bin
GO=go
# echo "PATH=\$PATH:$GO_ROOT" >> $UHOME/$ENV_SCRIPT
# sudo apt-get -y install golang-$GOVER-go
# sudo ln -s /usr/lib/go-$GOVER /usr/lib/go-latest
# wget https://dl.google.com/go/go$GOLATEST.linux-amd64.tar.gz
OS=linux
ARCH=amd64
# sudo tar -C /usr/local -xzf go$GOLATEST.$OS-$ARCH.tar.gz
wget -O- https://raw.githubusercontent.com/udhos/update-golang/master/update-golang.sh | sudo bash
echo "PATH=\$PATH:/usr/local/go/bin" >> $UHOME/$ENV_SCRIPT
source $UHOME/$ENV_SCRIPT
cat >> $UHOME/$ENV_SCRIPT <<<'
GOROOT=`go env |grep "GOROOT" |cut -d "=" -f2`
GOROOT=${GOROOT#\"}
GOROOT=${GOROOT%\"}
GOPATH=`go env |grep GOPATH |cut -d "=" -f `
GOPATH=${GOPATH%\"}
GOPATH=${GOPATH#\"}
export PATH="$PATH:$GOPATH/bin"' source $UHOME/$ENV_SCRIPT # install cfssl
# GOPATH=$UHOME/go $GO_ROOT/go get -u github.com/cloudflare/cfssl/cmd/... # root user
go get -u github.com/cloudflare/cfssl/cmd/... # ubuntu user
# install k8s code
git clone https://github.com/kubernetes/kubernetes.git $UHOME/kubernetes
cd $UHOME/kubernetes # install etcd
hack/install-etcd.sh # Installs in ./third_party/etcd
echo "export PATH=\"\$PATH:$(pwd)/third_party/etcd\"" >> $UHOME/$ENV_SCRIPT # Add to PATH
对于devstack,登陆机器, 手动执行以下指令,不知道为啥不能放在cloud init中, 是source environment.inc 执行太晚了, 这个也可以忽略了。
UHOME=~ cd /home/ubuntu/script
source environment.inc
sudo mount -t nfs $gitcache:/data/git /opt/git # Clone the latest devstack
cd $UHOME
git clone /opt/git/openstack-dev/devstack.git cd $UHOME/devstack
# generate local.conf
sed -i '/enable_service n-novnc/a enable_plugin cyborg git://git.openstack.org/openstack/cyborg\nOPAE_INSTALL_ENABLE=false' $TOPDIR/gen-localconf.sh
$TOPDIR/gen-localconf.sh sudo cp /opt/git/images/get-pip.py files/
登陆host机器 执行
wget http://otcloud-gateway.bj.intel.com/id_rsa.team -O ~/.ssh/id_rsa.team
chmod ~/.ssh/id_rsa.team
进入 kubernetes 运行一下命令。
cd ~/kubernetes
hack/local-up-cluster.sh
进入devstack 运行一下命令
cd ~/devstack
source ~/script/environment.inc
TOPDIR=/home/ubuntu/script
# generate local.conf
$TOPDIR/gen-localconf.sh
./stack.sh
$ cat ~/.ssh/config
cat >> ~/.ssh/config <<<'
Host review.openstack.org
HostName review.openstack.org
User shaohefeng
Port
IdentityFile ~/.ssh/id_rsa.team Host public
HostName 10.238.153.33
User team
IdentityFile ~/.ssh/id_rsa.team Host k8s-dev
HostName 10.0.0.28
User ubuntu
IdentityFile ~/.ssh/id_rsa.team
ProxyCommand ssh public nc %h %p'
set DNS
sudo su
cat > /etc/docker/daemon.json <<<'{
"dns": ["10.239.27.228"]
}'
exit sudo systemctl restart docker
openstack cloud init set password的更多相关文章
- openstack 使用cloud init 和 console-log, nbd或者libguestfs 获取VM中的硬件信息。
以获取PCI的信息为例. 基本代码: pci.py import base64 import guestfs from functools import partial import os impor ...
- ubuntu server cloud img username password
新安装了OpenStack Queens发现无镜像,蹦蹦跳跳的下载了ubuntu的镜像 网址https://cloud-images.ubuntu.com/ 最好你自己找你想要的,vmdk.ova.i ...
- OpenStack cloud 第一天
这是刚接触openstack时候,看到的第一篇文章,感触很深,自己很喜欢的一个词Horizon就是出自本文 ============================================ ...
- OpenStack笔记
*********virsh xml文件解读****************************** https://libvirt.org/format.html https://libvirt ...
- 【OpenStack 虚拟机初始化user-data & Cloud-init】
示例: import httplib import json import base64 tenant_id='xxx' token='xxx' compute_host="xxx" ...
- OpenStack Magnum项目简介
1 项目简介 Magnum是OpenStack中一个提供容器集群部署的服务. Magnum是一个Pass层的OpenStack项目. Magnum使用Heat部署一个包含Docker和Kubernet ...
- OpenStack Mitaka 版本中的 domain 和 admin
OpenStack 的 Keystone V3 中引入了 Domain 的概念.引入这个概念后,关于 admin 这个role 的定义就变得复杂了起来. 本文测试环境是社区 Mitaka 版本. 1. ...
- openstack命令行
openstack的每一个子项目(project)都有自己对应的命令行API,所有的这些API都是基于RESTful的,python代码实现的API.也就是说,这些API都是基于HTTP实现的,所以A ...
- openstack 云平台API
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAABVYAAAKrCAIAAACV8EEMAAAgAElEQVR4nOydeVgUaZ7n/W9299nd7n
随机推荐
- curl不能支持https问题
前面说了 update nss 并没有解决问题. 想办法重新安装一下:CURL 1.下载安装包 [root@mycentos ~]# wget https://curl.haxx.se/downloa ...
- Facebook的bigpipe
参考文档:英文版:http://www.cubrid.org/blog/dev-platform/faster-web-page-loading-with-facebook-bigpipe/ 搜索技术 ...
- 移动开发--移动web特别样式处理
高清图片:100px*200px的图片 设置100px*100px的大小,会被拉大,变模糊,应该用100dp*100dp(物理像素)去渲染. 一像素边框: 相对单位rem: 多行文本溢出.
- CI持续集成系统环境--Gitlab+Gerrit+Jenkins完整对接
原文地址https://www.cnblogs.com/kevingrace/p/5651447.html 近年来,由于开源项目.社区的活跃热度大增,进而引来持续集成(CI)系统的诞生,也越发的听到更 ...
- 阿里云云盾服务证书免费CA证书申请与配置 (原)
申请入口(首页导航产品->安全->CA证书服务->立即购买) 免费版选择步骤一步一步来 1.品牌选 Symantec 2.保护类型选择 一个域名(免费版只能一个好像) 3.证书类型选 ...
- org.joda.time.DateTime 日期格式
最近一直在使用Java,偶尔一次遇到日期(util)的格式转换,心里还是规矩的写着记忆里面的代码,但是在自己测试的时候发现不正确,具体看了下代码,发现这里使用jota的方式编写,顺道查了一下,做了笔记 ...
- [ Windows BAT Script ] 删除某个目录下的所有某类文件
删除某个目录下的所有某类文件 @echo off for /R %%s in (*.txt) do ( echo %%s del %%s ) pause @echo on
- java三大工厂结果总览
2018-11-02 21:27:18 开始写 谢谢.Thank you.Salamat Do(撒拉玛特朵).あリがCám o*n(嘉蒙)とゥ(阿里嘎都).감사합니다 (勘三哈咪瘩).terima K ...
- Spark学习之路 (十七)Spark分区
一.分区的概念 分区是RDD内部并行计算的一个计算单元,RDD的数据集在逻辑上被划分为多个分片,每一个分片称为分区,分区的格式决定了并行计算的粒度,而每个分区的数值计算都是在一个任务中进行的,因此任务 ...
- Java技术整理1---反射机制及动态代理详解
1.反射是指在程序运行过程中动态获取类的相关信息,包括类是通过哪个加载器进行加载,类的方法和成员变量.构造方法等. 如下示例可以通过三种方法根据类的实例来获取该类的相关信息 public static ...