准备工作#
首先,有几台物理服务器。且他们直接是二层网络互通的
中心节点#
选择一台物理机作为中心节点
安装centos7(我是用的centos7,当然也可以用ubuntu或者其他操作系统)
关闭防火墙##
systemctl stop firewalld.service
iptables -F
配置代理##
如果能顺利连接github等,可跳过
export no_proxy="192.168.0.1"
本地地址不用代理,这里要配置本地作为dhcp服务器的地址,多个本地地址用,隔开,centos不支持*作为通配符
export proxy
export http_proxy
export https_proxy
export ftp_proxy
配置yum mirror##
备份并修改/etc/yum.repos.d/CentOS-Base.repo
安装epel
yum install epel-release
配置mariadb的yum mirror地址
vim /etc/yum.repos.d/MariaDB.repo
[mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.1/centos7-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=0
配置pip
yum -y install python-pip
修改pip的mirror地址
mkdir -p ~/.pip/ vim ~/.pip/pip.conf [global] trusted-host=[mirror addr] index-url=http://[mirror addr]/pypi/simple/
安装git
yum -y install git
取消ssl证书校验
git config --global http.sslverify false
用ssh-keygen生成一个密钥,便于git使用
ironic的standalone用的bifrost,默认操作/opt/stack目录,因此要先创建此目录,后续在此目录下操作
mkdir /opt/stack
git clone https://git.openstack.org/openstack/bifrost.git cd bifrost vim ./playbooks/inventory/group_vars/baremetal vim ./playbooks/inventory/group_vars/localhost
mysql_password: ***** network_interface: "enp1s0f0" DHCP的地址 ironic_db_password: *****
如果前面用了代理,后面需要取消证书校验,因此要修改ansible的脚本
vim ./scripts/env-setup.sh
wget -O /tmp/get-pip.py https://bootstrap.pypa.io/get-pip.py wget -O /tmp/get-pip.py https://bootstrap.pypa.io/get-pip.py --no-check-certificate
wget -O ${file} ${url} wget -O ${file} ${url} --no-check-certificate
执行安装
bash ./scripts/env-setup.sh
安装DB并启动
yum -y install MariaDB-server MariaDB-client systemctl enable mariadb systemctl start mariadb mysql_secure_installation
执行脚本配置环境变量
source env-vars source ${ANSIBLE_INSTALL_ROOT}/ansible/hacking/env-setup
修改playbook(我在按官方文档执行ansible,自动安装过程中踩了坑,需要修改playbook和环境变量才能继续)
cd playbooks
vim ./roles/bifrost-create-dib-image/defaults/main.yml export YUM=yum export DIB_OS_ELEMENT=centos7 export DIB_YUM_REPO_CONF=/etc/yum.repos.d/CentOS-Base.repo
执行
ansible-playbook -vvvv -i inventory/localhost install.yaml
执行到下面命令时失败
disk-image-create -o /httpboot/deployment_image.qcow2 -t qcow2 centos7 vm serial-console simple-init
尝试单独执行此命令,并做如下修改后,成功
vim share/diskimage-builder/elements/pip-and-virtualenv/install.d/pip-and-virtualenv-source-install/01-install-pip yum install python-wheel rm setuptools*
vim share/diskimage-builder/elements/simple-init/install.d/simple-init-source-install/40-glean pip install glean --trusted-host pypi.python.org
通过changeroot设置镜像的密码,否则创建的qcow2镜像只能通过ssh证书登入
vim share/diskimage-builder-master\elements\centos7\pre-install.d\01-set-centos-mirror
搜索set -o pipefail,在下面增加
echo “root:mypassword” | chpasswd
OK,现在单独执行dib生成镜像
disk-image-create -o /httpboot/deployment_image.qcow2 -t qcow2 centos7 vm serial-console simple-init
然后继续执行安装命令
ansible-playbook -vvvv -i inventory/localhost install.yaml
至此,安装完毕。
网友评论