kolla-ansible部署train版openstack

基于kolla部署train版本的openstack-all-in-one

参考链接:https://docs.openstack.org/kolla-ansible/train/user/quickstart.html

环境版本

[root@nova1 ~]# cat /etc/redhat-release 
CentOS Linux release 7.6.1810 (Core) 
[root@nova1 ~]# docker --version
Docker version 20.10.8, build 3967b7d
[root@nova1 ~]# ansible --version
ansible 2.9.26
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.6/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.6.8 (default, Nov 16 2020, 16:55:22) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]

安装epel源

[root@nova1 ~]# yum -y install epel-release

配置hosts

[root@nova1 ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.201.133 nova1
192.168.201.134 nova2
192.168.201.135 nova3

查看hostname

[root@nova1 ~]# cat /etc/hostname 
nova1

配置pip源,方便下载python

[root@nova1 ~]# mkdir ~/.pip
[root@nova1 ~]# vim ~/.pip/pip.conf
[global]
index-url = https://mirrors.aliyun.com/pypi/simple/

[install]
trusted-host=mirrors.aliyun.com

配置网卡

[root@nova1 ~]# cd /etc/sysconfig/network-scripts/
[root@nova1 network-scripts]# cp ifcfg-ens33  ifcfg-ens37        
[root@nova1 network-scripts]# vim ifcfg-ens37
NAME="ens37"
DEVICE="ens37"
ONBOOT=yes
BOOTPROTO=none
TYPE=Ethernet
[root@nova1 network-scripts]# systemctl restart network

安装基础包和docker服务

1,安装基础包

[root@nova1 ~]# yum install -y python-devel libffi-devel gcc openssl-devel libselinux-python git python-pip
[root@nova1 ~]# wget https://bootstrap.pypa.io/pip/2.7/get-pip.py
[root@nova1 ~]# python get-pip.py
[root@nova1 ~]# pip install -U pip
[root@nova1 ~]# yum install -y yum-utils device-mapper-persistent-data lvm2 

2,安装docker

[root@nova1 ~]# yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
[root@nova1 ~]# yum -y install docker-ce 

3,设置docker volume挂载卷方式

[root@nova1 ~]# mkdir /etc/systemd/system/docker.service.d
[root@nova1 ~]# tee /etc/systemd/system/docker.service.d/kolla.conf << 'EOF'
> [Service]
> MountFlags=shared
> EOF

4,设置docker镜像加速

[root@nova1 ~]# mkdir /etc/docker/
[root@nova1 ~]# vim /etc/docker/daemon.json
{
  "registry-mirrors": ["https://1me84w5g.mirror.aliyuncs.com"]
}
[root@nova1 ~]# systemctl daemon-reload
[root@nova1 ~]# systemctl restart docker
[root@nova1 ~]# systemctl enable docker

安装kolla-ansible

安装ansible

[root@nova1 ~]# pip install 'ansible<2.10'

安装kolla-ansible train版本

[root@nova1 ~]# git clone https://github.com/openstack/kolla-ansible.git -b stable/train

安装kolla-ansible所需要的包

[root@nova1 ~]# cd kolla-ansible/
[root@nova1 kolla-ansible]# pip install pbr
[root@nova1 kolla-ansible]# pip install .
[root@nova1 kolla-ansible]# ls etc/kolla/
globals.yml  passwords.yml
[root@nova1 kolla-ansible]# cp -r etc/kolla/ /etc/kolla
[root@nova1 kolla-ansible]# ls /etc/kolla/
globals.yml  passwords.yml
[root@nova1 kolla-ansible]# ls ansible/inventory/
all-in-one  multinode
[root@nova1 kolla-ansible]# cp ansible//inventory/* /etc/kolla/
[root@nova1 kolla-ansible]# ls /etc/kolla/
all-in-one  globals.yml  multinode  passwords.yml

自定义kolla-ansible安装openstack的相关配置文件

1、自动生成openstack各服务的密码文件

[root@nova1 kolla-ansible]# kolla-genpwd 
[root@nova1 kolla-ansible]# vim /etc/kolla/passwords.yml 
改:keystone_admin_password: vN3viBr7DOkXPKzxqaNla8BkJrPXsJZSRTze6ODR
为:keystone_admin_password: admin

2、编辑 /etc/kolla/globals.yml 自定义openstack中部署事项

[root@nova1 kolla-ansible]# vim  /etc/kolla/globals.yml 
改:#kolla_base_distro: "centos"
为:kolla_base_distro: "centos"
改:#kolla_install_type: "binary"
为:kolla_install_type: "binary"
改:#openstack_release: "train"
为:openstack_release: "train"
改:kolla_internal_vip_address: "10.10.10.254"
为:kolla_internal_vip_address: "192.168.201.133"
改:#network_interface: "eth0"
为: network_interface: "ens33"
改:#neutron_external_interface: "eth1"
为: neutron_external_interface: "ens37"
改:#enable_haproxy: "yes"
为:enable_haproxy: "no"

开始基于kolla-ansible部署openstack

生成SSH Key,并授信本节点

[root@nova1 kolla-ansible]# ssh-keygen 
[root@nova1 kolla-ansible]# ssh-copy-id -i ~/.ssh/id_rsa.pub root@nova1

配置单节点清单文件

[root@nova1 kolla-ansible]# vim /etc/kolla/all-in-one   #vim命令行模式依次执行以下两条命令
:1,$s/localhost/nova1/
:1,$s/ansible_connection=local//  

开始部署OpenStack
1、安装依赖项目

[root@nova1 kolla-ansible]# kolla-ansible -i /etc/kolla/all-in-one  bootstrap-servers

执行部署检测

[root@nova1 kolla-ansible]# kolla-ansible -i /etc/kolla/all-in-one  prechecks

开始部署

[root@nova1 ~]# kolla-ansible -i /etc/kolla/all-in-one deploy

部署完成

kolla-ansible部署train版openstack_第1张图片

验证部署

[root@nova1 ~]# kolla-ansible post-deploy  /etc/kolla/all-in-one 

kolla-ansible部署train版openstack_第2张图片

验证部署完成后就创建了/etc/kolla/admin-openrc.sh 文件

查看脚本内容获取账号密码

kolla-ansible部署train版openstack_第3张图片

浏览器访问192.168.200.133

kolla-ansible部署train版openstack_第4张图片

你可能感兴趣的:(linux,运维,centos,openstack)